From 0861be14c15fef9e87235d5d56abbf1bda9f14dc Mon Sep 17 00:00:00 2001 From: jbertram Date: Tue, 15 Nov 2016 17:10:17 -0600 Subject: [PATCH] ARTEMIS-789 Fix various failing tests due to addressing changes --- .../artemis/cli/commands/AbstractAction.java | 1 - .../activemq/artemis/cli/commands/Create.java | 37 ++- .../cli/commands/address/CreateAddress.java | 1 - .../cli/commands/address/ShowAddress.java | 3 +- .../artemis/cli/commands/etc/broker.xml | 4 +- .../apache/activemq/cli/test/ArtemisTest.java | 18 +- .../config/ActiveMQDefaultConfiguration.java | 4 +- .../api/core/client/ClientSession.java | 28 +++ .../management/ActiveMQServerControl.java | 33 ++- .../core/management/ObjectNameBuilder.java | 2 +- .../core/client/impl/ClientSessionImpl.java | 37 ++- .../core/impl/ActiveMQSessionContext.java | 6 +- .../protocol/core/impl/PacketDecoder.java | 6 + .../core/protocol/core/impl/PacketImpl.java | 2 + .../impl/wireformat/CreateQueueMessage.java | 26 +- .../wireformat/CreateQueueMessage_V2.java | 99 ++++++++ .../activemq/artemis/core/security/Role.java | 23 +- .../spi/core/remoting/SessionContext.java | 3 +- .../artemis/utils/SecurityFormatter.java | 7 +- .../src/test/scripts/validate-instalation.sh | 4 +- .../src/main/resources/artemis.xml | 4 +- .../jms/client/ActiveMQMessageProducer.java | 2 +- .../artemis/jms/client/ActiveMQSession.java | 9 +- .../jms/server/impl/JMSServerManagerImpl.java | 4 +- .../protocol/openwire/OpenWireConnection.java | 1 - .../protocol/openwire/amq/AMQSession.java | 2 +- .../core/protocol/stomp/StompConnection.java | 26 +- .../impl/FileConfigurationParser.java | 26 ++ .../impl/ActiveMQServerControlImpl.java | 91 ++++++- .../persistence/config/PersistedRoles.java | 29 ++- .../AbstractJournalStorageManager.java | 1 + .../core/postoffice/impl/PostOfficeImpl.java | 4 +- .../core/ServerSessionPacketHandler.java | 13 +- .../artemis/core/server/ActiveMQServer.java | 1 - .../artemis/core/server/ServerSession.java | 2 +- .../core/server/impl/ActiveMQServerImpl.java | 27 +- .../artemis/core/server/impl/AddressInfo.java | 11 + .../impl/AutoCreatedQueueManagerImpl.java | 8 +- .../artemis/core/server/impl/QueueImpl.java | 2 +- .../core/server/impl/ServerSessionImpl.java | 7 +- .../core/settings/impl/AddressSettings.java | 167 +++++++++++-- .../schema/artemis-configuration.xsd | 43 +++- .../config/impl/FileConfigurationTest.java | 4 +- .../artemis/core/security/RoleTest.java | 20 +- .../core/settings/AddressSettingsTest.java | 10 +- .../artemis/core/settings/RepositoryTest.java | 14 +- .../ConfigurationTest-full-config.xml | 8 + artemis-tools/pom.xml | 2 +- docs/user-manual/en/queue-attributes.md | 32 ++- .../readme.html | 1 - .../ClusteredDurableSubscriptionExample.java | 2 + .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../clustered/clustered-grouping/readme.html | 2 - .../resources/activemq/server0/broker.xml | 5 +- .../resources/activemq/server1/broker.xml | 5 +- .../resources/activemq/server2/broker.xml | 5 +- .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../clustered/clustered-queue/readme.html | 1 - .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../readme.html | 1 - .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server1/broker.xml | 2 +- .../resources/activemq/server2/broker.xml | 2 +- .../resources/activemq/server3/broker.xml | 2 +- .../clustered-static-discovery/readme.html | 1 - .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server2/broker.xml | 3 +- .../resources/activemq/server3/broker.xml | 3 +- .../clustered-static-oneway/readme.html | 1 - .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server2/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server1/broker.xml | 2 +- .../clustered/clustered-topic/readme.html | 1 - .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 5 +- .../resources/activemq/server1/broker.xml | 5 +- .../clustered/symmetric-cluster/readme.html | 1 - .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server2/broker.xml | 3 +- .../resources/activemq/server3/broker.xml | 3 +- .../resources/activemq/server4/broker.xml | 3 +- .../resources/activemq/server5/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 9 +- .../resources/activemq/server1/broker.xml | 9 +- .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 1 - .../resources/activemq/server1/broker.xml | 1 - .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server2/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 7 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 3 +- .../resources/activemq/server1/broker.xml | 3 +- .../resources/activemq/server0/broker.xml | 10 +- .../resources/activemq/server1/broker.xml | 2 +- examples/features/standard/cdi/pom.xml | 12 + .../resources/activemq/server0/broker.xml | 6 +- .../resources/activemq/server0/broker.xml | 4 +- .../resources/activemq/server0/broker.xml | 18 +- .../resources/activemq/server1/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 6 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server1/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 2 +- .../jms/example/LargeMessageExample.java | 2 +- .../resources/activemq/server0/broker.xml | 4 +- .../resources/activemq/server0/broker.xml | 6 +- .../jms/example/ManagementExample.java | 10 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server0/broker.xml | 8 +- .../resources/activemq/server0/broker.xml | 8 +- .../jms/example/PreacknowledgeExample.java | 3 +- .../resources/activemq/server0/broker.xml | 4 +- .../resources/activemq/server0/broker.xml | 4 +- .../resources/activemq/server0/broker.xml | 4 +- .../resources/activemq/server0/broker.xml | 6 +- .../resources/activemq/server0/broker.xml | 6 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 6 +- .../resources/activemq/server0/broker.xml | 4 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 2 +- .../resources/activemq/server0/broker.xml | 4 +- .../resources/activemq/server0/broker.xml | 8 +- .../artemis/jms/example/ProtonCPPExample.java | 3 +- .../resources/activemq/server0/broker.xml | 2 +- .../addressing/AddressingTest.java | 6 +- .../amqp/AmqpClientTestSupport.java | 2 +- .../integration/cli/AddressCommandTest.java | 4 - .../integration/cli/QueueCommandTest.java | 4 +- .../client/AutoCreateJmsDestinationTest.java | 4 +- .../tests/integration/client/SessionTest.java | 3 +- .../failover/SecurityFailoverTest.java | 2 +- .../crossprotocol/AMQPToOpenwireTest.java | 2 +- .../crossprotocol/OpenWireToAMQPTest.java | 2 +- .../interceptors/InterceptorTest.java | 8 +- .../cluster/AutoCreateQueueClusterTest.java | 10 +- .../cluster/TemporaryQueueClusterTest.java | 2 +- .../jms/jms2client/NonExistentQueueTest.java | 4 +- .../management/ActiveMQServerControlTest.java | 4 +- .../ActiveMQServerControlUsingCoreTest.java | 42 +++- .../management/AddressControlTest.java | 4 +- .../AddressControlUsingCoreTest.java | 2 +- .../management/ManagementWithStompTest.java | 232 ------------------ ...ManagementWithConfiguredAdminUserTest.java | 4 +- .../management/SecurityNotificationTest.java | 4 +- .../mqtt/imported/MQTTTestSupport.java | 3 +- .../openwire/OpenWireTestBase.java | 10 +- .../openwire/SimpleOpenWireTest.java | 21 +- .../RolesConfigurationStorageTest.java | 10 +- .../ActiveMQMessageHandlerSecurityTest.java | 2 +- .../tests/integration/ra/JMSContextTest.java | 2 +- .../ra/OutgoingConnectionTest.java | 2 +- .../ra/OutgoingConnectionTestJTA.java | 2 +- .../security/LDAPSecurityTest.java | 4 +- .../integration/security/SecurityTest.java | 102 ++++---- .../integration/server/ResourceLimitTest.java | 2 +- .../ssl/DualAuthenticationTest.java | 4 +- .../tests/integration/stomp/StompTest.java | 58 +++++ .../integration/stomp/StompTestBase.java | 8 +- .../integration/stomp/v12/StompV12Test.java | 7 +- .../tests/util/JMSClusteredTestBase.java | 2 - .../src/test/resources/reload-test-jms.xml | 2 +- .../resources/reload-test-updated-jms.xml | 2 +- .../jms/tests/MessageProducerTest.java | 4 +- .../artemis/jms/tests/SessionTest.java | 13 +- .../jms/tests/message/MessageHeaderTest.java | 30 ++- .../jms/conform/session/TopicSessionTest.java | 2 + .../impl/ActiveMQSecurityManagerImplTest.java | 28 +-- 190 files changed, 1178 insertions(+), 763 deletions(-) create mode 100644 artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java delete mode 100644 tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java index b4dbba8295..3619ed70db 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/AbstractAction.java @@ -16,7 +16,6 @@ */ package org.apache.activemq.artemis.cli.commands; -import io.airlift.airline.Option; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientRequestor; diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index 1ae82b3e64..ff2753a200 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -197,11 +197,11 @@ public class Create extends InputAbstract { @Option(name = "--no-web", description = "This will remove the web server definition from bootstrap.xml") boolean noWeb; - @Option(name = "--queues", description = "comma separated list of jms queues.") + @Option(name = "--queues", description = "comma separated list of queues.") String queues; - @Option(name = "--topics", description = "comma separated list of jms topics ") - String topics; + @Option(name = "--addresses", description = "comma separated list of addresses ") + String addresses; @Option(name = "--aio", description = "Force aio journal on the configuration regardless of the library being available or not.") boolean forceLibaio; @@ -632,7 +632,7 @@ public class Create extends InputAbstract { filters.put("${cluster-password}", ""); } - applyJMSObjects(filters); + applyAddressesAndQueues(filters); if (home != null) { filters.put("${home}", path(home, false)); @@ -784,12 +784,33 @@ public class Create extends InputAbstract { for (String str : getQueueList()) { printWriter.println(" "); } - for (String str : getTopicList()) { + for (String str : getAddressList()) { printWriter.println(" "); } filters.put("${jms-list.settings}", writer.toString()); } + /** + * It will create the address and queue configurations + */ + private void applyAddressesAndQueues(HashMap filters) { + StringWriter writer = new StringWriter(); + PrintWriter printWriter = new PrintWriter(writer); + printWriter.println(); + + for (String str : getQueueList()) { + printWriter.println("
"); + printWriter.println(" "); + printWriter.println(" "); + printWriter.println(" "); + printWriter.println("
"); + } + for (String str : getAddressList()) { + printWriter.println("
"); + } + filters.put("${address-queue.settings}", writer.toString()); + } + private void performAutoTune(HashMap filters, boolean aio, File dataFolder) { if (noAutoTune) { filters.put("${journal-buffer.settings}", ""); @@ -862,11 +883,11 @@ public class Create extends InputAbstract { } } - private String[] getTopicList() { - if (topics == null) { + private String[] getAddressList() { + if (addresses == null) { return new String[0]; } else { - return topics.split(","); + return addresses.split(","); } } diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java index 6c92dc64d0..86aafaf5cf 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java @@ -23,7 +23,6 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.management.ManagementHelper; import org.apache.activemq.artemis.cli.commands.AbstractAction; import org.apache.activemq.artemis.cli.commands.ActionContext; -import org.apache.activemq.artemis.core.server.impl.AddressInfo; @Command(name = "create", description = "create an address") public class CreateAddress extends AbstractAction { diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java index 34331bbeae..013b504586 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java @@ -46,8 +46,7 @@ public class ShowAddress extends AbstractAction { public void setUpInvocation(ClientMessage message) throws Exception { if (bindings) { ManagementHelper.putOperationInvocation(message, "broker", "listBindingsForAddress", getName()); - } - else { + } else { ManagementHelper.putOperationInvocation(message, "broker", "getAddressInfo", getName()); } } diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml index 0871ab6e54..6c7f91c198 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml @@ -74,6 +74,8 @@ ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st + + @@ -105,7 +107,7 @@ ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st -
+ ${address-queue.settings} 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 3c03ab2cd3..85d194aeb4 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 @@ -533,20 +533,20 @@ public class ArtemisTest { File instanceFolder = temporaryFolder.newFolder(folderName); setupAuth(instanceFolder); - String queues = "q1,t2"; - String topics = "t1,t2"; + String queues = "q1,q2"; + String addresses = "a1,a2"; // This is usually set when run from the command line via artemis.profile - Run.setEmbedded(false); - Artemis.main("create", instanceFolder.getAbsolutePath(), "--force", "--silent", "--no-web", "--queues", queues, "--topics", topics, "--no-autotune", "--require-login"); + Run.setEmbedded(true); + Artemis.main("create", instanceFolder.getAbsolutePath(), "--force", "--silent", "--no-web", "--queues", queues, "--addresses", addresses, "--no-autotune", "--require-login"); System.setProperty("artemis.instance", instanceFolder.getAbsolutePath()); // Some exceptions may happen on the initialization, but they should be ok on start the basic core protocol Artemis.internalExecute("run"); - Artemis.main("queue", "create", "--name", "q1", "--address", "q1", "--user", "admin", "--password", "admin"); - Artemis.main("queue", "create", "--name", "t2", "--address", "t2", "--user", "admin", "--password", "admin"); +// Artemis.main("queue", "create", "--name", "q1", "--address", "q1", "--user", "admin", "--password", "admin", "--autoCreateAddress"); +// Artemis.main("queue", "create", "--name", "t2", "--address", "t2", "--user", "admin", "--password", "admin", "--autoCreateAddress"); try { try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616"); @@ -556,9 +556,9 @@ public class ArtemisTest { ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString(str)); assertTrue("Couldn't find queue " + str, queryResult.isExists()); } - for (String str : topics.split(",")) { - ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString(str)); - assertTrue("Couldn't find topic " + str, queryResult.isExists()); + for (String str : addresses.split(",")) { + ClientSession.AddressQuery queryResult = coreSession.addressQuery(SimpleString.toSimpleString(str)); + assertTrue("Couldn't find address " + str, queryResult.isExists()); } } 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 e9212f20fc..6fb5580ef9 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 @@ -162,8 +162,8 @@ public final class ActiveMQDefaultConfiguration { // the name of the address that consumers bind to receive management notifications private static SimpleString DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS = new SimpleString("activemq.notifications"); - // The default address used for clustering - private static String DEFAULT_CLUSTER_ADDRESS = "jms"; + // The default address used for clustering, empty string means all addresses + private static String DEFAULT_CLUSTER_ADDRESS = ""; // Cluster username. It applies to all cluster configurations. private static String DEFAULT_CLUSTER_USER = "ACTIVEMQ.CLUSTER.ADMIN.USER"; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java index 35bc9f9de4..72b1a11215 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java @@ -293,6 +293,34 @@ public interface ClientSession extends XAResource, AutoCloseable { */ void createQueue(String address, String queueName, String filter, boolean durable) throws ActiveMQException; + /** + * Creates a non-temporary queue. + * + * @param address the queue will be bound to this address + * @param queueName the name of the queue + * @param filter only messages which match this filter will be put in the queue + * @param durable whether the queue is durable or not + * @param autoCreated whether to mark this queue as autoCreated or not + * @throws ActiveMQException in an exception occurs while creating the queue + */ + void createQueue(SimpleString address, + SimpleString queueName, + SimpleString filter, + boolean durable, + boolean autoCreated) throws ActiveMQException; + + /** + * Creates a non-temporaryqueue. + * + * @param address the queue will be bound to this address + * @param queueName the name of the queue + * @param filter only messages which match this filter will be put in the queue + * @param durable whether the queue is durable or not + * @param autoCreated whether to mark this queue as autoCreated or not + * @throws ActiveMQException in an exception occurs while creating the queue + */ + void createQueue(String address, String queueName, String filter, boolean durable, boolean autoCreated) throws ActiveMQException; + /** * Creates a temporary queue. * diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java index 0654dbf0fd..33584bf9b4 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java @@ -811,7 +811,8 @@ public interface ActiveMQServerControl { @Parameter(desc = "a comma-separated list of roles allowed to delete non durable queues", name = "deleteNonDurableQueueRoles") String deleteNonDurableQueueRoles, @Parameter(desc = "a comma-separated list of roles allowed to send management messages messages", name = "manage") String manageRoles, @Parameter(desc = "a comma-separated list of roles allowed to browse queues", name = "browse") String browseRoles, - @Parameter(desc = "a comma-separated list of roles allowed to create addresses", name = "createAddressRoles") String createAddressRoles) throws Exception; + @Parameter(desc = "a comma-separated list of roles allowed to create addresses", name = "createAddressRoles") String createAddressRoles, + @Parameter(desc = "a comma-separated list of roles allowed to delete addresses", name = "deleteAddressRoles") String deleteAddressRoles) throws Exception; @Operation(desc = "Remove security settings for an address", impact = MBeanOperationInfo.ACTION) void removeSecuritySettings(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception; @@ -848,6 +849,36 @@ public interface ActiveMQServerControl { @Parameter(desc = "allow auto-created queues to be deleted automatically", name = "autoDeleteJmsQueues") boolean autoDeleteJmsQueues, @Parameter(desc = "allow topics to be created automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics, @Parameter(desc = "allow auto-created topics to be deleted automatically", name = "autoDeleteJmsTopics") boolean autoDeleteJmsTopics) throws Exception; + /** + * adds a new address setting for a specific address + */ + @Operation(desc = "Add address settings for addresses matching the addressMatch", impact = MBeanOperationInfo.ACTION) + void addAddressSettings(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch, + @Parameter(desc = "the dead letter address setting", name = "DLA") String DLA, + @Parameter(desc = "the expiry address setting", name = "expiryAddress") String expiryAddress, + @Parameter(desc = "the expiry delay setting", name = "expiryDelay") long expiryDelay, + @Parameter(desc = "are any queues created for this address a last value queue", name = "lastValueQueue") boolean lastValueQueue, + @Parameter(desc = "the delivery attempts", name = "deliveryAttempts") int deliveryAttempts, + @Parameter(desc = "the max size in bytes", name = "maxSizeBytes") long maxSizeBytes, + @Parameter(desc = "the page size in bytes", name = "pageSizeBytes") int pageSizeBytes, + @Parameter(desc = "the max number of pages in the soft memory cache", name = "pageMaxCacheSize") int pageMaxCacheSize, + @Parameter(desc = "the redelivery delay", name = "redeliveryDelay") long redeliveryDelay, + @Parameter(desc = "the redelivery delay multiplier", name = "redeliveryMultiplier") double redeliveryMultiplier, + @Parameter(desc = "the maximum redelivery delay", name = "maxRedeliveryDelay") long maxRedeliveryDelay, + @Parameter(desc = "the redistribution delay", name = "redistributionDelay") long redistributionDelay, + @Parameter(desc = "do we send to the DLA when there is no where to route the message", name = "sendToDLAOnNoRoute") boolean sendToDLAOnNoRoute, + @Parameter(desc = "the policy to use when the address is full", name = "addressFullMessagePolicy") String addressFullMessagePolicy, + @Parameter(desc = "when a consumer falls below this threshold in terms of messages consumed per second it will be considered 'slow'", name = "slowConsumerThreshold") long slowConsumerThreshold, + @Parameter(desc = "how often (in seconds) to check for slow consumers", name = "slowConsumerCheckPeriod") long slowConsumerCheckPeriod, + @Parameter(desc = "the policy to use when a slow consumer is detected", name = "slowConsumerPolicy") String slowConsumerPolicy, + @Parameter(desc = "allow jms queues to be created automatically", name = "autoCreateJmsQueues") boolean autoCreateJmsQueues, + @Parameter(desc = "allow auto-created jms queues to be deleted automatically", name = "autoDeleteJmsQueues") boolean autoDeleteJmsQueues, + @Parameter(desc = "allow jms topics to be created automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics, + @Parameter(desc = "allow auto-created jms topics to be deleted automatically", name = "autoDeleteJmsTopics") boolean autoDeleteJmsTopics, + @Parameter(desc = "allow queues to be created automatically", name = "autoCreateQueues") boolean autoCreateQueues, + @Parameter(desc = "allow auto-created queues to be deleted automatically", name = "autoDeleteQueues") boolean autoDeleteQueues, + @Parameter(desc = "allow topics to be created automatically", name = "autoCreateAddresses") boolean autoCreateAddresses, + @Parameter(desc = "allow auto-created topics to be deleted automatically", name = "autoDeleteAddresses") boolean autoDeleteAddresses) throws Exception; void removeAddressSettings(String addressMatch) throws Exception; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java index 019996a28d..3bbd45658c 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java @@ -165,7 +165,7 @@ public final class ObjectNameBuilder { * Returns the ObjectName used by JMSQueueControl. */ public ObjectName getJMSQueueObjectName(final String name) throws Exception { - return createObjectName("Queue", name); + return getQueueObjectName(SimpleString.toSimpleString(name), SimpleString.toSimpleString(name)); } /** diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java index 16311b03ab..145ca995c4 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 @@ -237,14 +237,14 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void createQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException { - internalCreateQueue(address, queueName, null, false, false); + internalCreateQueue(address, queueName, null, false, false, false); } @Override public void createQueue(final SimpleString address, final SimpleString queueName, final boolean durable) throws ActiveMQException { - internalCreateQueue(address, queueName, null, durable, false); + internalCreateQueue(address, queueName, null, durable, false, false); } @Override @@ -295,7 +295,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi final SimpleString queueName, final SimpleString filterString, final boolean durable) throws ActiveMQException { - internalCreateQueue(address, queueName, filterString, durable, false); + internalCreateQueue(address, queueName, filterString, durable, false, false); } @Override @@ -306,28 +306,46 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), durable); } + @Override + public void createQueue(final SimpleString address, + final SimpleString queueName, + final SimpleString filterString, + final boolean durable, + final boolean autoCreated) throws ActiveMQException { + internalCreateQueue(address, queueName, filterString, durable, false, autoCreated); + } + + @Override + public void createQueue(final String address, + final String queueName, + final String filterString, + final boolean durable, + final boolean autoCreated) throws ActiveMQException { + createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), durable, autoCreated); + } + @Override public void createTemporaryQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException { - internalCreateQueue(address, queueName, null, false, true); + internalCreateQueue(address, queueName, null, false, true, false); } @Override public void createTemporaryQueue(final String address, final String queueName) throws ActiveMQException { - internalCreateQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), null, false, true); + internalCreateQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), null, false, true, false); } @Override public void createTemporaryQueue(final SimpleString address, final SimpleString queueName, final SimpleString filter) throws ActiveMQException { - internalCreateQueue(address, queueName, filter, false, true); + internalCreateQueue(address, queueName, filter, false, true, false); } @Override public void createTemporaryQueue(final String address, final String queueName, final String filter) throws ActiveMQException { - internalCreateQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter), false, true); + internalCreateQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter), false, true, false); } @Override @@ -1551,7 +1569,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi final SimpleString queueName, final SimpleString filterString, final boolean durable, - final boolean temp) throws ActiveMQException { + final boolean temp, + final boolean autoCreated) throws ActiveMQException { checkClosed(); if (durable && temp) { @@ -1560,7 +1579,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi startCall(); try { - sessionContext.createQueue(address, queueName, filterString, durable, temp); + sessionContext.createQueue(address, queueName, filterString, durable, temp, autoCreated); } finally { endCall(); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java index 919da1949f..cbbe2b7e31 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java @@ -52,6 +52,7 @@ import org.apache.activemq.artemis.core.protocol.core.Packet; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateAddressMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage; +import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage_V2; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSessionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.DisconnectConsumerMessage; @@ -594,8 +595,9 @@ public class ActiveMQSessionContext extends SessionContext { SimpleString queueName, SimpleString filterString, boolean durable, - boolean temp) throws ActiveMQException { - CreateQueueMessage request = new CreateQueueMessage(address, queueName, filterString, durable, temp, true); + boolean temp, + boolean autoCreated) throws ActiveMQException { + CreateQueueMessage request = new CreateQueueMessage_V2(address, queueName, filterString, durable, temp, autoCreated, true); sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java index 834822cb60..de1edbcf68 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java @@ -29,6 +29,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterTop import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterTopologyChangeMessage_V3; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateAddressMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage; +import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage_V2; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSessionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSessionResponseMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage; @@ -91,6 +92,7 @@ import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CRE import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATESESSION_RESP; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_ADDRESS; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_QUEUE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_QUEUE_V2; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_SHARED_QUEUE; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DELETE_QUEUE; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DISCONNECT; @@ -245,6 +247,10 @@ public abstract class PacketDecoder implements Serializable { packet = new CreateQueueMessage(); break; } + case CREATE_QUEUE_V2: { + packet = new CreateQueueMessage_V2(); + break; + } case CREATE_SHARED_QUEUE: { packet = new CreateSharedQueueMessage(); break; 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 e07d9b5cfc..abc1eefe95 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 @@ -251,6 +251,8 @@ public class PacketImpl implements Packet { public static final byte CREATE_ADDRESS = -11; + public static final byte CREATE_QUEUE_V2 = -12; + // Static -------------------------------------------------------- public PacketImpl(final byte type) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java index e837d55ba0..2ebf1474aa 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java @@ -22,17 +22,17 @@ import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; public class CreateQueueMessage extends PacketImpl { - private SimpleString address; + protected SimpleString address; - private SimpleString queueName; + protected SimpleString queueName; - private SimpleString filterString; + protected SimpleString filterString; - private boolean durable; + protected boolean durable; - private boolean temporary; + protected boolean temporary; - private boolean requiresResponse; + protected boolean requiresResponse; public CreateQueueMessage(final SimpleString address, final SimpleString queueName, @@ -55,16 +55,28 @@ public class CreateQueueMessage extends PacketImpl { } // Public -------------------------------------------------------- + /** + * @param createQueueMessageV2 + */ + public CreateQueueMessage(byte createQueueMessageV2) { + super(createQueueMessageV2); + } @Override public String toString() { StringBuffer buff = new StringBuffer(getParentString()); + buff.append("]"); + return buff.toString(); + } + + @Override + public String getParentString() { + StringBuffer buff = new StringBuffer(super.getParentString()); buff.append(", address=" + address); buff.append(", queueName=" + queueName); buff.append(", filterString=" + filterString); buff.append(", durable=" + durable); buff.append(", temporary=" + temporary); - buff.append("]"); return buff.toString(); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java new file mode 100644 index 0000000000..13a4a581cd --- /dev/null +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.protocol.core.impl.wireformat; + +import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.SimpleString; + +public class CreateQueueMessage_V2 extends CreateQueueMessage { + + private boolean autoCreated; + + public CreateQueueMessage_V2(final SimpleString address, + final SimpleString queueName, + final SimpleString filterString, + final boolean durable, + final boolean temporary, + final boolean autoCreated, + final boolean requiresResponse) { + this(); + + this.address = address; + this.queueName = queueName; + this.filterString = filterString; + this.durable = durable; + this.temporary = temporary; + this.autoCreated = autoCreated; + this.requiresResponse = requiresResponse; + } + + public CreateQueueMessage_V2() { + super(CREATE_QUEUE_V2); + } + + // Public -------------------------------------------------------- + + @Override + public String toString() { + StringBuffer buff = new StringBuffer(super.getParentString()); + buff.append(", autoCreated=" + autoCreated); + buff.append("]"); + return buff.toString(); + } + + public boolean isAutoCreated() { + return autoCreated; + } + + public void setAutoCreated(boolean autoCreated) { + this.autoCreated = autoCreated; + } + + @Override + public void encodeRest(final ActiveMQBuffer buffer) { + super.encodeRest(buffer); + buffer.writeBoolean(autoCreated); + } + + @Override + public void decodeRest(final ActiveMQBuffer buffer) { + super.decodeRest(buffer); + autoCreated = buffer.readBoolean(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (autoCreated ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof CreateQueueMessage_V2)) + return false; + CreateQueueMessage_V2 other = (CreateQueueMessage_V2) obj; + if (autoCreated != other.autoCreated) + return false; + return true; + } +} diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java index 2792d526db..a3b4c21b19 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java @@ -36,6 +36,8 @@ public class Role implements Serializable { private final boolean createAddress; + private final boolean deleteAddress; + private final boolean createDurableQueue; private final boolean deleteDurableQueue; @@ -49,7 +51,7 @@ public class Role implements Serializable { private final boolean browse; public JsonObject toJson() { - return JsonLoader.createObjectBuilder().add("name", name).add("send", send).add("consume", consume).add("createDurableQueue", createDurableQueue).add("deleteDurableQueue", deleteDurableQueue).add("createNonDurableQueue", createNonDurableQueue).add("deleteNonDurableQueue", deleteNonDurableQueue).add("manage", manage).add("browse", browse).add("createAddress", createAddress).build(); + return JsonLoader.createObjectBuilder().add("name", name).add("send", send).add("consume", consume).add("createDurableQueue", createDurableQueue).add("deleteDurableQueue", deleteDurableQueue).add("createNonDurableQueue", createNonDurableQueue).add("deleteNonDurableQueue", deleteNonDurableQueue).add("manage", manage).add("browse", browse).add("createAddress", createAddress).add("deleteAddress", deleteAddress).build(); } /** @@ -87,8 +89,8 @@ public class Role implements Serializable { final boolean manage, final boolean browse) { // This constructor exists for version compatibility on the API. If either createDurableQueue or createNonDurableQueue - // is true then createAddress will be true. - this(name, send, consume, createDurableQueue, deleteDurableQueue, createNonDurableQueue, deleteNonDurableQueue, manage, browse, createDurableQueue || createNonDurableQueue); + // is true then createAddress will be true. If either deleteDurableQueue or deleteNonDurableQueue is true then deleteAddress will be true. + this(name, send, consume, createDurableQueue, deleteDurableQueue, createNonDurableQueue, deleteNonDurableQueue, manage, browse, createDurableQueue || createNonDurableQueue, deleteDurableQueue || deleteNonDurableQueue); } public Role(final String name, @@ -100,7 +102,8 @@ public class Role implements Serializable { final boolean deleteNonDurableQueue, final boolean manage, final boolean browse, - final boolean createAddress) { + final boolean createAddress, + final boolean deleteAddress) { if (name == null) { throw new NullPointerException("name is null"); } @@ -108,6 +111,7 @@ public class Role implements Serializable { this.send = send; this.consume = consume; this.createAddress = createAddress; + this.deleteAddress = deleteAddress; this.createDurableQueue = createDurableQueue; this.deleteDurableQueue = deleteDurableQueue; this.createNonDurableQueue = createNonDurableQueue; @@ -132,6 +136,10 @@ public class Role implements Serializable { return createAddress; } + public boolean isDeleteAddress() { + return deleteAddress; + } + public boolean isCreateDurableQueue() { return createDurableQueue; } @@ -161,6 +169,9 @@ public class Role implements Serializable { if (createAddress) { stringReturn.append(" createAddress "); } + if (deleteAddress) { + stringReturn.append(" deleteAddress "); + } if (createDurableQueue) { stringReturn.append(" createDurableQueue "); } @@ -202,6 +213,9 @@ public class Role implements Serializable { if (createAddress != role.createAddress) { return false; } + if (deleteAddress != role.deleteAddress) { + return false; + } if (createDurableQueue != role.createDurableQueue) { return false; } @@ -237,6 +251,7 @@ public class Role implements Serializable { result = 31 * result + (send ? 1 : 0); result = 31 * result + (consume ? 1 : 0); result = 31 * result + (createAddress ? 1 : 0); + result = 31 * result + (deleteAddress ? 1 : 0); result = 31 * result + (createDurableQueue ? 1 : 0); result = 31 * result + (deleteDurableQueue ? 1 : 0); result = 31 * result + (createNonDurableQueue ? 1 : 0); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java index 16e8314652..01f0b08274 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java @@ -172,7 +172,8 @@ public abstract class SessionContext { SimpleString queueName, SimpleString filterString, boolean durable, - boolean temp) throws ActiveMQException; + boolean temp, + boolean autoCreated) throws ActiveMQException; public abstract ClientSession.QueueQuery queueQuery(SimpleString queueName) throws ActiveMQException; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java index 7e9ff32255..08c414d0ed 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java @@ -33,7 +33,8 @@ public class SecurityFormatter { String deleteNonDurableQueueRoles, String manageRoles, String browseRoles, - String createAddressRoles) { + String createAddressRoles, + String deleteAddressRoles) { List createDurableQueue = toList(createDurableQueueRoles); List deleteDurableQueue = toList(deleteDurableQueueRoles); List createNonDurableQueue = toList(createNonDurableQueueRoles); @@ -43,6 +44,7 @@ public class SecurityFormatter { List manage = toList(manageRoles); List browse = toList(browseRoles); List createAddress = toList(createAddressRoles); + List deleteAddress = toList(deleteAddressRoles); Set allRoles = new HashSet<>(); allRoles.addAll(createDurableQueue); @@ -54,10 +56,11 @@ public class SecurityFormatter { allRoles.addAll(manage); allRoles.addAll(browse); allRoles.addAll(createAddress); + allRoles.addAll(deleteAddress); Set roles = new HashSet<>(allRoles.size()); for (String role : allRoles) { - roles.add(new Role(role, send.contains(role), consume.contains(role), createDurableQueue.contains(role), deleteDurableQueue.contains(role), createNonDurableQueue.contains(role), deleteNonDurableQueue.contains(role), manageRoles.contains(role), browse.contains(role), createAddressRoles.contains(role))); + roles.add(new Role(role, send.contains(role), consume.contains(role), createDurableQueue.contains(role), deleteDurableQueue.contains(role), createNonDurableQueue.contains(role), deleteNonDurableQueue.contains(role), manageRoles.contains(role), browse.contains(role), createAddressRoles.contains(role), deleteAddressRoles.contains(role))); } return roles; } diff --git a/artemis-distribution/src/test/scripts/validate-instalation.sh b/artemis-distribution/src/test/scripts/validate-instalation.sh index 85773a41d1..5837739112 100755 --- a/artemis-distribution/src/test/scripts/validate-instalation.sh +++ b/artemis-distribution/src/test/scripts/validate-instalation.sh @@ -49,7 +49,7 @@ pwd sleep 5 ./artemis producer -./artemis consumer +./artemis consumer --receive-timeout 10000 --break-on-null ./artemis stop @@ -64,7 +64,7 @@ sleep 5 sleep 5 ./artemis producer -./artemis consumer +./artemis consumer --receive-timeout 10000 --break-on-null ./artemis-service stop diff --git a/artemis-features/src/main/resources/artemis.xml b/artemis-features/src/main/resources/artemis.xml index fc1cdccdfd..7a51dc2d41 100644 --- a/artemis-features/src/main/resources/artemis.xml +++ b/artemis-features/src/main/resources/artemis.xml @@ -80,6 +80,8 @@ under the License. + + @@ -97,7 +99,7 @@ under the License. -1 10 PAGE - true + true 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 5cbd40fd97..3d3fa66d0c 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 @@ -410,7 +410,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To // TODO is it right to use the address for the queue name here? clientSession.createTemporaryQueue(address, address); } else { - clientSession.createQueue(address, address, null, true); + clientSession.createQueue(address, address, null, true, true); } } else if (!destination.isQueue() && query.isAutoCreateJmsTopics()) { clientSession.createAddress(address, true, true); 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 f514dbaf39..7fc0fb21ba 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 @@ -301,10 +301,9 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (!response.isExists()) { if (jbd.isQueue() && response.isAutoCreateJmsQueues()) { - // TODO create queue here in such a way that it is deleted when consumerCount == 0 // perhaps just relying on the broker to do it is simplest (i.e. deleteOnNoConsumers) session.createAddress(jbd.getSimpleAddress(), false, true); - session.createQueue(jbd.getSimpleAddress(), jbd.getSimpleAddress(), null, true); + session.createQueue(jbd.getSimpleAddress(), jbd.getSimpleAddress(), null, true, true); } else if (!jbd.isQueue() && response.isAutoCreateJmsTopics()) { session.createAddress(jbd.getSimpleAddress(), true, true); } else { @@ -647,9 +646,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { */ if (!response.isExists() || !response.getQueueNames().contains(dest.getSimpleAddress())) { if (response.isAutoCreateJmsQueues()) { - // TODO create queue here in such a way that it is deleted when consumerCount == 0 - // perhaps just relying on the broker to do it is simplest (i.e. deleteOnNoConsumers) - session.createQueue(dest.getSimpleAddress(), dest.getSimpleAddress(), true); + session.createQueue(dest.getSimpleAddress(), dest.getSimpleAddress(), null, true, true); } else { throw new InvalidDestinationException("Destination " + dest.getName() + " does not exist"); } @@ -797,7 +794,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { AddressQuery response = session.addressQuery(new SimpleString(activeMQDestination.getAddress())); if (!response.isExists()) { if (response.isAutoCreateJmsQueues()) { - session.createQueue(activeMQDestination.getSimpleAddress(), activeMQDestination.getSimpleAddress(), true); + session.createQueue(activeMQDestination.getSimpleAddress(), activeMQDestination.getSimpleAddress(), null, true, true); } else { throw new InvalidDestinationException("Destination " + activeMQDestination.getName() + " does not exist"); } 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 25ad349655..74fde632ac 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 @@ -1637,9 +1637,9 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback // long consumerCount = queue.getConsumerCount(); // long messageCount = queue.getMessageCount(); // -// if (address.toString().startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX) && settings.getAutoDeleteJmsQueues() && queue.getMessageCount() == 0) { +// if (address.toString().startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX) && settings.isAutoDeleteJmsQueues() && queue.getMessageCount() == 0) { // if (ActiveMQJMSServerLogger.LOGGER.isDebugEnabled()) { -// ActiveMQJMSServerLogger.LOGGER.debug("deleting auto-created queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; getAutoDeleteJmsQueues = " + settings.getAutoDeleteJmsQueues()); +// ActiveMQJMSServerLogger.LOGGER.debug("deleting auto-created queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " + settings.isAutoDeleteJmsQueues()); // } // // return destroyQueue(queueName.toString().substring(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX.length()), false); 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 e823d0ef8d..1acf48aafe 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 @@ -722,7 +722,6 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se server.getSecurityStore().check(qName, checkType, this); server.checkQueueCreationLimit(getUsername()); server.createQueue(qName, qName, null, connInfo == null ? null : SimpleString.toSimpleString(connInfo.getUserName()), true, false); - } } } 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 35fd73347b..b2a2068274 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 @@ -168,7 +168,7 @@ public class AMQSession implements SessionCallback { BindingQueryResult bindingQuery = server.bindingQuery(queueName); QueueQueryResult queueBinding = server.queueQuery(queueName); - boolean isAutoCreate = bindingQuery.isExists() ? bindingQuery.isAutoCreateJmsQueues() : true; + boolean isAutoCreate = bindingQuery.isExists() ? true : bindingQuery.isAutoCreateJmsQueues(); if (!queueBinding.isExists()) { if (isAutoCreate) { 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 4cb8fe903a..3b0991df4b 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 @@ -39,8 +39,10 @@ import org.apache.activemq.artemis.core.remoting.FailureListener; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.ServerMessage; +import org.apache.activemq.artemis.core.server.ServerSession; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl; +import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.apache.activemq.artemis.spi.core.remoting.Connection; @@ -251,6 +253,7 @@ public final class StompConnection implements RemotingConnection { return res; } + // TODO this should take a type - send or receive so it knows whether to check the address or the queue public void checkDestination(String destination) throws ActiveMQStompException { if (!manager.destinationExists(destination)) { throw BUNDLE.destinationNotExist(destination).setHandler(frameHandler); @@ -259,17 +262,24 @@ public final class StompConnection implements RemotingConnection { public boolean autoCreateDestinationIfPossible(String queue, AddressInfo.RoutingType routingType) throws ActiveMQStompException { boolean result = false; + ServerSession session = getSession().getSession(); try { if (manager.getServer().getAddressInfo(SimpleString.toSimpleString(queue)) == null) { - // TODO check here to see if auto-creation is enabled - if (routingType.equals(AddressInfo.RoutingType.MULTICAST)) { - manager.getServer().createOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString(queue)).setAutoCreated(true)); + AddressSettings addressSettings = manager.getServer().getAddressSettingsRepository().getMatch(queue); + if (routingType != null && routingType.equals(AddressInfo.RoutingType.MULTICAST) && addressSettings.isAutoCreateAddresses()) { + session.createAddress(SimpleString.toSimpleString(queue), true, true); + result = true; } else { - manager.getServer().createOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString(queue)).setRoutingType(AddressInfo.RoutingType.ANYCAST).setAutoCreated(true)); - manager.getServer().createQueue(SimpleString.toSimpleString(queue), SimpleString.toSimpleString(queue), null, null, true, false, true); + if (addressSettings.isAutoCreateAddresses()) { + session.createAddress(SimpleString.toSimpleString(queue), false, true); + result = true; + } + if (addressSettings.isAutoCreateQueues()) { + session.createQueue(SimpleString.toSimpleString(queue), SimpleString.toSimpleString(queue), null, false, true, null, null, true); + result = true; + } } - result = true; } } catch (ActiveMQQueueExistsException e) { // ignore @@ -555,6 +565,10 @@ public final class StompConnection implements RemotingConnection { return manager.createServerMessage(); } + public StompSession getSession() throws ActiveMQStompException { + return getSession(null); + } + public StompSession getSession(String txID) throws ActiveMQStompException { StompSession session = null; try { 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 349c1fd961..ea42a407b7 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 @@ -125,6 +125,10 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { private static final String BROWSE_NAME = "browse"; + private static final String CREATEADDRESS_NAME = "createAddress"; + + private static final String DELETEADDRESS_NAME = "deleteAddress"; + // Address parsing private static final String DEAD_LETTER_ADDRESS_NODE_NAME = "dead-letter-address"; @@ -171,6 +175,14 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { private static final String AUTO_DELETE_JMS_TOPICS = "auto-delete-jms-topics"; + private static final String AUTO_CREATE_QUEUES = "auto-create-queues"; + + private static final String AUTO_DELETE_QUEUES = "auto-delete-queues"; + + private static final String AUTO_CREATE_ADDRESSES = "auto-create-addresses"; + + private static final String AUTO_DELETE_ADDRESSES = "auto-delete-addresses"; + private static final String MANAGEMENT_BROWSE_PAGE_SIZE = "management-browse-page-size"; private static final String MAX_CONNECTIONS_NODE_NAME = "max-connections"; @@ -696,6 +708,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { ArrayList deleteNonDurableQueue = new ArrayList<>(); ArrayList manageRoles = new ArrayList<>(); ArrayList browseRoles = new ArrayList<>(); + ArrayList createAddressRoles = new ArrayList<>(); + ArrayList deleteAddressRoles = new ArrayList<>(); ArrayList allRoles = new ArrayList<>(); NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { @@ -726,6 +740,10 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { manageRoles.add(role.trim()); } else if (BROWSE_NAME.equals(type)) { browseRoles.add(role.trim()); + } else if (CREATEADDRESS_NAME.equals(type)) { + createAddressRoles.add(role.trim()); + } else if (DELETEADDRESS_NAME.equals(type)) { + deleteAddressRoles.add(role.trim()); } else { ActiveMQServerLogger.LOGGER.rolePermissionConfigurationError(type); } @@ -842,6 +860,14 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { addressSettings.setAutoCreateJmsTopics(XMLUtil.parseBoolean(child)); } else if (AUTO_DELETE_JMS_TOPICS.equalsIgnoreCase(name)) { addressSettings.setAutoDeleteJmsTopics(XMLUtil.parseBoolean(child)); + } else if (AUTO_CREATE_QUEUES.equalsIgnoreCase(name)) { + addressSettings.setAutoCreateQueues(XMLUtil.parseBoolean(child)); + } else if (AUTO_DELETE_QUEUES.equalsIgnoreCase(name)) { + addressSettings.setAutoDeleteQueues(XMLUtil.parseBoolean(child)); + } else if (AUTO_CREATE_ADDRESSES.equalsIgnoreCase(name)) { + addressSettings.setAutoCreateAddresses(XMLUtil.parseBoolean(child)); + } else if (AUTO_DELETE_ADDRESSES.equalsIgnoreCase(name)) { + addressSettings.setAutoDeleteAddresses(XMLUtil.parseBoolean(child)); } else if (MANAGEMENT_BROWSE_PAGE_SIZE.equalsIgnoreCase(name)) { addressSettings.setManagementBrowsePageSize(XMLUtil.parseInt(child)); } 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 c38b2cf2d7..f524062d3b 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 @@ -67,7 +67,6 @@ import org.apache.activemq.artemis.core.postoffice.Binding; import org.apache.activemq.artemis.core.postoffice.Bindings; import org.apache.activemq.artemis.core.postoffice.DuplicateIDCache; import org.apache.activemq.artemis.core.postoffice.PostOffice; -import org.apache.activemq.artemis.core.postoffice.QueueBinding; import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.artemis.core.remoting.server.RemotingService; import org.apache.activemq.artemis.core.security.CheckType; @@ -75,7 +74,6 @@ import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; -import org.apache.activemq.artemis.core.server.BindingQueryResult; import org.apache.activemq.artemis.core.server.ConnectorServiceFactory; import org.apache.activemq.artemis.core.server.Consumer; import org.apache.activemq.artemis.core.server.JournalType; @@ -789,12 +787,18 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active @Override public String getAddressInfo(String address) throws ActiveMQAddressDoesNotExistException { - AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(address)); - if (addressInfo == null) { - throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(address)); - } - else { - return addressInfo.toString(); + checkStarted(); + + clearIO(); + try { + AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(address)); + if (addressInfo == null) { + throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(address)); + } else { + return addressInfo.toString(); + } + } finally { + blockOnIO(); } } @@ -1600,7 +1604,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active final String deleteNonDurableQueueRoles, final String manageRoles, final String browseRoles) throws Exception { - addSecuritySettings(addressMatch, sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createNonDurableQueueRoles, deleteNonDurableQueueRoles, manageRoles, browseRoles, ""); + addSecuritySettings(addressMatch, sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createNonDurableQueueRoles, deleteNonDurableQueueRoles, manageRoles, browseRoles, "", ""); } @Override @@ -1613,16 +1617,17 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active final String deleteNonDurableQueueRoles, final String manageRoles, final String browseRoles, - final String createAddressRoles) throws Exception { + final String createAddressRoles, + final String deleteAddressRoles) throws Exception { checkStarted(); clearIO(); try { - Set roles = SecurityFormatter.createSecurity(sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createNonDurableQueueRoles, deleteNonDurableQueueRoles, manageRoles, browseRoles, createAddressRoles); + Set roles = SecurityFormatter.createSecurity(sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createNonDurableQueueRoles, deleteNonDurableQueueRoles, manageRoles, browseRoles, createAddressRoles, deleteAddressRoles); server.getSecurityRepository().addMatch(addressMatch, roles); - PersistedRoles persistedRoles = new PersistedRoles(addressMatch, sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createNonDurableQueueRoles, deleteNonDurableQueueRoles, manageRoles, browseRoles, createAddressRoles); + PersistedRoles persistedRoles = new PersistedRoles(addressMatch, sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createNonDurableQueueRoles, deleteNonDurableQueueRoles, manageRoles, browseRoles, createAddressRoles, deleteAddressRoles); storageManager.storeSecurityRoles(persistedRoles); } finally { @@ -1697,7 +1702,31 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active if (addressSettings.getExpiryAddress() != null) { settings.add("expiryAddress", addressSettings.getExpiryAddress().toString()); } - return settings.add("expiryDelay", addressSettings.getExpiryDelay()).add("maxDeliveryAttempts", addressSettings.getMaxDeliveryAttempts()).add("pageCacheMaxSize", addressSettings.getPageCacheMaxSize()).add("maxSizeBytes", addressSettings.getMaxSizeBytes()).add("pageSizeBytes", addressSettings.getPageSizeBytes()).add("redeliveryDelay", addressSettings.getRedeliveryDelay()).add("redeliveryMultiplier", addressSettings.getRedeliveryMultiplier()).add("maxRedeliveryDelay", addressSettings.getMaxRedeliveryDelay()).add("redistributionDelay", addressSettings.getRedistributionDelay()).add("lastValueQueue", addressSettings.isLastValueQueue()).add("sendToDLAOnNoRoute", addressSettings.isSendToDLAOnNoRoute()).add("addressFullMessagePolicy", policy).add("slowConsumerThreshold", addressSettings.getSlowConsumerThreshold()).add("slowConsumerCheckPeriod", addressSettings.getSlowConsumerCheckPeriod()).add("slowConsumerPolicy", consumerPolicy).add("autoCreateJmsQueues", addressSettings.isAutoCreateJmsQueues()).add("autoCreateJmsTopics", addressSettings.isAutoCreateJmsTopics()).add("autoDeleteJmsQueues", addressSettings.getAutoDeleteJmsQueues()).add("autoDeleteJmsTopics", addressSettings.getAutoDeleteJmsQueues()).build().toString(); + return settings.add("expiryDelay", addressSettings.getExpiryDelay()) + .add("maxDeliveryAttempts", addressSettings.getMaxDeliveryAttempts()) + .add("pageCacheMaxSize", addressSettings.getPageCacheMaxSize()) + .add("maxSizeBytes", addressSettings.getMaxSizeBytes()) + .add("pageSizeBytes", addressSettings.getPageSizeBytes()) + .add("redeliveryDelay", addressSettings.getRedeliveryDelay()) + .add("redeliveryMultiplier", addressSettings.getRedeliveryMultiplier()) + .add("maxRedeliveryDelay", addressSettings.getMaxRedeliveryDelay()) + .add("redistributionDelay", addressSettings.getRedistributionDelay()) + .add("lastValueQueue", addressSettings.isLastValueQueue()) + .add("sendToDLAOnNoRoute", addressSettings.isSendToDLAOnNoRoute()) + .add("addressFullMessagePolicy", policy) + .add("slowConsumerThreshold", addressSettings.getSlowConsumerThreshold()) + .add("slowConsumerCheckPeriod", addressSettings.getSlowConsumerCheckPeriod()) + .add("slowConsumerPolicy", consumerPolicy) + .add("autoCreateJmsQueues", addressSettings.isAutoCreateJmsQueues()) + .add("autoCreateJmsTopics", addressSettings.isAutoCreateJmsTopics()) + .add("autoDeleteJmsQueues", addressSettings.isAutoDeleteJmsQueues()) + .add("autoDeleteJmsTopics", addressSettings.isAutoDeleteJmsQueues()) + .add("autoCreateQueues", addressSettings.isAutoCreateQueues()) + .add("autoDeleteQueues", addressSettings.isAutoDeleteQueues()) + .add("autoCreateAddress", addressSettings.isAutoCreateAddresses()) + .add("autoDeleteAddress", addressSettings.isAutoDeleteAddresses()) + .build() + .toString(); } @Override @@ -1723,6 +1752,36 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active final boolean autoDeleteJmsQueues, final boolean autoCreateJmsTopics, final boolean autoDeleteJmsTopics) throws Exception { + addAddressSettings(address, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, maxSizeBytes, pageSizeBytes, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics, AddressSettings.DEFAULT_AUTO_CREATE_QUEUES, AddressSettings.DEFAULT_AUTO_DELETE_QUEUES, AddressSettings.DEFAULT_AUTO_CREATE_ADDRESSES, AddressSettings.DEFAULT_AUTO_DELETE_ADDRESSES); + } + + @Override + public void addAddressSettings(final String address, + final String DLA, + final String expiryAddress, + final long expiryDelay, + final boolean lastValueQueue, + final int deliveryAttempts, + final long maxSizeBytes, + final int pageSizeBytes, + final int pageMaxCacheSize, + final long redeliveryDelay, + final double redeliveryMultiplier, + final long maxRedeliveryDelay, + final long redistributionDelay, + final boolean sendToDLAOnNoRoute, + final String addressFullMessagePolicy, + final long slowConsumerThreshold, + final long slowConsumerCheckPeriod, + final String slowConsumerPolicy, + final boolean autoCreateJmsQueues, + final boolean autoDeleteJmsQueues, + final boolean autoCreateJmsTopics, + final boolean autoDeleteJmsTopics, + final boolean autoCreateQueues, + final boolean autoDeleteQueues, + final boolean autoCreateAddresses, + final boolean autoDeleteAddresses) throws Exception { checkStarted(); // JBPAPP-6334 requested this to be pageSizeBytes > maxSizeBytes @@ -1770,6 +1829,12 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active } addressSettings.setAutoCreateJmsQueues(autoCreateJmsQueues); addressSettings.setAutoDeleteJmsQueues(autoDeleteJmsQueues); + addressSettings.setAutoCreateJmsTopics(autoCreateJmsTopics); + addressSettings.setAutoDeleteJmsTopics(autoDeleteJmsTopics); + addressSettings.setAutoCreateQueues(autoCreateQueues); + addressSettings.setAutoDeleteQueues(autoDeleteQueues); + addressSettings.setAutoCreateAddresses(autoCreateAddresses); + addressSettings.setAutoDeleteAddresses(autoDeleteAddresses); server.getAddressSettingsRepository().addMatch(address, addressSettings); storageManager.storeAddressSetting(new PersistedAddressSetting(new SimpleString(address), addressSettings)); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedRoles.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedRoles.java index ffa0dbb9a8..86fdc14d17 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedRoles.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedRoles.java @@ -48,6 +48,8 @@ public class PersistedRoles implements EncodingSupport { private SimpleString createAddressRoles; + private SimpleString deleteAddressRoles; + // Static -------------------------------------------------------- // Constructors -------------------------------------------------- @@ -65,6 +67,8 @@ public class PersistedRoles implements EncodingSupport { * @param deleteNonDurableQueueRoles * @param manageRoles * @param browseRoles + * @param createAddressRoles + * @param deleteAddressRoles */ public PersistedRoles(final String addressMatch, final String sendRoles, @@ -75,7 +79,8 @@ public class PersistedRoles implements EncodingSupport { final String deleteNonDurableQueueRoles, final String manageRoles, final String browseRoles, - final String createAddressRoles) { + final String createAddressRoles, + final String deleteAddressRoles) { super(); this.addressMatch = SimpleString.toSimpleString(addressMatch); this.sendRoles = SimpleString.toSimpleString(sendRoles); @@ -87,6 +92,7 @@ public class PersistedRoles implements EncodingSupport { this.manageRoles = SimpleString.toSimpleString(manageRoles); this.browseRoles = SimpleString.toSimpleString(browseRoles); this.createAddressRoles = SimpleString.toSimpleString(createAddressRoles); + this.deleteAddressRoles = SimpleString.toSimpleString(deleteAddressRoles); } // Public -------------------------------------------------------- @@ -169,6 +175,13 @@ public class PersistedRoles implements EncodingSupport { return createAddressRoles.toString(); } + /** + * @return the deleteAddressRoles + */ + public String getDeleteAddressRoles() { + return deleteAddressRoles.toString(); + } + @Override public void encode(final ActiveMQBuffer buffer) { buffer.writeSimpleString(addressMatch); @@ -181,6 +194,7 @@ public class PersistedRoles implements EncodingSupport { buffer.writeNullableSimpleString(manageRoles); buffer.writeNullableSimpleString(browseRoles); buffer.writeNullableSimpleString(createAddressRoles); + buffer.writeNullableSimpleString(deleteAddressRoles); } @Override @@ -193,8 +207,8 @@ public class PersistedRoles implements EncodingSupport { SimpleString.sizeofNullableString(deleteNonDurableQueueRoles) + SimpleString.sizeofNullableString(manageRoles) + SimpleString.sizeofNullableString(browseRoles) + - SimpleString.sizeofNullableString(createAddressRoles); - + SimpleString.sizeofNullableString(createAddressRoles) + + SimpleString.sizeofNullableString(deleteAddressRoles); } @Override @@ -209,6 +223,7 @@ public class PersistedRoles implements EncodingSupport { manageRoles = buffer.readNullableSimpleString(); browseRoles = buffer.readNullableSimpleString(); createAddressRoles = buffer.readNullableSimpleString(); + deleteAddressRoles = buffer.readNullableSimpleString(); } /* (non-Javadoc) @@ -227,6 +242,7 @@ public class PersistedRoles implements EncodingSupport { result = prime * result + ((manageRoles == null) ? 0 : manageRoles.hashCode()); result = prime * result + ((browseRoles == null) ? 0 : browseRoles.hashCode()); result = prime * result + ((createAddressRoles == null) ? 0 : createAddressRoles.hashCode()); + result = prime * result + ((deleteAddressRoles == null) ? 0 : deleteAddressRoles.hashCode()); result = prime * result + ((sendRoles == null) ? 0 : sendRoles.hashCode()); result = prime * result + (int) (storeId ^ (storeId >>> 32)); return result; @@ -289,6 +305,11 @@ public class PersistedRoles implements EncodingSupport { return false; } else if (!createAddressRoles.equals(other.createAddressRoles)) return false; + if (deleteAddressRoles == null) { + if (other.deleteAddressRoles != null) + return false; + } else if (!deleteAddressRoles.equals(other.deleteAddressRoles)) + return false; if (sendRoles == null) { if (other.sendRoles != null) return false; @@ -325,6 +346,8 @@ public class PersistedRoles implements EncodingSupport { browseRoles + ", createAddressRoles=" + createAddressRoles + + ", deleteAddressRoles=" + + deleteAddressRoles + "]"; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java index 12eac9f4d1..b10986484f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java @@ -1278,6 +1278,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager { try { long recordID = idGenerator.generateID(); bindingEncoding.setId(recordID); + addressInfo.setId(recordID); bindingsJournal.appendAddRecordTransactional(tx, recordID, JournalRecordIds.ADDRESS_BINDING_RECORD, bindingEncoding); } finally { readUnLock(); 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 30643639a6..dc73680d8d 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 @@ -132,7 +132,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding private final ActiveMQServer server; - private Object addressLock = new Object(); + private final Object addressLock = new Object(); public PostOfficeImpl(final ActiveMQServer server, final StorageManager storageManager, @@ -450,7 +450,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding synchronized (addressLock) { Bindings bindingsForAddress = getBindingsForAddress(address); if (bindingsForAddress.getBindings().size() > 0) { - throw new IllegalStateException("Address has bindings"); + throw ActiveMQMessageBundle.BUNDLE.addressHasBindings(address); } managementService.unregisterAddress(address); return addressManager.removeAddressInfo(address); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java index be71a927f3..184462b0f6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java @@ -32,6 +32,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateAddressMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage; +import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateQueueMessage_V2; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.NullResponseMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.RollbackMessage; @@ -85,6 +86,7 @@ import org.jboss.logging.Logger; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_ADDRESS; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_QUEUE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_QUEUE_V2; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CREATE_SHARED_QUEUE; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DELETE_QUEUE; import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_ACKNOWLEDGE; @@ -225,7 +227,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { case CREATE_ADDRESS: { CreateAddressMessage request = (CreateAddressMessage) packet; requiresResponse = request.isRequiresResponse(); - session.createAddress(request.getAddress(), request.isMulticast()); + session.createAddress(request.getAddress(), request.isMulticast(), request.isAutoCreated()); if (requiresResponse) { response = new NullResponseMessage(); } @@ -240,6 +242,15 @@ public class ServerSessionPacketHandler implements ChannelHandler { } break; } + case CREATE_QUEUE_V2: { + CreateQueueMessage_V2 request = (CreateQueueMessage_V2) packet; + requiresResponse = request.isRequiresResponse(); + session.createQueue(request.getAddress(), request.getQueueName(), request.getFilterString(), request.isTemporary(), request.isDurable(), null, null, request.isAutoCreated()); + if (requiresResponse) { + response = new NullResponseMessage(); + } + break; + } case CREATE_SHARED_QUEUE: { CreateSharedQueueMessage request = (CreateSharedQueueMessage) packet; requiresResponse = request.isRequiresResponse(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java index 833f8ce2bb..143b12e78c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java @@ -22,7 +22,6 @@ import java.util.Set; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import com.google.common.collect.Queues; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.config.Configuration; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java index 28d283d79e..23426ca388 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java @@ -108,7 +108,7 @@ public interface ServerSession extends SecurityAuth { boolean temporary, boolean durable) throws Exception; - AddressInfo createAddress(final SimpleString address, final boolean multicast) throws Exception; + AddressInfo createAddress(final SimpleString address, final boolean multicast, final boolean autoCreated) throws Exception; void deleteQueue(SimpleString name) throws Exception; 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 ea72beaaa1..9253e748f5 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 @@ -682,15 +682,14 @@ public class ActiveMQServerImpl implements ActiveMQServer { return postOffice.isAddressBound(SimpleString.toSimpleString(address)); } - // TODO: this should probably look at the addresses too, not just queue bindings @Override public BindingQueryResult bindingQuery(SimpleString address) throws Exception { if (address == null) { throw ActiveMQMessageBundle.BUNDLE.addressIsNull(); } - boolean autoCreateJmsQueues = getAddressSettingsRepository().getMatch(address.toString()).isAutoCreateJmsQueues(); - boolean autoCreateJmsTopics = getAddressSettingsRepository().getMatch(address.toString()).isAutoCreateJmsTopics(); + boolean autoCreateJmsQueues = getAddressSettingsRepository().getMatch(address.toString()).isAutoCreateQueues(); + boolean autoCreateJmsTopics = getAddressSettingsRepository().getMatch(address.toString()).isAutoCreateAddresses(); List names = new ArrayList<>(); @@ -710,7 +709,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { } } - return new BindingQueryResult(!names.isEmpty(), names, autoCreateJmsQueues, autoCreateJmsTopics); + return new BindingQueryResult(getAddressInfo(address) != null, names, autoCreateJmsQueues, autoCreateJmsTopics); } @Override @@ -719,7 +718,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { throw ActiveMQMessageBundle.BUNDLE.queueNameIsNull(); } - boolean autoCreateJmsQueues = getAddressSettingsRepository().getMatch(name.toString()).isAutoCreateJmsQueues(); + boolean autoCreateJmsQueues = getAddressSettingsRepository().getMatch(name.toString()).isAutoCreateQueues(); QueueQueryResult response; @@ -1626,7 +1625,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { public void destroyQueue(final SimpleString queueName, final SecurityAuth session, final boolean checkConsumerCount) throws Exception { - destroyQueue(queueName, session, checkConsumerCount, false, true); + destroyQueue(queueName, session, checkConsumerCount, false); } @Override @@ -1678,7 +1677,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { if (autoDeleteAddress && postOffice != null) { try { - postOffice.removeAddressInfo(address); + removeAddressInfo(address); } catch (ActiveMQDeleteAddressException e) { // Could be thrown if the address has bindings or is not deletable. } @@ -2319,7 +2318,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { List roles = storageManager.recoverPersistedRoles(); for (PersistedRoles roleItem : roles) { - Set setRoles = SecurityFormatter.createSecurity(roleItem.getSendRoles(), roleItem.getConsumeRoles(), roleItem.getCreateDurableQueueRoles(), roleItem.getDeleteDurableQueueRoles(), roleItem.getCreateNonDurableQueueRoles(), roleItem.getDeleteNonDurableQueueRoles(), roleItem.getManageRoles(), roleItem.getBrowseRoles(), roleItem.getCreateAddressRoles()); + Set setRoles = SecurityFormatter.createSecurity(roleItem.getSendRoles(), roleItem.getConsumeRoles(), roleItem.getCreateDurableQueueRoles(), roleItem.getDeleteDurableQueueRoles(), roleItem.getCreateNonDurableQueueRoles(), roleItem.getDeleteNonDurableQueueRoles(), roleItem.getManageRoles(), roleItem.getBrowseRoles(), roleItem.getCreateAddressRoles(), roleItem.getDeleteAddressRoles()); securityRepository.addMatch(roleItem.getAddressMatch().toString(), setRoles); } @@ -2358,15 +2357,15 @@ public class ActiveMQServerImpl implements ActiveMQServer { @Override public void removeAddressInfo(SimpleString address) throws Exception { + AddressInfo addressInfo = getAddressInfo(address); if (postOffice.removeAddressInfo(address) == null) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(address); - }; - - // TODO: is this the right way to do this? - // long txID = storageManager.generateID(); - // storageManager.deleteAddressBinding(txID, getAddressInfo(address).getID()); - // storageManager.commitBindings(txID); + } + // TODO: is this the right way to do this? Should it use a transaction? + long txID = storageManager.generateID(); + storageManager.deleteAddressBinding(txID, addressInfo.getId()); + storageManager.commitBindings(txID); } @Override 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 a92e8d332b..9653a4e4f6 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 @@ -21,6 +21,8 @@ import org.apache.activemq.artemis.api.core.SimpleString; public class AddressInfo { + private long id; + private final SimpleString name; private RoutingType routingType = RoutingType.MULTICAST; @@ -84,10 +86,19 @@ public class AddressInfo { return name; } + public void setId(long id) { + this.id = id; + } + + public long getId() { + return id; + } + @Override public String toString() { StringBuffer buff = new StringBuffer(); buff.append("Address [name=" + name); + buff.append(", id=" + id); buff.append(", routingType=" + routingType); buff.append(", defaultMaxQueueConsumers=" + defaultMaxQueueConsumers); buff.append(", defaultDeleteOnNoConsumers=" + defaultDeleteOnNoConsumers); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java index a211a9650b..0a1d09c99e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AutoCreatedQueueManagerImpl.java @@ -39,17 +39,15 @@ public class AutoCreatedQueueManagerImpl implements AutoCreatedQueueManager { long consumerCount = queue.getConsumerCount(); long messageCount = queue.getMessageCount(); - // TODO make sure this is the right check - if ((queue.isAutoCreated() || queue.isDeleteOnNoConsumers()) && queue.getMessageCount() == 0) { + if (((queue.isAutoCreated() && settings.isAutoDeleteQueues()) || queue.isDeleteOnNoConsumers()) && queue.getMessageCount() == 0) { if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("deleting auto-created queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; getAutoDeleteJmsQueues = " + settings.getAutoDeleteJmsQueues()); + ActiveMQServerLogger.LOGGER.debug("deleting " + (queue.isAutoCreated() ? "auto-created " : "") + "queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteQueues = " + settings.isAutoDeleteQueues()); } - // TODO handle this exception better try { server.destroyQueue(queueName, null, true, false); } catch (Exception e) { - e.printStackTrace(); + ActiveMQServerLogger.LOGGER.errorRemovingAutoCreatedQueue(e, queueName); } } } 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 f6da245ed7..a2be58b47f 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 @@ -367,7 +367,7 @@ public class QueueImpl implements Queue { this.address = address; - this.addressInfo = postOffice.getAddressInfo(address); + this.addressInfo = postOffice == null ? null : postOffice.getAddressInfo(address); this.name = name; 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 88ab0c014c..70177f4a66 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 @@ -510,7 +510,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { server.checkQueueCreationLimit(getUsername()); - Queue queue = server.createQueue(address, name, filterString, SimpleString.toSimpleString(getUsername()), durable, temporary, maxConsumers, deleteOnNoConsumers, true); + Queue queue = server.createQueue(address, name, filterString, SimpleString.toSimpleString(getUsername()), durable, temporary, autoCreated, maxConsumers, deleteOnNoConsumers, true); if (temporary) { // Temporary queue in core simply means the queue will be deleted if @@ -541,12 +541,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } @Override - public AddressInfo createAddress(final SimpleString address, final boolean multicast) throws Exception { - // make sure the user has privileges to create this queue + public AddressInfo createAddress(final SimpleString address, final boolean multicast, final boolean autoCreated) throws Exception { securityCheck(address, CheckType.CREATE_ADDRESS, this); AddressInfo.RoutingType routingType = multicast ? AddressInfo.RoutingType.MULTICAST : AddressInfo.RoutingType.ANYCAST; - AddressInfo addressInfo = server.createOrUpdateAddressInfo(new AddressInfo(address).setRoutingType(routingType)); + AddressInfo addressInfo = server.createOrUpdateAddressInfo(new AddressInfo(address).setRoutingType(routingType).setAutoCreated(autoCreated)); return addressInfo; } 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 68d96568a3..a63ee9b056 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 @@ -52,14 +52,26 @@ public class AddressSettings implements Mergeable, Serializable public static final boolean DEFAULT_LAST_VALUE_QUEUE = false; + @Deprecated public static final boolean DEFAULT_AUTO_CREATE_JMS_QUEUES = true; + @Deprecated public static final boolean DEFAULT_AUTO_DELETE_JMS_QUEUES = true; + @Deprecated public static final boolean DEFAULT_AUTO_CREATE_TOPICS = true; + @Deprecated public static final boolean DEFAULT_AUTO_DELETE_TOPICS = true; + public static final boolean DEFAULT_AUTO_CREATE_QUEUES = true; + + public static final boolean DEFAULT_AUTO_DELETE_QUEUES = true; + + public static final boolean DEFAULT_AUTO_CREATE_ADDRESSES = true; + + public static final boolean DEFAULT_AUTO_DELETE_ADDRESSES = true; + public static final long DEFAULT_REDISTRIBUTION_DELAY = -1; public static final long DEFAULT_EXPIRY_DELAY = -1; @@ -125,6 +137,14 @@ public class AddressSettings implements Mergeable, Serializable private Boolean autoDeleteJmsTopics = null; + private Boolean autoCreateQueues = null; + + private Boolean autoDeleteQueues = null; + + private Boolean autoCreateAddresses = null; + + private Boolean autoDeleteAddresses = null; + private Integer managementBrowsePageSize = AddressSettings.MANAGEMENT_BROWSE_PAGE_SIZE; private Long maxSizeBytesRejectThreshold = null; @@ -157,6 +177,10 @@ public class AddressSettings implements Mergeable, Serializable this.autoDeleteJmsQueues = other.autoDeleteJmsQueues; this.autoCreateJmsTopics = other.autoCreateJmsTopics; this.autoDeleteJmsTopics = other.autoDeleteJmsTopics; + this.autoCreateQueues = other.autoCreateQueues; + this.autoDeleteQueues = other.autoDeleteQueues; + this.autoCreateAddresses = other.autoCreateAddresses; + this.autoDeleteAddresses = other.autoDeleteAddresses; this.managementBrowsePageSize = other.managementBrowsePageSize; this.queuePrefetch = other.queuePrefetch; this.maxSizeBytesRejectThreshold = other.maxSizeBytesRejectThreshold; @@ -165,42 +189,86 @@ public class AddressSettings implements Mergeable, Serializable public AddressSettings() { } + @Deprecated public boolean isAutoCreateJmsQueues() { return autoCreateJmsQueues != null ? autoCreateJmsQueues : AddressSettings.DEFAULT_AUTO_CREATE_JMS_QUEUES; } + @Deprecated public AddressSettings setAutoCreateJmsQueues(final boolean autoCreateJmsQueues) { this.autoCreateJmsQueues = autoCreateJmsQueues; return this; } - public boolean getAutoDeleteJmsQueues() { + @Deprecated + public boolean isAutoDeleteJmsQueues() { return autoDeleteJmsQueues != null ? autoDeleteJmsQueues : AddressSettings.DEFAULT_AUTO_DELETE_JMS_QUEUES; } + @Deprecated public AddressSettings setAutoDeleteJmsQueues(final boolean autoDeleteJmsQueues) { this.autoDeleteJmsQueues = autoDeleteJmsQueues; return this; } + @Deprecated public boolean isAutoCreateJmsTopics() { return autoCreateJmsTopics != null ? autoCreateJmsTopics : AddressSettings.DEFAULT_AUTO_CREATE_TOPICS; } + @Deprecated public AddressSettings setAutoCreateJmsTopics(final boolean autoCreateJmsTopics) { this.autoCreateJmsTopics = autoCreateJmsTopics; return this; } + @Deprecated public boolean isAutoDeleteJmsTopics() { return autoDeleteJmsTopics != null ? autoDeleteJmsTopics : AddressSettings.DEFAULT_AUTO_DELETE_TOPICS; } + @Deprecated public AddressSettings setAutoDeleteJmsTopics(final boolean autoDeleteJmsTopics) { this.autoDeleteJmsTopics = autoDeleteJmsTopics; return this; } + public boolean isAutoCreateQueues() { + return autoCreateQueues != null ? autoCreateQueues : AddressSettings.DEFAULT_AUTO_CREATE_QUEUES; + } + + public AddressSettings setAutoCreateQueues(Boolean autoCreateQueues) { + this.autoCreateQueues = autoCreateQueues; + return this; + } + + public boolean isAutoDeleteQueues() { + return autoDeleteQueues != null ? autoDeleteQueues : AddressSettings.DEFAULT_AUTO_DELETE_QUEUES; + } + + public AddressSettings setAutoDeleteQueues(Boolean autoDeleteQueues) { + this.autoDeleteQueues = autoDeleteQueues; + return this; + } + + public boolean isAutoCreateAddresses() { + return autoCreateAddresses != null ? autoCreateAddresses : AddressSettings.DEFAULT_AUTO_CREATE_ADDRESSES; + } + + public AddressSettings setAutoCreateAddresses(Boolean autoCreateAddresses) { + this.autoCreateAddresses = autoCreateAddresses; + return this; + } + + public boolean isAutoDeleteAddresses() { + return autoDeleteAddresses != null ? autoDeleteAddresses : AddressSettings.DEFAULT_AUTO_DELETE_ADDRESSES; + } + + public AddressSettings setAutoDeleteAddresses(Boolean autoDeleteAddresses) { + this.autoDeleteAddresses = autoDeleteAddresses; + return this; + } + public boolean isLastValueQueue() { return lastValueQueue != null ? lastValueQueue : AddressSettings.DEFAULT_LAST_VALUE_QUEUE; } @@ -459,12 +527,24 @@ public class AddressSettings implements Mergeable, Serializable if (autoDeleteJmsQueues == null) { autoDeleteJmsQueues = merged.autoDeleteJmsQueues; } -// if (autoCreateJmsTopics == null) { -// autoCreateJmsTopics = merged.autoCreateJmsTopics; -// } + if (autoCreateJmsTopics == null) { + autoCreateJmsTopics = merged.autoCreateJmsTopics; + } if (autoDeleteJmsTopics == null) { autoDeleteJmsTopics = merged.autoDeleteJmsTopics; } + if (autoCreateQueues == null) { + autoCreateQueues = merged.autoCreateQueues; + } + if (autoDeleteQueues == null) { + autoDeleteQueues = merged.autoDeleteQueues; + } + if (autoCreateAddresses == null) { + autoCreateAddresses = merged.autoCreateAddresses; + } + if (autoDeleteAddresses == null) { + autoDeleteAddresses = merged.autoDeleteAddresses; + } if (managementBrowsePageSize == null) { managementBrowsePageSize = merged.managementBrowsePageSize; } @@ -532,10 +612,18 @@ public class AddressSettings implements Mergeable, Serializable autoDeleteJmsQueues = BufferHelper.readNullableBoolean(buffer); -// autoCreateJmsTopics = BufferHelper.readNullableBoolean(buffer); + autoCreateJmsTopics = BufferHelper.readNullableBoolean(buffer); autoDeleteJmsTopics = BufferHelper.readNullableBoolean(buffer); + autoCreateQueues = BufferHelper.readNullableBoolean(buffer); + + autoDeleteQueues = BufferHelper.readNullableBoolean(buffer); + + autoCreateAddresses = BufferHelper.readNullableBoolean(buffer); + + autoDeleteAddresses = BufferHelper.readNullableBoolean(buffer); + managementBrowsePageSize = BufferHelper.readNullableInteger(buffer); maxSizeBytesRejectThreshold = BufferHelper.readNullableLong(buffer); @@ -565,8 +653,12 @@ public class AddressSettings implements Mergeable, Serializable BufferHelper.sizeOfNullableSimpleString(slowConsumerPolicy != null ? slowConsumerPolicy.toString() : null) + BufferHelper.sizeOfNullableBoolean(autoCreateJmsQueues) + BufferHelper.sizeOfNullableBoolean(autoDeleteJmsQueues) + -// BufferHelper.sizeOfNullableBoolean(autoCreateJmsTopics) + + BufferHelper.sizeOfNullableBoolean(autoCreateJmsTopics) + BufferHelper.sizeOfNullableBoolean(autoDeleteJmsTopics) + + BufferHelper.sizeOfNullableBoolean(autoCreateQueues) + + BufferHelper.sizeOfNullableBoolean(autoDeleteQueues) + + BufferHelper.sizeOfNullableBoolean(autoCreateAddresses) + + BufferHelper.sizeOfNullableBoolean(autoDeleteAddresses) + BufferHelper.sizeOfNullableInteger(managementBrowsePageSize) + BufferHelper.sizeOfNullableLong(maxSizeBytesRejectThreshold); } @@ -615,10 +707,18 @@ public class AddressSettings implements Mergeable, Serializable BufferHelper.writeNullableBoolean(buffer, autoDeleteJmsQueues); -// BufferHelper.writeNullableBoolean(buffer, autoCreateJmsTopics); + BufferHelper.writeNullableBoolean(buffer, autoCreateJmsTopics); BufferHelper.writeNullableBoolean(buffer, autoDeleteJmsTopics); + BufferHelper.writeNullableBoolean(buffer, autoCreateQueues); + + BufferHelper.writeNullableBoolean(buffer, autoDeleteQueues); + + BufferHelper.writeNullableBoolean(buffer, autoCreateAddresses); + + BufferHelper.writeNullableBoolean(buffer, autoDeleteAddresses); + BufferHelper.writeNullableInteger(buffer, managementBrowsePageSize); BufferHelper.writeNullableLong(buffer, maxSizeBytesRejectThreshold); @@ -652,8 +752,12 @@ public class AddressSettings implements Mergeable, Serializable result = prime * result + ((slowConsumerPolicy == null) ? 0 : slowConsumerPolicy.hashCode()); result = prime * result + ((autoCreateJmsQueues == null) ? 0 : autoCreateJmsQueues.hashCode()); result = prime * result + ((autoDeleteJmsQueues == null) ? 0 : autoDeleteJmsQueues.hashCode()); -// result = prime * result + ((autoCreateJmsTopics == null) ? 0 : autoCreateJmsTopics.hashCode()); + result = prime * result + ((autoCreateJmsTopics == null) ? 0 : autoCreateJmsTopics.hashCode()); result = prime * result + ((autoDeleteJmsTopics == null) ? 0 : autoDeleteJmsTopics.hashCode()); + result = prime * result + ((autoCreateQueues == null) ? 0 : autoCreateQueues.hashCode()); + result = prime * result + ((autoDeleteQueues == null) ? 0 : autoDeleteQueues.hashCode()); + result = prime * result + ((autoCreateAddresses == null) ? 0 : autoCreateAddresses.hashCode()); + result = prime * result + ((autoDeleteAddresses == null) ? 0 : autoDeleteAddresses.hashCode()); result = prime * result + ((managementBrowsePageSize == null) ? 0 : managementBrowsePageSize.hashCode()); result = prime * result + ((queuePrefetch == null) ? 0 : queuePrefetch.hashCode()); result = prime * result + ((maxSizeBytesRejectThreshold == null) ? 0 : queuePrefetch.hashCode()); @@ -777,18 +881,36 @@ public class AddressSettings implements Mergeable, Serializable return false; } else if (!autoDeleteJmsQueues.equals(other.autoDeleteJmsQueues)) return false; - -// if (autoCreateJmsTopics == null) { -// if (other.autoCreateJmsTopics != null) -// return false; -// } else if (!autoCreateJmsTopics.equals(other.autoCreateJmsTopics)) -// return false; + if (autoCreateJmsTopics == null) { + if (other.autoCreateJmsTopics != null) + return false; + } else if (!autoCreateJmsTopics.equals(other.autoCreateJmsTopics)) + return false; if (autoDeleteJmsTopics == null) { if (other.autoDeleteJmsTopics != null) return false; } else if (!autoDeleteJmsTopics.equals(other.autoDeleteJmsTopics)) return false; - + if (autoCreateQueues == null) { + if (other.autoCreateQueues != null) + return false; + } else if (!autoCreateQueues.equals(other.autoCreateQueues)) + return false; + if (autoDeleteQueues == null) { + if (other.autoDeleteQueues != null) + return false; + } else if (!autoDeleteQueues.equals(other.autoDeleteQueues)) + return false; + if (autoCreateAddresses == null) { + if (other.autoCreateAddresses != null) + return false; + } else if (!autoCreateAddresses.equals(other.autoCreateAddresses)) + return false; + if (autoDeleteAddresses == null) { + if (other.autoDeleteAddresses != null) + return false; + } else if (!autoDeleteAddresses.equals(other.autoDeleteAddresses)) + return false; if (managementBrowsePageSize == null) { if (other.managementBrowsePageSize != null) return false; @@ -854,11 +976,20 @@ public class AddressSettings implements Mergeable, Serializable slowConsumerPolicy + ", autoCreateJmsQueues=" + autoCreateJmsQueues + - ", autoDeleteJmsQueues=" + autoDeleteJmsQueues + + ", autoDeleteJmsQueues=" + + autoDeleteJmsQueues + ", autoCreateJmsTopics=" + -// autoCreateJmsTopics + -// ", autoDeleteJmsTopics=" + + autoCreateJmsTopics + + ", autoDeleteJmsTopics=" + autoDeleteJmsTopics + + ", autoCreateQueues=" + + autoCreateQueues + + ", autoDeleteQueues=" + + autoDeleteQueues + + ", autoCreateAddresses=" + + autoCreateAddresses + + ", autoDeleteAddresses=" + + autoDeleteAddresses + ", managementBrowsePageSize=" + managementBrowsePageSize + "]"; diff --git a/artemis-server/src/main/resources/schema/artemis-configuration.xsd b/artemis-server/src/main/resources/schema/artemis-configuration.xsd index 3e166fd0ad..5e5f0b9469 100644 --- a/artemis-server/src/main/resources/schema/artemis-configuration.xsd +++ b/artemis-server/src/main/resources/schema/artemis-configuration.xsd @@ -2407,7 +2407,7 @@ - whether or not to automatically create JMS queues when a producer sends or a consumer connects to a + DEPRECATED: whether or not to automatically create JMS queues when a producer sends or a consumer connects to a queue @@ -2416,7 +2416,7 @@ - whether or not to delete auto-created JMS queues when the queue has 0 consumers and 0 messages + DEPRECATED: whether or not to delete auto-created JMS queues when the queue has 0 consumers and 0 messages @@ -2424,7 +2424,7 @@ - whether or not to automatically create JMS topics when a producer sends or a consumer subscribes to + DEPRECATED: whether or not to automatically create JMS topics when a producer sends or a consumer subscribes to a topic @@ -2433,7 +2433,42 @@ - whether or not to delete auto-created JMS topics when the last subscription is closed + DEPRECATED: whether or not to delete auto-created JMS topics when the last subscription is closed + + + + + + + + whether or not to automatically create a queue when a client sends a message to or attempts to consume + a message from a queue + + + + + + + + whether or not to delete auto-created queues when the queue has 0 consumers and 0 messages + + + + + + + + whether or not to automatically create addresses when a client sends a message to or attempts to + consume a message from a queue mapped to an address that doesn't exist + a queue + + + + + + + + whether or not to delete auto-created addresses when it no longer has any queues 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 3e9865d409..a1adb4c617 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 @@ -301,7 +301,7 @@ public class FileConfigurationTest extends ConfigurationImplTest { assertEquals(5, conf.getAddressesSettings().get("a1").getSlowConsumerCheckPeriod()); assertEquals(SlowConsumerPolicy.NOTIFY, conf.getAddressesSettings().get("a1").getSlowConsumerPolicy()); assertEquals(true, conf.getAddressesSettings().get("a1").isAutoCreateJmsQueues()); - assertEquals(true, conf.getAddressesSettings().get("a1").getAutoDeleteJmsQueues()); + assertEquals(true, conf.getAddressesSettings().get("a1").isAutoDeleteJmsQueues()); assertEquals(true, conf.getAddressesSettings().get("a1").isAutoCreateJmsTopics()); assertEquals(true, conf.getAddressesSettings().get("a1").isAutoDeleteJmsTopics()); @@ -316,7 +316,7 @@ public class FileConfigurationTest extends ConfigurationImplTest { assertEquals(15, conf.getAddressesSettings().get("a2").getSlowConsumerCheckPeriod()); assertEquals(SlowConsumerPolicy.KILL, conf.getAddressesSettings().get("a2").getSlowConsumerPolicy()); assertEquals(false, conf.getAddressesSettings().get("a2").isAutoCreateJmsQueues()); - assertEquals(false, conf.getAddressesSettings().get("a2").getAutoDeleteJmsQueues()); + assertEquals(false, conf.getAddressesSettings().get("a2").isAutoDeleteJmsQueues()); assertEquals(false, conf.getAddressesSettings().get("a2").isAutoCreateJmsTopics()); assertEquals(false, conf.getAddressesSettings().get("a2").isAutoDeleteJmsTopics()); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/RoleTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/RoleTest.java index 5274db6e45..a2b3d44018 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/RoleTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/RoleTest.java @@ -42,7 +42,7 @@ public class RoleTest extends Assert { @Test public void testWriteRole() throws Exception { - Role role = new Role("testWriteRole", true, false, false, false, false, false, false, false, false); + Role role = new Role("testWriteRole", true, false, false, false, false, false, false, false, false, false); Assert.assertTrue(SEND.hasRole(role)); Assert.assertFalse(CONSUME.hasRole(role)); Assert.assertFalse(CREATE_DURABLE_QUEUE.hasRole(role)); @@ -56,7 +56,7 @@ public class RoleTest extends Assert { @Test public void testReadRole() throws Exception { - Role role = new Role("testReadRole", false, true, false, false, false, false, false, true, false); + Role role = new Role("testReadRole", false, true, false, false, false, false, false, true, false, false); Assert.assertFalse(SEND.hasRole(role)); Assert.assertTrue(CONSUME.hasRole(role)); Assert.assertFalse(CREATE_DURABLE_QUEUE.hasRole(role)); @@ -70,7 +70,7 @@ public class RoleTest extends Assert { @Test public void testCreateRole() throws Exception { - Role role = new Role("testCreateRole", false, false, true, false, false, false, false, false, false); + Role role = new Role("testCreateRole", false, false, true, false, false, false, false, false, false, false); Assert.assertFalse(SEND.hasRole(role)); Assert.assertFalse(CONSUME.hasRole(role)); Assert.assertTrue(CREATE_DURABLE_QUEUE.hasRole(role)); @@ -84,7 +84,7 @@ public class RoleTest extends Assert { @Test public void testManageRole() throws Exception { - Role role = new Role("testManageRole", false, false, false, false, false, false, true, false, false); + Role role = new Role("testManageRole", false, false, false, false, false, false, true, false, false, false); Assert.assertFalse(SEND.hasRole(role)); Assert.assertFalse(CONSUME.hasRole(role)); Assert.assertFalse(CREATE_DURABLE_QUEUE.hasRole(role)); @@ -98,12 +98,12 @@ public class RoleTest extends Assert { @Test public void testEqualsAndHashcode() throws Exception { - Role role = new Role("testEquals", true, true, true, false, false, false, false, false, false); - Role sameRole = new Role("testEquals", true, true, true, false, false, false, false, false, false); - Role roleWithDifferentName = new Role("notEquals", true, true, true, false, false, false, false, false, false); - Role roleWithDifferentRead = new Role("testEquals", false, true, true, false, false, false, false, false, false); - Role roleWithDifferentWrite = new Role("testEquals", true, false, true, false, false, false, false, false, false); - Role roleWithDifferentCreate = new Role("testEquals", true, true, false, false, false, false, false, false, false); + Role role = new Role("testEquals", true, true, true, false, false, false, false, false, false, false); + Role sameRole = new Role("testEquals", true, true, true, false, false, false, false, false, false, false); + Role roleWithDifferentName = new Role("notEquals", true, true, true, false, false, false, false, false, false, false); + Role roleWithDifferentRead = new Role("testEquals", false, true, true, false, false, false, false, false, false, false); + Role roleWithDifferentWrite = new Role("testEquals", true, false, true, false, false, false, false, false, false, false); + Role roleWithDifferentCreate = new Role("testEquals", true, true, false, false, false, false, false, false, false, false); Assert.assertTrue(role.equals(role)); 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 3861782464..6a6ec55ffc 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 @@ -40,9 +40,13 @@ public class AddressSettingsTest extends ActiveMQTestBase { Assert.assertEquals(AddressSettings.DEFAULT_SLOW_CONSUMER_CHECK_PERIOD, addressSettings.getSlowConsumerCheckPeriod()); Assert.assertEquals(AddressSettings.DEFAULT_SLOW_CONSUMER_POLICY, addressSettings.getSlowConsumerPolicy()); Assert.assertEquals(AddressSettings.DEFAULT_AUTO_CREATE_JMS_QUEUES, addressSettings.isAutoCreateJmsQueues()); - Assert.assertEquals(AddressSettings.DEFAULT_AUTO_DELETE_JMS_QUEUES, addressSettings.getAutoDeleteJmsQueues()); -// Assert.assertEquals(AddressSettings.DEFAULT_AUTO_CREATE_TOPICS, addressSettings.isAutoCreateJmsTopics()); -// Assert.assertEquals(AddressSettings.DEFAULT_AUTO_DELETE_TOPICS, addressSettings.isAutoDeleteJmsTopics()); + Assert.assertEquals(AddressSettings.DEFAULT_AUTO_DELETE_JMS_QUEUES, addressSettings.isAutoDeleteJmsQueues()); + Assert.assertEquals(AddressSettings.DEFAULT_AUTO_CREATE_TOPICS, addressSettings.isAutoCreateJmsTopics()); + Assert.assertEquals(AddressSettings.DEFAULT_AUTO_DELETE_TOPICS, addressSettings.isAutoDeleteJmsTopics()); + Assert.assertEquals(AddressSettings.DEFAULT_AUTO_CREATE_QUEUES, addressSettings.isAutoCreateQueues()); + Assert.assertEquals(AddressSettings.DEFAULT_AUTO_DELETE_QUEUES, addressSettings.isAutoDeleteQueues()); + Assert.assertEquals(AddressSettings.DEFAULT_AUTO_CREATE_ADDRESSES, addressSettings.isAutoCreateAddresses()); + Assert.assertEquals(AddressSettings.DEFAULT_AUTO_DELETE_ADDRESSES, addressSettings.isAutoDeleteAddresses()); } @Test diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java index b8678ae8a6..ed272c428e 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java @@ -72,13 +72,13 @@ public class RepositoryTest extends ActiveMQTestBase { public void testSingletwo() { securityRepository.addMatch("queues.another.aq.*", new HashSet()); HashSet roles = new HashSet<>(2); - roles.add(new Role("test1", true, true, true, true, true, true, true, true, true)); - roles.add(new Role("test2", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("test1", true, true, true, true, true, true, true, true, true, true)); + roles.add(new Role("test2", true, true, true, true, true, true, true, true, true, true)); securityRepository.addMatch("queues.aq", roles); HashSet roles2 = new HashSet<>(2); - roles2.add(new Role("test1", true, true, true, true, true, true, true, true, true)); - roles2.add(new Role("test2", true, true, true, true, true, true, true, true, true)); - roles2.add(new Role("test3", true, true, true, true, true, true, true, true, true)); + roles2.add(new Role("test1", true, true, true, true, true, true, true, true, true, true)); + roles2.add(new Role("test2", true, true, true, true, true, true, true, true, true, true)); + roles2.add(new Role("test3", true, true, true, true, true, true, true, true, true, true)); securityRepository.addMatch("queues.another.andanother", roles2); HashSet hashSet = securityRepository.getMatch("queues.another.andanother"); @@ -89,8 +89,8 @@ public class RepositoryTest extends ActiveMQTestBase { public void testWithoutWildcard() { securityRepository.addMatch("queues.1.*", new HashSet()); HashSet roles = new HashSet<>(2); - roles.add(new Role("test1", true, true, true, true, true, true, true, true, true)); - roles.add(new Role("test2", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("test1", true, true, true, true, true, true, true, true, true, true)); + roles.add(new Role("test2", true, true, true, true, true, true, true, true, true, true)); securityRepository.addMatch("queues.2.aq", roles); HashSet hashSet = securityRepository.getMatch("queues.2.aq"); Assert.assertEquals(hashSet.size(), 2); diff --git a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml index 70e344e6a3..81829f565f 100644 --- a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml +++ b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml @@ -268,6 +268,10 @@ true true true + true + true + true + true a2.1 @@ -284,6 +288,10 @@ false false false + false + false + false + false diff --git a/artemis-tools/pom.xml b/artemis-tools/pom.xml index 9ce22fd583..b28f3e51fe 100644 --- a/artemis-tools/pom.xml +++ b/artemis-tools/pom.xml @@ -19,7 +19,7 @@ org.apache.activemq artemis-pom - 1.5.0-SNAPSHOT + 2.0.0-SNAPSHOT ActiveMQ Artemis Tools diff --git a/docs/user-manual/en/queue-attributes.md b/docs/user-manual/en/queue-attributes.md index 22184aa989..7a8fe78ef5 100644 --- a/docs/user-manual/en/queue-attributes.md +++ b/docs/user-manual/en/queue-attributes.md @@ -88,6 +88,10 @@ entry that would be found in the `broker.xml` file. -1 NOTIFY 5 + true - + diff --git a/examples/features/clustered/clustered-durable-subscription/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-durable-subscription/src/main/resources/activemq/server1/broker.xml index 8134f2727f..3efae9ef0c 100644 --- a/examples/features/clustered/clustered-durable-subscription/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/clustered-durable-subscription/src/main/resources/activemq/server1/broker.xml @@ -67,7 +67,6 @@ under the License. -
jms
netty-connector 500 true @@ -81,7 +80,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-grouping/readme.html b/examples/features/clustered/clustered-grouping/readme.html index 7bce8f236b..e066ca948a 100644 --- a/examples/features/clustered/clustered-grouping/readme.html +++ b/examples/features/clustered/clustered-grouping/readme.html @@ -37,7 +37,6 @@ under the License. <cluster-connections> <cluster-connection name="my-cluster"> - <address>jms</address> <connector-ref>netty-connector</connector-ref> <retry-interval>500</retry-interval> <use-duplicate-detection>true</use-duplicate-detection> @@ -60,7 +59,6 @@ under the License. <cluster-connections> <cluster-connection name="my-cluster"> - <address>jms</address> <retry-interval>500</retry-interval> <use-duplicate-detection>true</use-duplicate-detection> <message-load-balancing>STRICT</message-load-balancing> diff --git a/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server0/broker.xml index 45200591ed..07e2c81a98 100644 --- a/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server0/broker.xml @@ -69,7 +69,6 @@ under the License. -
jms
netty-connector 500 true @@ -81,7 +80,7 @@ under the License. LOCAL -
jms
+
exampleQueue
5000 -1 30000 @@ -91,7 +90,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server1/broker.xml index 4765f7a2ea..0d681c8118 100644 --- a/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server1/broker.xml @@ -68,7 +68,6 @@ under the License. -
jms
netty-connector 500 true @@ -80,7 +79,7 @@ under the License. REMOTE -
jms
+
exampleQueue
5000
@@ -88,7 +87,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server2/broker.xml b/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server2/broker.xml index 16bf2eb7bd..c3a637f706 100644 --- a/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server2/broker.xml +++ b/examples/features/clustered/clustered-grouping/src/main/resources/activemq/server2/broker.xml @@ -68,7 +68,6 @@ under the License. -
jms
netty-connector 500 true @@ -80,7 +79,7 @@ under the License. REMOTE -
jms
+
exampleQueue
5000
@@ -88,7 +87,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-jgroups/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/clustered-jgroups/src/main/resources/activemq/server0/broker.xml index 17809e541d..763f6aa37e 100644 --- a/examples/features/clustered/clustered-jgroups/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/clustered/clustered-jgroups/src/main/resources/activemq/server0/broker.xml @@ -69,7 +69,6 @@ under the License. -
jms
netty-connector 500 true @@ -83,7 +82,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-jgroups/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-jgroups/src/main/resources/activemq/server1/broker.xml index 267eae78cd..da3ffa39ab 100644 --- a/examples/features/clustered/clustered-jgroups/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/clustered-jgroups/src/main/resources/activemq/server1/broker.xml @@ -68,7 +68,6 @@ under the License. -
jms
netty-connector 500 true @@ -82,7 +81,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-queue/readme.html b/examples/features/clustered/clustered-queue/readme.html index b5fce8181d..a39fc4c6b4 100644 --- a/examples/features/clustered/clustered-queue/readme.html +++ b/examples/features/clustered/clustered-queue/readme.html @@ -40,7 +40,6 @@ under the License. and to load balance the messages between the nodes.

      <cluster-connection name="my-cluster">
-        <address>jms</address>
         <connector-ref>netty-connector</connector-ref>
         <retry-interval>500</retry-interval>
         <use-duplicate-detection>true</use-duplicate-detection>
diff --git a/examples/features/clustered/clustered-queue/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/clustered-queue/src/main/resources/activemq/server0/broker.xml
index eb30a9096d..e0ee6e6039 100644
--- a/examples/features/clustered/clustered-queue/src/main/resources/activemq/server0/broker.xml
+++ b/examples/features/clustered/clustered-queue/src/main/resources/activemq/server0/broker.xml
@@ -67,7 +67,6 @@ under the License.
 
       
          
-            
jms
netty-connector 500 true @@ -81,7 +80,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-queue/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-queue/src/main/resources/activemq/server1/broker.xml index 531fed154c..84a80149c5 100644 --- a/examples/features/clustered/clustered-queue/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/clustered-queue/src/main/resources/activemq/server1/broker.xml @@ -68,7 +68,6 @@ under the License. -
jms
netty-connector 500 true @@ -82,7 +81,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-static-discovery-uri/readme.html b/examples/features/clustered/clustered-static-discovery-uri/readme.html index 88931b9eba..0dc1205b56 100644 --- a/examples/features/clustered/clustered-static-discovery-uri/readme.html +++ b/examples/features/clustered/clustered-static-discovery-uri/readme.html @@ -40,7 +40,6 @@ under the License. and to load balance the messages between the nodes.

      <cluster-connection name="my-cluster">
-        <address>jms</address>
         <connector-ref>netty-connector</connector-ref>
         <retry-interval>500</retry-interval>
         <use-duplicate-detection>true</use-duplicate-detection>
diff --git a/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server0/broker.xml
index be093ab55a..90ae4a1338 100644
--- a/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server0/broker.xml
+++ b/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server0/broker.xml
@@ -56,7 +56,7 @@ under the License.
 
       
          
-         
+         
             
             
             
diff --git a/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server1/broker.xml
index fc3bb2da1b..5245e12c0d 100644
--- a/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server1/broker.xml
+++ b/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server1/broker.xml
@@ -56,7 +56,7 @@ under the License.
 
       
          
-         
+         
             
             
             
diff --git a/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server2/broker.xml b/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server2/broker.xml
index 608796f190..5f3f611327 100644
--- a/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server2/broker.xml
+++ b/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server2/broker.xml
@@ -52,7 +52,7 @@
 
       
          
-         
+         
             
             
             
diff --git a/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server3/broker.xml b/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server3/broker.xml
index 950f8cdcda..53ce43f3b1 100644
--- a/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server3/broker.xml
+++ b/examples/features/clustered/clustered-static-discovery-uri/src/main/resources/activemq/server3/broker.xml
@@ -53,7 +53,7 @@
 
       
          
-         
+         
             
             
             
diff --git a/examples/features/clustered/clustered-static-discovery/readme.html b/examples/features/clustered/clustered-static-discovery/readme.html
index 88931b9eba..0dc1205b56 100644
--- a/examples/features/clustered/clustered-static-discovery/readme.html
+++ b/examples/features/clustered/clustered-static-discovery/readme.html
@@ -40,7 +40,6 @@ under the License.
      and to load balance the messages between the nodes.

      <cluster-connection name="my-cluster">
-        <address>jms</address>
         <connector-ref>netty-connector</connector-ref>
         <retry-interval>500</retry-interval>
         <use-duplicate-detection>true</use-duplicate-detection>
diff --git a/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server0/broker.xml
index b1bfd11f6f..25361f5d62 100644
--- a/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server0/broker.xml
+++ b/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server0/broker.xml
@@ -52,7 +52,6 @@ under the License.
 
       
          
-            
jms
netty-connector 500 true @@ -68,7 +67,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server1/broker.xml index 04125765d6..14cc4cab7d 100644 --- a/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server1/broker.xml @@ -52,7 +52,6 @@ under the License. -
jms
netty-connector 500 true @@ -68,7 +67,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server2/broker.xml b/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server2/broker.xml index 98b8f04430..051de1e2eb 100644 --- a/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server2/broker.xml +++ b/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server2/broker.xml @@ -49,7 +49,6 @@ -
jms
netty-connector 500 true @@ -65,7 +64,7 @@ - + diff --git a/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server3/broker.xml b/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server3/broker.xml index 40bef8798d..15f0245cc2 100644 --- a/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server3/broker.xml +++ b/examples/features/clustered/clustered-static-discovery/src/main/resources/activemq/server3/broker.xml @@ -49,7 +49,6 @@ -
jms
netty-connector 500 true @@ -65,7 +64,7 @@ - + diff --git a/examples/features/clustered/clustered-static-oneway/readme.html b/examples/features/clustered/clustered-static-oneway/readme.html index 04334a5947..e7fb9354a3 100644 --- a/examples/features/clustered/clustered-static-oneway/readme.html +++ b/examples/features/clustered/clustered-static-oneway/readme.html @@ -46,7 +46,6 @@ under the License.
      
      <cluster-connection name="my-cluster">
-        <address>jms</address>
         <connector-ref>netty-connector</connector-ref>
         <retry-interval>500</retry-interval>
         <use-duplicate-detection>true</use-duplicate-detection>
diff --git a/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server0/broker.xml
index 006b2ca85f..9abc109345 100644
--- a/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server0/broker.xml
+++ b/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server0/broker.xml
@@ -51,7 +51,6 @@
 
       
          
-            
jms
netty-connector 500 true @@ -67,7 +66,7 @@ - + diff --git a/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server1/broker.xml index e1ec02b2af..734c216a57 100644 --- a/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server1/broker.xml @@ -51,7 +51,6 @@ -
jms
netty-connector 500 true @@ -67,7 +66,7 @@ - + diff --git a/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server2/broker.xml b/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server2/broker.xml index 2585fba10b..d08f9b3292 100644 --- a/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server2/broker.xml +++ b/examples/features/clustered/clustered-static-oneway/src/main/resources/activemq/server2/broker.xml @@ -49,7 +49,6 @@ -
jms
netty-connector 500 true @@ -62,7 +61,7 @@ - + diff --git a/examples/features/clustered/clustered-topic-uri/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/clustered-topic-uri/src/main/resources/activemq/server0/broker.xml index 546e2e635a..7d147a393c 100644 --- a/examples/features/clustered/clustered-topic-uri/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/clustered/clustered-topic-uri/src/main/resources/activemq/server0/broker.xml @@ -75,7 +75,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-topic-uri/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-topic-uri/src/main/resources/activemq/server1/broker.xml index c7009f7b72..3140a0623e 100644 --- a/examples/features/clustered/clustered-topic-uri/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/clustered-topic-uri/src/main/resources/activemq/server1/broker.xml @@ -73,7 +73,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-topic/readme.html b/examples/features/clustered/clustered-topic/readme.html index e46fca8cde..a36fd05a5c 100644 --- a/examples/features/clustered/clustered-topic/readme.html +++ b/examples/features/clustered/clustered-topic/readme.html @@ -40,7 +40,6 @@ under the License. and to load balance the messages between the nodes.

      <cluster-connection name="my-cluster">
-        <address>jms</address>
         <retry-interval>500</retry-interval>
         <use-duplicate-detection>true</use-duplicate-detection>
         <message-load-balancing>STRICT</message-load-balancing>
diff --git a/examples/features/clustered/clustered-topic/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/clustered-topic/src/main/resources/activemq/server0/broker.xml
index a4e8ddef07..0385356584 100644
--- a/examples/features/clustered/clustered-topic/src/main/resources/activemq/server0/broker.xml
+++ b/examples/features/clustered/clustered-topic/src/main/resources/activemq/server0/broker.xml
@@ -69,7 +69,6 @@ under the License.
 
       
          
-            
jms
netty-connector 500 true @@ -83,7 +82,7 @@ under the License. - + diff --git a/examples/features/clustered/clustered-topic/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/clustered-topic/src/main/resources/activemq/server1/broker.xml index 78beec32d4..f03fb5f692 100644 --- a/examples/features/clustered/clustered-topic/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/clustered-topic/src/main/resources/activemq/server1/broker.xml @@ -67,7 +67,6 @@ under the License. -
jms
netty-connector 500 true @@ -81,7 +80,7 @@ under the License. - + diff --git a/examples/features/clustered/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml index 70ff4d4584..6df9b2bf32 100644 --- a/examples/features/clustered/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/clustered/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml @@ -67,7 +67,6 @@ under the License. -
jms
netty-connector 500 true @@ -81,7 +80,7 @@ under the License. - + @@ -97,7 +96,7 @@ under the License. Setting it to a value > 0 means how long to wait before redistributing, if a consumer is closed then another one quickly recreated you might want to set it thus, to avoid unnecessary redistribution --> - + 0 diff --git a/examples/features/clustered/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml index 6fc6f32d7d..5fb5257740 100644 --- a/examples/features/clustered/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml @@ -68,7 +68,6 @@ under the License. -
jms
netty-connector 500 true @@ -82,7 +81,7 @@ under the License. - + @@ -98,7 +97,7 @@ under the License. Setting it to a value > 0 means how long to wait before redistributing, if a consumer is closed then another one quickly recreated you might want to set it thus, to avoid unnecessary redistribution --> - + 0 diff --git a/examples/features/clustered/symmetric-cluster/readme.html b/examples/features/clustered/symmetric-cluster/readme.html index 043057d574..78665d6a9c 100644 --- a/examples/features/clustered/symmetric-cluster/readme.html +++ b/examples/features/clustered/symmetric-cluster/readme.html @@ -53,7 +53,6 @@ under the License.
      
    <cluster-connection name="my-cluster">
-      <address>jms</address>
       <connector-ref>netty-connector</connector-ref>
 	   <retry-interval>500</retry-interval>
 	   <use-duplicate-detection>true</use-duplicate-detection>
diff --git a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server0/broker.xml b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
index cd89de7310..bce8855a85 100644
--- a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
+++ b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
@@ -71,7 +71,6 @@ under the License.
 
       
          
-            
jms
netty-connector 500 true @@ -85,7 +84,7 @@ under the License. - + diff --git a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server1/broker.xml b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server1/broker.xml index d95a1cd134..a09039918a 100644 --- a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server1/broker.xml @@ -69,7 +69,6 @@ under the License. -
jms
netty-connector 500 true @@ -83,7 +82,7 @@ under the License. - + diff --git a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server2/broker.xml b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server2/broker.xml index ef006fd558..50f3d27193 100644 --- a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server2/broker.xml +++ b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server2/broker.xml @@ -69,7 +69,6 @@ under the License. -
jms
netty-connector 500 true @@ -83,7 +82,7 @@ under the License. - + diff --git a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server3/broker.xml b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server3/broker.xml index a780aceaf9..14b8535608 100644 --- a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server3/broker.xml +++ b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server3/broker.xml @@ -69,7 +69,6 @@ under the License. -
jms
netty-connector 500 true @@ -83,7 +82,7 @@ under the License. - + diff --git a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server4/broker.xml b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server4/broker.xml index 20b622e05f..38a420281b 100644 --- a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server4/broker.xml +++ b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server4/broker.xml @@ -68,7 +68,6 @@ under the License. -
jms
netty-connector 500 true @@ -82,7 +81,7 @@ under the License. - + diff --git a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server5/broker.xml b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server5/broker.xml index 033af4370b..b450f7b5cf 100644 --- a/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server5/broker.xml +++ b/examples/features/clustered/symmetric-cluster/src/main/resources/activemq/server5/broker.xml @@ -68,7 +68,6 @@ under the License. -
jms
netty-connector 500 true @@ -82,7 +81,7 @@ under the License. - + diff --git a/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml index d5fcbf88b8..b3e052b785 100644 --- a/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml @@ -69,13 +69,12 @@ under the License. -
jms
netty-connector 500 5 true - STRICT + OFF 1
@@ -104,7 +103,7 @@ under the License. - + @@ -112,7 +111,7 @@ under the License. - + @@ -120,7 +119,7 @@ under the License. - + diff --git a/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml index d849b10378..de6f79a3b9 100644 --- a/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml @@ -69,13 +69,12 @@ under the License. -
jms
netty-connector 500 5 true - STRICT + OFF 1
@@ -102,7 +101,7 @@ under the License. - + @@ -110,7 +109,7 @@ under the License. - + @@ -118,7 +117,7 @@ under the License. - + diff --git a/examples/features/ha/colocated-failover/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/colocated-failover/src/main/resources/activemq/server0/broker.xml index f569d39cec..c1d103f837 100644 --- a/examples/features/ha/colocated-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/colocated-failover/src/main/resources/activemq/server0/broker.xml @@ -67,7 +67,6 @@ under the License. -
jms
netty-connector 500 true @@ -100,7 +99,7 @@ under the License. - + diff --git a/examples/features/ha/colocated-failover/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/colocated-failover/src/main/resources/activemq/server1/broker.xml index 71015e5189..0a33683255 100644 --- a/examples/features/ha/colocated-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/colocated-failover/src/main/resources/activemq/server1/broker.xml @@ -67,7 +67,6 @@ under the License. -
jms
netty-connector 500 true @@ -100,7 +99,7 @@ under the License. - + diff --git a/examples/features/ha/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml index db98aa0b67..7d6b0a109e 100644 --- a/examples/features/ha/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml @@ -77,7 +77,6 @@ under the License. -
jms
netty-connector 500 true diff --git a/examples/features/ha/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml index 760ce0d956..435444bfee 100644 --- a/examples/features/ha/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml @@ -77,7 +77,6 @@ under the License. -
jms
netty-connector 500 true diff --git a/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml index f6fa349a9b..d7bdaecce9 100644 --- a/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml @@ -62,7 +62,6 @@ under the License. -
jms
netty-connector netty-backup-connector @@ -73,7 +72,7 @@ under the License. - + diff --git a/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml index 9b89d8089d..0ef447d677 100644 --- a/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml @@ -64,7 +64,6 @@ under the License. -
jms
netty-connector netty-live-connector @@ -75,7 +74,7 @@ under the License. - + diff --git a/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml index c7f47839ec..089bb7b71f 100644 --- a/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml @@ -78,7 +78,6 @@ under the License. -
jms
netty-connector
@@ -87,7 +86,7 @@ under the License. - + diff --git a/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml index da5a656401..52aa7331fb 100644 --- a/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml @@ -79,7 +79,6 @@ under the License. -
jms
netty-connector
@@ -88,7 +87,7 @@ under the License. - + diff --git a/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml index 43f16938fc..f6e061b8c4 100644 --- a/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server0/broker.xml @@ -72,7 +72,6 @@ under the License. -
jms
netty-connector
@@ -81,7 +80,7 @@ under the License. - + diff --git a/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml index 7f17fb8a94..5208153f30 100644 --- a/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server1/broker.xml @@ -72,7 +72,6 @@ under the License. -
jms
netty-connector
@@ -81,7 +80,7 @@ under the License. - + diff --git a/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml b/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml index c5f06cc254..b43bd188f0 100644 --- a/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml +++ b/examples/features/ha/replicated-multiple-failover/src/main/resources/activemq/server2/broker.xml @@ -72,7 +72,6 @@ under the License. -
jms
netty-connector
@@ -81,7 +80,7 @@ under the License. - + diff --git a/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml index f8b076a972..b8fca09a93 100644 --- a/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml @@ -73,7 +73,6 @@ under the License. -
jms
netty-connector
@@ -82,7 +81,7 @@ under the License. - + diff --git a/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml index f64af4e30b..9844163142 100644 --- a/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml @@ -73,7 +73,6 @@ under the License. -
jms
netty-connector
@@ -83,7 +82,7 @@ under the License. - + diff --git a/examples/features/ha/scale-down/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/scale-down/src/main/resources/activemq/server0/broker.xml index 559bb5aad2..dfb1e2c24b 100644 --- a/examples/features/ha/scale-down/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/scale-down/src/main/resources/activemq/server0/broker.xml @@ -67,7 +67,6 @@ under the License. -
jms
netty-connector 500 5 @@ -84,7 +83,7 @@ under the License. - + @@ -92,7 +91,7 @@ under the License. - + @@ -101,7 +100,7 @@ under the License. - + diff --git a/examples/features/ha/scale-down/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/scale-down/src/main/resources/activemq/server1/broker.xml index 6211cd3163..9150adf72f 100644 --- a/examples/features/ha/scale-down/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/scale-down/src/main/resources/activemq/server1/broker.xml @@ -68,7 +68,6 @@ under the License. -
jms
netty-connector 500 5 @@ -94,7 +93,7 @@ under the License. - + diff --git a/examples/features/ha/transaction-failover/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/transaction-failover/src/main/resources/activemq/server0/broker.xml index 916fdf5903..ab54ff05db 100644 --- a/examples/features/ha/transaction-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/transaction-failover/src/main/resources/activemq/server0/broker.xml @@ -75,7 +75,6 @@ under the License. -
jms
netty-connector
@@ -84,7 +83,7 @@ under the License. - + diff --git a/examples/features/ha/transaction-failover/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/transaction-failover/src/main/resources/activemq/server1/broker.xml index 055f04a71d..04078779b0 100644 --- a/examples/features/ha/transaction-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/transaction-failover/src/main/resources/activemq/server1/broker.xml @@ -74,7 +74,6 @@ under the License. -
jms
netty-connector
@@ -84,7 +83,7 @@ under the License. - + diff --git a/examples/features/standard/bridge/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/bridge/src/main/resources/activemq/server0/broker.xml index 83759019c3..ad123053cd 100644 --- a/examples/features/standard/bridge/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/bridge/src/main/resources/activemq/server0/broker.xml @@ -50,8 +50,8 @@ under the License. - -
jms.queue.sausage-factory
+ +
sausage-factory
@@ -59,8 +59,8 @@ under the License. We specify a filter with the bridge, and a transformer too. The filter and transformer are optional --> - jms.queue.sausage-factory - jms.queue.mincing-machine + sausage-factory + mincing-machine org.apache.activemq.artemis.jms.example.HatColourChangeTransformer -1 @@ -74,7 +74,7 @@ under the License. - + diff --git a/examples/features/standard/bridge/src/main/resources/activemq/server1/broker.xml b/examples/features/standard/bridge/src/main/resources/activemq/server1/broker.xml index 4d6c6e58bf..9aa13924ba 100644 --- a/examples/features/standard/bridge/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/standard/bridge/src/main/resources/activemq/server1/broker.xml @@ -45,7 +45,7 @@ under the License. - + diff --git a/examples/features/standard/cdi/pom.xml b/examples/features/standard/cdi/pom.xml index ade48c4e04..be344ebca1 100644 --- a/examples/features/standard/cdi/pom.xml +++ b/examples/features/standard/cdi/pom.xml @@ -137,6 +137,18 @@ org.apache.activemq.artemis.core.example.CDIExample + + stop + + cli + + + ${noServer} + + stop + + + diff --git a/examples/features/standard/dead-letter/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/dead-letter/src/main/resources/activemq/server0/broker.xml index a7f3030159..3325561ecb 100644 --- a/examples/features/standard/dead-letter/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/dead-letter/src/main/resources/activemq/server0/broker.xml @@ -49,7 +49,7 @@ under the License. - + @@ -61,8 +61,8 @@ under the License. - - jms.queue.deadLetterQueue + + deadLetterQueue 3 diff --git a/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/broker.xml index e4412b9d8f..7171ad03bb 100644 --- a/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/delayed-redelivery/src/main/resources/activemq/server0/broker.xml @@ -49,7 +49,7 @@ under the License. - + @@ -61,7 +61,7 @@ under the License. - + 5000 diff --git a/examples/features/standard/divert/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/divert/src/main/resources/activemq/server0/broker.xml index 9ad847c5d3..ac264c1648 100644 --- a/examples/features/standard/divert/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/divert/src/main/resources/activemq/server0/broker.xml @@ -66,23 +66,23 @@ under the License. - -
jms.queue.priceForwarding
+ +
priceForwarding
order-divert -
jms.queue.orders
- jms.topic.spyTopic +
orders
+ spyTopic false
prices-divert -
jms.topic.priceUpdates
- jms.queue.priceForwarding +
priceUpdates
+ priceForwarding org.apache.activemq.artemis.jms.example.AddForwardingTimeTransformer @@ -94,8 +94,8 @@ under the License. - jms.queue.priceForwarding - jms.topic.newYorkPriceUpdates + priceForwarding + newYorkPriceUpdates -1 newyork-connector @@ -107,7 +107,7 @@ under the License. - + diff --git a/examples/features/standard/divert/src/main/resources/activemq/server1/broker.xml b/examples/features/standard/divert/src/main/resources/activemq/server1/broker.xml index 26d6d95ca0..778607eebb 100644 --- a/examples/features/standard/divert/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/standard/divert/src/main/resources/activemq/server1/broker.xml @@ -50,7 +50,7 @@ under the License. - + diff --git a/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml index 8e319fa462..08c7c40580 100644 --- a/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml @@ -47,7 +47,7 @@ under the License. - + diff --git a/examples/features/standard/expiry/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/expiry/src/main/resources/activemq/server0/broker.xml index 731baaab83..32805f1efe 100644 --- a/examples/features/standard/expiry/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/expiry/src/main/resources/activemq/server0/broker.xml @@ -49,7 +49,7 @@ under the License. - + @@ -61,8 +61,8 @@ under the License. - - jms.queue.expiryQueue + + expiryQueue diff --git a/examples/features/standard/http-transport/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/http-transport/src/main/resources/activemq/server0/broker.xml index d1a4d2a70c..f91e249959 100644 --- a/examples/features/standard/http-transport/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/http-transport/src/main/resources/activemq/server0/broker.xml @@ -47,7 +47,7 @@ under the License. - + diff --git a/examples/features/standard/interceptor/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/interceptor/src/main/resources/activemq/server0/broker.xml index 49e780bb6c..531829c78d 100644 --- a/examples/features/standard/interceptor/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/interceptor/src/main/resources/activemq/server0/broker.xml @@ -51,7 +51,7 @@ under the License. - + diff --git a/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/broker.xml index cf211a7190..3b9df047d5 100644 --- a/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/jms-bridge/src/main/resources/activemq/server0/broker.xml @@ -41,7 +41,7 @@ under the License. - + diff --git a/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/broker.xml b/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/broker.xml index 8ec2378b0d..39089f835e 100644 --- a/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/standard/jms-bridge/src/main/resources/activemq/server1/broker.xml @@ -41,7 +41,7 @@ under the License. - + diff --git a/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml index 8e319fa462..08c7c40580 100644 --- a/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/jms-shared-consumer/src/main/resources/activemq/server0/broker.xml @@ -47,7 +47,7 @@ under the License. - + diff --git a/examples/features/standard/jmx/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/jmx/src/main/resources/activemq/server0/broker.xml index 90a617883e..b251d3716f 100644 --- a/examples/features/standard/jmx/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/jmx/src/main/resources/activemq/server0/broker.xml @@ -50,7 +50,7 @@ under the License. - + diff --git a/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java b/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java index 702fe41cbd..da47577bc4 100644 --- a/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java +++ b/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java @@ -46,7 +46,7 @@ public class LargeMessageExample { * This may take some considerable time to create, send and consume - if it takes too long or you * don't have enough disk space just reduce the file size here */ - private static final long FILE_SIZE = 2L * 1024 * 1024 * 1024; // 2 GiB message + private static final long FILE_SIZE = 2L;// * 1024 * 1024 * 1024; // 2 GiB message public static void main(final String[] args) throws Exception { Process server = null; diff --git a/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/broker.xml index 267d8c9806..18eb207946 100644 --- a/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/last-value-queue/src/main/resources/activemq/server0/broker.xml @@ -46,7 +46,7 @@ under the License. - + @@ -58,7 +58,7 @@ under the License. - + true diff --git a/examples/features/standard/management-notifications/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/management-notifications/src/main/resources/activemq/server0/broker.xml index 279f2d2f06..e74c8bbc65 100644 --- a/examples/features/standard/management-notifications/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/management-notifications/src/main/resources/activemq/server0/broker.xml @@ -41,7 +41,7 @@ under the License. ./data/messaging/paging - jms.topic.notificationsTopic + notificationsTopic @@ -52,7 +52,7 @@ under the License. - + @@ -62,7 +62,7 @@ under the License. - + diff --git a/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java b/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java index f1ceb3a143..a463a13baa 100644 --- a/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java +++ b/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java @@ -30,6 +30,8 @@ import javax.naming.InitialContext; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.management.JMSManagementHelper; +import org.apache.activemq.artemis.api.core.management.ResourceNames; +import org.apache.activemq.artemis.api.core.FilterConstants; /** * An example that shows how to manage ActiveMQ Artemis using JMS messages. @@ -81,7 +83,7 @@ public class ManagementExample { // Step 13. Use a helper class to fill the JMS message with management information: // * the name of the resource to manage // * in this case, we want to retrieve the value of the messageCount of the queue - JMSManagementHelper.putAttribute(m, "exampleQueue", "messageCount"); + JMSManagementHelper.putAttribute(m, ResourceNames.QUEUE + "exampleQueue", "messageCount"); // Step 14. Use the requestor to send the request and wait for the reply Message reply = requestor.request(m); @@ -97,7 +99,7 @@ public class ManagementExample { // * the object name of the resource to manage (i.e. the queue) // * in this case, we want to call the "removeMessage" operation with the JMS MessageID // of the message sent to the queue in step 8. - JMSManagementHelper.putOperationInvocation(m, "exampleQueue", "removeMessage", message.getJMSMessageID()); + JMSManagementHelper.putOperationInvocation(m, ResourceNames.QUEUE + "exampleQueue", "removeMessages", FilterConstants.ACTIVEMQ_USERID + " = '" + message.getJMSMessageID() + "'"); // Step 18 Use the requestor to send the request and wait for the reply reply = requestor.request(m); @@ -107,8 +109,8 @@ public class ManagementExample { System.out.println("operation invocation has succeeded: " + success); // Step 20. Use a helper class to retrieve the operation result - // in that case, a boolean which is true if the message was removed, false else - boolean messageRemoved = (Boolean) JMSManagementHelper.getResult(reply); + // in that case, a long which is 1 if the message was removed, 0 else + boolean messageRemoved = 1 == (long) JMSManagementHelper.getResult(reply); System.out.println("message has been removed: " + messageRemoved); // Step 21. Create a JMS Message Consumer on the queue diff --git a/examples/features/standard/management/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/management/src/main/resources/activemq/server0/broker.xml index dc62e6fd2e..218e621545 100644 --- a/examples/features/standard/management/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/management/src/main/resources/activemq/server0/broker.xml @@ -38,7 +38,7 @@ under the License. ./data/messaging/paging - jms.queue.activemq.management + activemq.management @@ -48,7 +48,7 @@ under the License. - + @@ -58,12 +58,12 @@ under the License. - + - + diff --git a/examples/features/standard/message-counters/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/message-counters/src/main/resources/activemq/server0/broker.xml index f946982771..39bba4729d 100644 --- a/examples/features/standard/message-counters/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/message-counters/src/main/resources/activemq/server0/broker.xml @@ -55,7 +55,7 @@ under the License. - + @@ -65,7 +65,7 @@ under the License. - + @@ -77,8 +77,8 @@ under the License. - - jms.queue.expiryQueue + + expiryQueue diff --git a/examples/features/standard/paging/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/paging/src/main/resources/activemq/server0/broker.xml index 04c77c403b..1da9ff5f7e 100644 --- a/examples/features/standard/paging/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/paging/src/main/resources/activemq/server0/broker.xml @@ -54,7 +54,7 @@ under the License. - + @@ -63,7 +63,7 @@ under the License. - + @@ -74,12 +74,12 @@ under the License. - + 100000 20000 - + 10485760 1048576 diff --git a/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java b/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java index 8a3fe100b9..d840c32eb2 100644 --- a/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java +++ b/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java @@ -31,6 +31,7 @@ import javax.jms.TextMessage; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.ActiveMQJMSConstants; import org.apache.activemq.artemis.api.jms.management.JMSManagementHelper; +import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; /** @@ -113,7 +114,7 @@ public class PreacknowledgeExample { Message m = session.createMessage(); - JMSManagementHelper.putAttribute(m, "exampleQueue", "messageCount"); + JMSManagementHelper.putAttribute(m, ResourceNames.QUEUE + "exampleQueue", "messageCount"); Message response = requestor.request(m); diff --git a/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/broker.xml index 4379ab8448..c13644bb06 100644 --- a/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/pre-acknowledge/src/main/resources/activemq/server0/broker.xml @@ -45,7 +45,7 @@ under the License. - + @@ -54,7 +54,7 @@ under the License. - + diff --git a/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/broker.xml index 612b35bb13..64a5ba3221 100644 --- a/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/queue-requestor/src/main/resources/activemq/server0/broker.xml @@ -46,7 +46,7 @@ under the License. - + @@ -55,7 +55,7 @@ under the License. - + diff --git a/examples/features/standard/reattach-node/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/reattach-node/src/main/resources/activemq/server0/broker.xml index f646990283..ec41710fc0 100644 --- a/examples/features/standard/reattach-node/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/reattach-node/src/main/resources/activemq/server0/broker.xml @@ -61,7 +61,7 @@ under the License. - + @@ -70,7 +70,7 @@ under the License. - + diff --git a/examples/features/standard/security-ldap/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/security-ldap/src/main/resources/activemq/server0/broker.xml index 667ac955b4..bb969224bf 100644 --- a/examples/features/standard/security-ldap/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/security-ldap/src/main/resources/activemq/server0/broker.xml @@ -52,7 +52,7 @@ under the License. - + @@ -61,7 +61,7 @@ under the License. - + @@ -70,7 +70,7 @@ under the License. - + diff --git a/examples/features/standard/security/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/security/src/main/resources/activemq/server0/broker.xml index e2dc187813..28612c4d05 100644 --- a/examples/features/standard/security/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/security/src/main/resources/activemq/server0/broker.xml @@ -49,7 +49,7 @@ under the License. - + @@ -58,7 +58,7 @@ under the License. - + @@ -67,7 +67,7 @@ under the License. - + diff --git a/examples/features/standard/ssl-enabled-dual-authentication/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/ssl-enabled-dual-authentication/src/main/resources/activemq/server0/broker.xml index 14fa849c77..438a75161b 100644 --- a/examples/features/standard/ssl-enabled-dual-authentication/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/ssl-enabled-dual-authentication/src/main/resources/activemq/server0/broker.xml @@ -47,7 +47,7 @@ under the License. - + diff --git a/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/broker.xml index 4bf6371d07..1b209d8167 100644 --- a/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/ssl-enabled/src/main/resources/activemq/server0/broker.xml @@ -46,7 +46,7 @@ under the License. - + diff --git a/examples/features/standard/static-selector/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/static-selector/src/main/resources/activemq/server0/broker.xml index 59ce14947a..e9cde420a9 100644 --- a/examples/features/standard/static-selector/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/static-selector/src/main/resources/activemq/server0/broker.xml @@ -43,8 +43,8 @@ under the License. - -
jms.queue.exampleQueue
+ +
exampleQueue
@@ -53,7 +53,7 @@ under the License. - + diff --git a/examples/features/standard/temp-queue/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/temp-queue/src/main/resources/activemq/server0/broker.xml index 2dd2df9285..15fd199527 100644 --- a/examples/features/standard/temp-queue/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/temp-queue/src/main/resources/activemq/server0/broker.xml @@ -45,7 +45,7 @@ under the License. - + @@ -54,7 +54,7 @@ under the License. - + diff --git a/examples/features/standard/topic-selector-example1/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/topic-selector-example1/src/main/resources/activemq/server0/broker.xml index d45eb5d9ef..030aa73915 100644 --- a/examples/features/standard/topic-selector-example1/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/topic-selector-example1/src/main/resources/activemq/server0/broker.xml @@ -46,7 +46,7 @@ under the License. - + diff --git a/examples/features/standard/topic-selector-example2/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/topic-selector-example2/src/main/resources/activemq/server0/broker.xml index d45eb5d9ef..030aa73915 100644 --- a/examples/features/standard/topic-selector-example2/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/topic-selector-example2/src/main/resources/activemq/server0/broker.xml @@ -46,7 +46,7 @@ under the License. - + diff --git a/examples/features/standard/topic/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/topic/src/main/resources/activemq/server0/broker.xml index fd6671c1fa..25d82daca0 100644 --- a/examples/features/standard/topic/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/standard/topic/src/main/resources/activemq/server0/broker.xml @@ -45,9 +45,11 @@ under the License. - + + + diff --git a/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml b/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml index 1095761a10..3751be0cc8 100644 --- a/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml @@ -45,8 +45,8 @@ under the License. - -
jms.queue.exampleQueue
+ +
exampleQueue
@@ -54,7 +54,7 @@ under the License. org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory - + @@ -64,7 +64,7 @@ under the License. - + diff --git a/examples/protocols/amqp/proton-cpp/src/main/java/org/apache/activemq/artemis/jms/example/ProtonCPPExample.java b/examples/protocols/amqp/proton-cpp/src/main/java/org/apache/activemq/artemis/jms/example/ProtonCPPExample.java index a166dc2a90..0c389f4030 100644 --- a/examples/protocols/amqp/proton-cpp/src/main/java/org/apache/activemq/artemis/jms/example/ProtonCPPExample.java +++ b/examples/protocols/amqp/proton-cpp/src/main/java/org/apache/activemq/artemis/jms/example/ProtonCPPExample.java @@ -30,6 +30,7 @@ import javax.naming.InitialContext; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.management.JMSManagementHelper; +import org.apache.activemq.artemis.api.core.management.ResourceNames; /** * This example demonstrates the use of ActiveMQ Artemis "pre-acknowledge" functionality where @@ -107,7 +108,7 @@ public class ProtonCPPExample { Message m = session.createMessage(); - JMSManagementHelper.putAttribute(m, "exampleQueue", "messageCount"); + JMSManagementHelper.putAttribute(m, ResourceNames.QUEUE + "exampleQueue", "messageCount"); Message response = requestor.request(m); diff --git a/examples/protocols/stomp/stomp-dual-authentication/src/main/resources/activemq/server0/broker.xml b/examples/protocols/stomp/stomp-dual-authentication/src/main/resources/activemq/server0/broker.xml index 14fa849c77..438a75161b 100644 --- a/examples/protocols/stomp/stomp-dual-authentication/src/main/resources/activemq/server0/broker.xml +++ b/examples/protocols/stomp/stomp-dual-authentication/src/main/resources/activemq/server0/broker.xml @@ -47,7 +47,7 @@ under the License. - + 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 827e1b3a6f..69d8675e7e 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 @@ -229,7 +229,7 @@ public class AddressingTest extends ActiveMQTestBase { SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); // For each address, create 2 Queues with the same address, assert both queues receive message boolean deleteOnNoConsumers = true; - Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers, false); + Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers, true); ClientSession session = sessionFactory.createSession(); session.start(); @@ -246,7 +246,7 @@ public class AddressingTest extends ActiveMQTestBase { SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); // For each address, create 2 Queues with the same address, assert both queues receive message boolean deleteOnNoConsumers = false; - Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers, false); + Queue q1 = server.createQueue(address, queueName, null, true, false, null, deleteOnNoConsumers, true); ClientSession session = sessionFactory.createSession(); session.start(); @@ -263,7 +263,7 @@ public class AddressingTest extends ActiveMQTestBase { SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); // For each address, create 2 Queues with the same address, assert both queues receive message boolean deleteOnNoConsumers = false; - Queue q1 = server.createQueue(address, queueName, null, true, false, 0, deleteOnNoConsumers, false); + Queue q1 = server.createQueue(address, queueName, null, true, false, 0, deleteOnNoConsumers, true); Exception expectedException = null; String expectedMessage = "Maximum Consumer Limit Reached on Queue"; 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 d961a71baa..1e12d4c8ac 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 @@ -86,7 +86,7 @@ public class AmqpClientTestSupport extends ActiveMQTestBase { ActiveMQServer server = createServer(true, true); serverManager = new JMSServerManagerImpl(server); Configuration serverConfig = server.getConfiguration(); - serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateJmsQueues(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); serverManager.start(); server.start(); 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 9589f47327..4fceaef925 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 @@ -18,7 +18,6 @@ package org.apache.activemq.artemis.tests.integration.cli; import java.io.ByteArrayOutputStream; import java.io.PrintStream; -import java.util.UUID; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.cli.commands.AbstractAction; @@ -26,10 +25,7 @@ import org.apache.activemq.artemis.cli.commands.ActionContext; import org.apache.activemq.artemis.cli.commands.address.CreateAddress; import org.apache.activemq.artemis.cli.commands.address.DeleteAddress; import org.apache.activemq.artemis.cli.commands.address.ShowAddress; -import org.apache.activemq.artemis.cli.commands.queue.CreateQueue; -import org.apache.activemq.artemis.cli.commands.queue.DeleteQueue; import org.apache.activemq.artemis.core.config.DivertConfiguration; -import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.junit.Before; 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 5d7a695afb..9bddb8c606 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 @@ -51,7 +51,7 @@ public class QueueCommandTest extends JMSTestBase { CreateQueue command = new CreateQueue(); command.setName(queueName); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); - checkExecutionFailure(command, "AMQ119203: Address Does Not Exist:");; + checkExecutionFailure(command, "AMQ119203: Address Does Not Exist:"); assertFalse(server.queueQuery(new SimpleString(queueName)).isExists()); } @@ -74,7 +74,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testCreateCoreQueueAddressExists() throws Exception { String queueName = "queue"; - String address= "address"; + String address = "address"; CreateQueue command = new CreateQueue(); command.setName(queueName); 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 006bef1929..a98087845d 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 @@ -114,7 +114,7 @@ public class AutoCreateJmsDestinationTest extends JMSTestBase { ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("guest", "guest"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "rejectAll"); - Role role = new Role("rejectAll", false, false, false, false, false, false, false, false, false); + Role role = new Role("rejectAll", false, false, false, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch("#", roles); @@ -249,7 +249,7 @@ public class AutoCreateJmsDestinationTest extends JMSTestBase { ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("guest", "guest"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "allowAll"); - Role role = new Role("allowAll", true, true, true, true, true, true, true, true, true); + Role role = new Role("allowAll", true, true, true, true, true, true, true, true, true, true); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch("#", roles); 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 7f97100f16..b3c7a4c42d 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 @@ -229,7 +229,8 @@ public class SessionTest extends ActiveMQTestBase { @Test public void testQueueQueryNoQ() throws Exception { - server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsQueues(false)); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false)); cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); QueueQuery resp = clientSession.queueQuery(new SimpleString(queueName)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java index abfc093bb7..746b31d75e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java @@ -103,7 +103,7 @@ public class SecurityFailoverTest extends FailoverTest { protected ActiveMQJAASSecurityManager installSecurity(TestableServer server) { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getServer().getSecurityManager(); securityManager.getConfiguration().addUser("a", "b"); - Role role = new Role("arole", true, true, true, true, true, true, true, true, true); + Role role = new Role("arole", true, true, true, true, true, true, true, true, true, true); Set roles = new HashSet<>(); roles.add(role); server.getServer().getSecurityRepository().addMatch("#", roles); 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 1a0a997f2b..5aafd91224 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 @@ -64,7 +64,7 @@ public class AMQPToOpenwireTest extends ActiveMQTestBase { server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); - serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateJmsQueues(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); server.createQueue(coreQueue, coreQueue, null, false, false); 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 fc98f13e7a..968a3a7f7c 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 @@ -55,7 +55,7 @@ public class OpenWireToAMQPTest extends ActiveMQTestBase { super.setUp(); server = createServer(true, true); Configuration serverConfig = server.getConfiguration(); - serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateJmsQueues(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); server.start(); coreQueue = new SimpleString(queueName); 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 362c8a17fc..f6ad723a56 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 @@ -64,8 +64,6 @@ public class InterceptorTest extends ActiveMQTestBase { private final SimpleString QUEUE = new SimpleString("InterceptorTestQueue"); - private final SimpleString JMS_QUEUE = SimpleString.toSimpleString(QUEUE.toString()); - private ServerLocator locator; @Override @@ -103,12 +101,12 @@ public class InterceptorTest extends ActiveMQTestBase { @Override public boolean intercept(final Packet packet, final RemotingConnection connection) throws ActiveMQException { - if (packet.getType() == PacketImpl.CREATE_QUEUE) { + 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 + "'")); - System.out.println("userName = " + userName); + System.out.println("userName on createQueue = " + userName); } else if (packet.getType() == PacketImpl.SESS_SEND) { String userName = getUsername(packet, connection); MessagePacket msgPacket = (MessagePacket) packet; @@ -1054,7 +1052,7 @@ public class InterceptorTest extends ActiveMQTestBase { public void testInterceptorOnURI() throws Exception { locator.close(); - server.createQueue(JMS_QUEUE, JMS_QUEUE, null, true, false); + server.createQueue(QUEUE, 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/cluster/AutoCreateQueueClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/AutoCreateQueueClusterTest.java index eb3d1840d1..2894c2967f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/AutoCreateQueueClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/AutoCreateQueueClusterTest.java @@ -46,8 +46,8 @@ public class AutoCreateQueueClusterTest extends JMSClusteredTestBase { @Test public void testAutoCreate() throws Exception { - server1.getAddressSettingsRepository().getMatch("#").setAutoCreateJmsQueues(true).setRedistributionDelay(0); - server2.getAddressSettingsRepository().getMatch("#").setAutoCreateJmsQueues(true).setRedistributionDelay(0); + server1.getAddressSettingsRepository().getMatch("#").setAutoCreateQueues(true).setAutoCreateAddresses(true).setRedistributionDelay(0); + server2.getAddressSettingsRepository().getMatch("#").setAutoCreateQueues(true).setAutoCreateAddresses(true).setRedistributionDelay(0); Connection conn1 = cf1.createConnection(); Connection conn2 = cf2.createConnection(); conn1.start(); @@ -58,15 +58,13 @@ public class AutoCreateQueueClusterTest extends JMSClusteredTestBase { Session session2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); - // TODO the "jms." prefix is required here because the cluster connection only works for queues which start with "jms" - MessageProducer prod1 = session1.createProducer(ActiveMQJMSClient.createQueue("jms.myQueue")); + MessageProducer prod1 = session1.createProducer(ActiveMQJMSClient.createQueue("myQueue")); prod1.setDeliveryMode(DeliveryMode.PERSISTENT); prod1.send(session1.createTextMessage("m1")); - // TODO the "jms." prefix is required here because the cluster connection only works for queues which start with "jms" - MessageConsumer cons2 = session2.createConsumer(ActiveMQJMSClient.createQueue("jms.myQueue")); + MessageConsumer cons2 = session2.createConsumer(ActiveMQJMSClient.createQueue("myQueue")); TextMessage received = (TextMessage) cons2.receive(5000); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/TemporaryQueueClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/TemporaryQueueClusterTest.java index b68d803b29..ae3a93accb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/TemporaryQueueClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/TemporaryQueueClusterTest.java @@ -28,7 +28,7 @@ import org.junit.Test; public class TemporaryQueueClusterTest extends JMSClusteredTestBase { - public static final String QUEUE_NAME = "jms.target"; + public static final String QUEUE_NAME = "target"; // Constants ----------------------------------------------------- diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/NonExistentQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/NonExistentQueueTest.java index 64d2af34c9..64edd2970f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/NonExistentQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/NonExistentQueueTest.java @@ -40,8 +40,8 @@ public class NonExistentQueueTest extends JMSTestBase { @Test public void sendToNonExistentDestination() throws Exception { - server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsQueues(false)); - server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsTopics(false)); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false)); Destination destination = ActiveMQJMSClient.createTopic("DoesNotExist"); TransportConfiguration transportConfiguration = new TransportConfiguration(InVMConnectorFactory.class.getName()); ConnectionFactory localConnectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration); 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 681c25815e..c4a388e5e7 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 @@ -440,7 +440,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { String exactAddress = "test.whatever"; assertEquals(1, serverControl.getRoles(addressMatch).length); - serverControl.addSecuritySettings(addressMatch, "foo", "foo, bar", "foo", "bar", "foo, bar", "", "", "bar", "foo"); + serverControl.addSecuritySettings(addressMatch, "foo", "foo, bar", "foo", "bar", "foo, bar", "", "", "bar", "foo", "foo"); // Restart the server. Those settings should be persisted @@ -1416,7 +1416,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { server.start(); HashSet role = new HashSet<>(); - role.add(new Role("guest", true, true, true, true, true, true, true, true, true)); + role.add(new Role("guest", true, true, true, true, true, true, true, true, true, true)); server.getSecurityRepository().addMatch("#", role); } 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 2547bb6b54..931089c174 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 @@ -16,12 +16,13 @@ */ package org.apache.activemq.artemis.tests.integration.management; +import java.util.Map; + import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException; import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl; import org.apache.activemq.artemis.api.core.management.Parameter; import org.apache.activemq.artemis.api.core.management.ResourceNames; - -import java.util.Map; +import org.apache.activemq.artemis.core.settings.impl.AddressSettings; public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTest { @@ -607,8 +608,9 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes String deleteNonDurableQueueRoles, String manageRoles, String browseRoles, - String createAddress) throws Exception { - proxy.invokeOperation("addSecuritySettings", addressMatch, sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createNonDurableQueueRoles, deleteNonDurableQueueRoles, manageRoles, browseRoles, createAddress); + String createAddress, + String deleteAddress) throws Exception { + proxy.invokeOperation("addSecuritySettings", addressMatch, sendRoles, consumeRoles, createDurableQueueRoles, deleteDurableQueueRoles, createNonDurableQueueRoles, deleteNonDurableQueueRoles, manageRoles, browseRoles, createAddress, deleteAddress); } @Override @@ -649,7 +651,37 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes @Parameter(desc = "allow auto-created queues to be deleted automatically", name = "autoDeleteJmsQueues") boolean autoDeleteJmsQueues, @Parameter(desc = "allow topics to be created automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics, @Parameter(desc = "allow auto-created topics to be deleted automatically", name = "autoDeleteJmsTopics") boolean autoDeleteJmsTopics) throws Exception { - proxy.invokeOperation("addAddressSettings", addressMatch, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, maxSizeBytes, pageSizeBytes, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics); + addAddressSettings(addressMatch, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, maxSizeBytes, pageSizeBytes, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics, AddressSettings.DEFAULT_AUTO_CREATE_QUEUES, AddressSettings.DEFAULT_AUTO_DELETE_QUEUES, AddressSettings.DEFAULT_AUTO_CREATE_ADDRESSES, AddressSettings.DEFAULT_AUTO_DELETE_ADDRESSES); + } + + @Override + public void addAddressSettings(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch, + @Parameter(desc = "the dead letter address setting", name = "DLA") String DLA, + @Parameter(desc = "the expiry address setting", name = "expiryAddress") String expiryAddress, + @Parameter(desc = "the expiry delay setting", name = "expiryDelay") long expiryDelay, + @Parameter(desc = "are any queues created for this address a last value queue", name = "lastValueQueue") boolean lastValueQueue, + @Parameter(desc = "the delivery attempts", name = "deliveryAttempts") int deliveryAttempts, + @Parameter(desc = "the max size in bytes", name = "maxSizeBytes") long maxSizeBytes, + @Parameter(desc = "the page size in bytes", name = "pageSizeBytes") int pageSizeBytes, + @Parameter(desc = "the max number of pages in the soft memory cache", name = "pageMaxCacheSize") int pageMaxCacheSize, + @Parameter(desc = "the redelivery delay", name = "redeliveryDelay") long redeliveryDelay, + @Parameter(desc = "the redelivery delay multiplier", name = "redeliveryMultiplier") double redeliveryMultiplier, + @Parameter(desc = "the maximum redelivery delay", name = "maxRedeliveryDelay") long maxRedeliveryDelay, + @Parameter(desc = "the redistribution delay", name = "redistributionDelay") long redistributionDelay, + @Parameter(desc = "do we send to the DLA when there is no where to route the message", name = "sendToDLAOnNoRoute") boolean sendToDLAOnNoRoute, + @Parameter(desc = "the policy to use when the address is full", name = "addressFullMessagePolicy") String addressFullMessagePolicy, + @Parameter(desc = "when a consumer falls below this threshold in terms of messages consumed per second it will be considered 'slow'", name = "slowConsumerThreshold") long slowConsumerThreshold, + @Parameter(desc = "how often (in seconds) to check for slow consumers", name = "slowConsumerCheckPeriod") long slowConsumerCheckPeriod, + @Parameter(desc = "the policy to use when a slow consumer is detected", name = "slowConsumerPolicy") String slowConsumerPolicy, + @Parameter(desc = "allow jms queues to be created automatically", name = "autoCreateJmsQueues") boolean autoCreateJmsQueues, + @Parameter(desc = "allow auto-created jms queues to be deleted automatically", name = "autoDeleteJmsQueues") boolean autoDeleteJmsQueues, + @Parameter(desc = "allow jms topics to be created automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics, + @Parameter(desc = "allow auto-created jms topics to be deleted automatically", name = "autoDeleteJmsTopics") boolean autoDeleteJmsTopics, + @Parameter(desc = "allow queues to be created automatically", name = "autoCreateQueues") boolean autoCreateQueues, + @Parameter(desc = "allow auto-created queues to be deleted automatically", name = "autoDeleteQueues") boolean autoDeleteQueues, + @Parameter(desc = "allow topics to be created automatically", name = "autoCreateAddresses") boolean autoCreateAddresses, + @Parameter(desc = "allow auto-created topics to be deleted automatically", name = "autoDeleteAddresses") boolean autoDeleteAddresses) throws Exception { + proxy.invokeOperation("addAddressSettings", addressMatch, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, maxSizeBytes, pageSizeBytes, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics, autoCreateQueues, autoDeleteQueues, autoCreateAddresses, autoDeleteAddresses); } @Override 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 9a2ec1e699..35e1aa2b16 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 @@ -117,7 +117,7 @@ public class AddressControlTest extends ManagementTestBase { public void testGetRoles() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - Role role = new Role(RandomUtil.randomString(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean()); + Role role = new Role(RandomUtil.randomString(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean()); session.createQueue(address, queue, true); @@ -148,7 +148,7 @@ public class AddressControlTest extends ManagementTestBase { public void testGetRolesAsJSON() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - Role role = new Role(RandomUtil.randomString(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean()); + Role role = new Role(RandomUtil.randomString(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean()); session.createQueue(address, queue, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java index 1587ceff69..4b8e4872b9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java @@ -125,7 +125,7 @@ public class AddressControlUsingCoreTest extends ManagementTestBase { public void testGetRoles() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - Role role = new Role(RandomUtil.randomString(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean()); + Role role = new Role(RandomUtil.randomString(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean()); session.createQueue(address, queue, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java deleted file mode 100644 index 5c94f1df72..0000000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java +++ /dev/null @@ -1,232 +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.integration.management; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - -import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; -import org.apache.activemq.artemis.api.core.SimpleString; -import org.apache.activemq.artemis.api.core.TransportConfiguration; -import org.apache.activemq.artemis.api.core.client.ClientSession; -import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; -import org.apache.activemq.artemis.api.core.client.ServerLocator; -import org.apache.activemq.artemis.api.core.management.ResourceNames; -import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.protocol.stomp.Stomp; -import org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManagerFactory; -import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory; -import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; -import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.jms.server.JMSServerManager; -import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl; -import org.apache.activemq.artemis.utils.RandomUtil; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class ManagementWithStompTest extends ManagementTestBase { - - // Constants ----------------------------------------------------- - - // Attributes ---------------------------------------------------- - - protected ActiveMQServer server; - - protected JMSServerManager jmsServer; - - protected ClientSession session; - - private Socket stompSocket; - - private ByteArrayOutputStream inputBuffer; - - // Static -------------------------------------------------------- - - // Constructors -------------------------------------------------- - - // Public -------------------------------------------------------- - - @Test - public void testGetManagementAttributeFromStomp() throws Exception { - SimpleString address = RandomUtil.randomSimpleString(); - SimpleString queue = RandomUtil.randomSimpleString(); - - session.createQueue(address, queue, null, false); - - String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL; - sendFrame(frame); - - frame = receiveFrame(10000); - Assert.assertTrue(frame.startsWith("CONNECTED")); - - frame = "SUBSCRIBE\n" + "destination:" + queue + "\n\n" + Stomp.NULL; - sendFrame(frame); - - // retrieve the address of the queue - frame = "\nSEND\n" + "destination:" + ActiveMQDefaultConfiguration.getDefaultManagementAddress() + "\n" + - "reply-to:" + address + "\n" + - "_AMQ_ResourceName:" + ResourceNames.QUEUE + queue + "\n" + - "_AMQ_Attribute: Address\n\n" + - Stomp.NULL; - sendFrame(frame); - - frame = receiveFrame(10000); - System.out.println(frame); - Assert.assertTrue(frame.contains("_AMQ_OperationSucceeded:true")); - // the address will be returned in the message body in a JSON array - Assert.assertTrue(frame.contains("[\"" + address + "\"]")); - - frame = "UNSUBSCRIBE\n" + "destination:" + queue + "\n" + - "receipt: 123\n\n" + - Stomp.NULL; - sendFrame(frame); - waitForReceipt(); - - String disconnectFrame = "DISCONNECT\n\n" + Stomp.NULL; - sendFrame(disconnectFrame); - - session.deleteQueue(queue); - } - - @Test - public void testInvokeOperationFromStomp() throws Exception { - SimpleString address = RandomUtil.randomSimpleString(); - SimpleString queue = RandomUtil.randomSimpleString(); - - session.createQueue(address, queue, null, false); - - String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL; - sendFrame(frame); - - frame = receiveFrame(10000); - Assert.assertTrue(frame.startsWith("CONNECTED")); - - frame = "SUBSCRIBE\n" + "destination:" + queue + "\n\n" + Stomp.NULL; - sendFrame(frame); - - // count number of message with filter "color = 'blue'" - frame = "\nSEND\n" + "destination:" + ActiveMQDefaultConfiguration.getDefaultManagementAddress() + "\n" + - "reply-to:" + address + "\n" + - "_AMQ_ResourceName:" + ResourceNames.QUEUE + queue + "\n" + - "_AMQ_OperationName: countMessages\n\n" + - "[\"color = 'blue'\"]" + - Stomp.NULL; - sendFrame(frame); - - frame = receiveFrame(10000); - System.out.println(frame); - Assert.assertTrue(frame.contains("_AMQ_OperationSucceeded:true")); - // there is no such messages => 0 returned in a JSON array - Assert.assertTrue(frame.contains("[0]")); - - frame = "UNSUBSCRIBE\n" + "destination:" + queue + "\n" + - "receipt: 123\n\n" + - Stomp.NULL; - sendFrame(frame); - waitForReceipt(); - - String disconnectFrame = "DISCONNECT\n\n" + Stomp.NULL; - sendFrame(disconnectFrame); - - session.deleteQueue(queue); - } - - // Package protected --------------------------------------------- - - // Protected ----------------------------------------------------- - - private ServerLocator locator; - - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - - Map params = new HashMap<>(); - params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); - params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); - TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params); - - Configuration config = createDefaultInVMConfig().addAcceptorConfiguration(stompTransport); - - server = addServer(ActiveMQServers.newActiveMQServer(config, mbeanServer, false, "brianm", "wombats")); - - jmsServer = new JMSServerManagerImpl(server); - - jmsServer.start(); - - locator = createInVMNonHALocator().setBlockOnNonDurableSend(true); - ClientSessionFactory sf = createSessionFactory(locator); - session = sf.createSession(false, true, false); - session.start(); - - stompSocket = new Socket("127.0.0.1", TransportConstants.DEFAULT_STOMP_PORT); - inputBuffer = new ByteArrayOutputStream(); - } - - // Private ------------------------------------------------------- - - public void sendFrame(String data) throws Exception { - byte[] bytes = data.getBytes(StandardCharsets.UTF_8); - OutputStream outputStream = stompSocket.getOutputStream(); - for (int i = 0; i < bytes.length; i++) { - outputStream.write(bytes[i]); - } - outputStream.flush(); - } - - public String receiveFrame(long timeOut) throws Exception { - stompSocket.setSoTimeout((int) timeOut); - InputStream is = stompSocket.getInputStream(); - int c = 0; - for (;;) { - c = is.read(); - if (c < 0) { - throw new IOException("socket closed."); - } else if (c == 0) { - c = is.read(); - if (c != '\n') { - byte[] ba = inputBuffer.toByteArray(); - System.out.println(new String(ba, StandardCharsets.UTF_8)); - } - Assert.assertEquals("Expecting stomp frame to terminate with \0\n", c, '\n'); - byte[] ba = inputBuffer.toByteArray(); - inputBuffer.reset(); - return new String(ba, StandardCharsets.UTF_8); - } else { - inputBuffer.write(c); - } - } - } - - protected void waitForReceipt() throws Exception { - String frame = receiveFrame(50000); - Assert.assertNotNull(frame); - Assert.assertTrue(frame.indexOf("RECEIPT") > -1); - } - - // Inner classes ------------------------------------------------- - -} diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java index 03c7fc7109..bbe97ec1a5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java @@ -90,10 +90,10 @@ public class SecurityManagementWithConfiguredAdminUserTest extends SecurityManag securityManager.getConfiguration().addRole(invalidAdminUser, "guest"); Set adminRole = securityRepository.getMatch(ActiveMQDefaultConfiguration.getDefaultManagementAddress().toString()); - adminRole.add(new Role("admin", true, true, true, true, true, true, true, true, true)); + adminRole.add(new Role("admin", true, true, true, true, true, true, true, true, true, true)); securityRepository.addMatch(ActiveMQDefaultConfiguration.getDefaultManagementAddress().toString(), adminRole); Set guestRole = securityRepository.getMatch("*"); - guestRole.add(new Role("guest", true, true, true, true, true, true, false, true, true)); + guestRole.add(new Role("guest", true, true, true, true, true, true, false, true, true, true)); securityRepository.addMatch("*", guestRole); return server; 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 89f03b8cfe..a5f8ec55c2 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 @@ -88,7 +88,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); // guest can not create queue - Role role = new Role("roleCanNotCreateQueue", true, true, false, true, false, true, true, true, true); + Role role = new Role("roleCanNotCreateQueue", true, true, false, true, false, true, true, true, true, true); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(address.toString(), roles); @@ -136,7 +136,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { securityManager.getConfiguration().addUser("guest", "guest"); securityManager.getConfiguration().setDefaultUser("guest"); - Role role = new Role("notif", true, true, true, true, true, true, true, true, true); + Role role = new Role("notif", true, true, true, true, true, true, true, true, true, true); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress().toString(), roles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java index 15cb8b6b7c..877d5a7bdf 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java @@ -132,7 +132,8 @@ public class MQTTTestSupport extends ActiveMQTestBase { addMQTTConnector(); AddressSettings addressSettings = new AddressSettings(); addressSettings.setMaxSizeBytes(999999999); - addressSettings.setAutoCreateJmsQueues(true); + addressSettings.setAutoCreateQueues(true); + addressSettings.setAutoCreateAddresses(true); server.getAddressSettingsRepository().addMatch("#", addressSettings); server.start(); 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 52f090d3ad..ac995c2c59 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 @@ -64,7 +64,7 @@ public class OpenWireTestBase extends ActiveMQTestBase { Configuration serverConfig = server.getConfiguration(); - serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateJmsQueues(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(enableSecurity); @@ -75,23 +75,23 @@ public class OpenWireTestBase extends ActiveMQTestBase { securityManager.getConfiguration().addRole("openwireSender", "sender"); securityManager.getConfiguration().addUser("openwireSender", "SeNdEr"); //sender cannot receive - Role senderRole = new Role("sender", true, false, false, false, true, true, false, false, true); + Role senderRole = new Role("sender", true, false, false, false, true, true, false, false, true, true); securityManager.getConfiguration().addRole("openwireReceiver", "receiver"); securityManager.getConfiguration().addUser("openwireReceiver", "ReCeIvEr"); //receiver cannot send - Role receiverRole = new Role("receiver", false, true, false, false, true, true, false, true, false); + Role receiverRole = new Role("receiver", false, true, false, false, true, true, false, true, false, false); securityManager.getConfiguration().addRole("openwireGuest", "guest"); securityManager.getConfiguration().addUser("openwireGuest", "GuEsT"); //guest cannot do anything - Role guestRole = new Role("guest", false, false, false, false, false, false, false, false, false); + Role guestRole = new Role("guest", false, false, false, false, false, false, false, false, false, false); securityManager.getConfiguration().addRole("openwireDestinationManager", "manager"); securityManager.getConfiguration().addUser("openwireDestinationManager", "DeStInAtIoN"); - Role destRole = new Role("manager", false, false, false, false, true, true, false, false, false); + Role destRole = new Role("manager", false, false, false, false, true, true, false, false, false, false); Set roles = new HashSet<>(); roles.add(senderRole); 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 f739b3e7bd..4fccfa3206 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 @@ -404,6 +404,13 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { @Test public void testSimpleTempQueue() throws Exception { + AddressSettings addressSetting = new AddressSettings(); + addressSetting.setAutoCreateQueues(true); + addressSetting.setAutoCreateAddresses(true); + + String address = "#"; + server.getAddressSettingsRepository().addMatch(address, addressSetting); + connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -440,17 +447,13 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { @Test public void testInvalidDestinationExceptionWhenNoQueueExistsOnCreateProducer() throws Exception { - AddressSettings addressSetting = new AddressSettings(); - addressSetting.setAutoCreateJmsQueues(false); - - server.getAddressSettingsRepository().addMatch("foo", addressSetting); - connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("foo"); try { session.createProducer(queue); + fail("Should have thrown an exception creating a producer here"); } catch (JMSException expected) { } session.close(); @@ -459,7 +462,8 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { @Test public void testAutoDestinationCreationOnProducerSend() throws JMSException { AddressSettings addressSetting = new AddressSettings(); - addressSetting.setAutoCreateJmsQueues(true); + addressSetting.setAutoCreateQueues(true); + addressSetting.setAutoCreateAddresses(true); String address = "foo"; server.getAddressSettingsRepository().addMatch(address, addressSetting); @@ -481,7 +485,8 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { @Test public void testAutoDestinationCreationOnConsumer() throws JMSException { AddressSettings addressSetting = new AddressSettings(); - addressSetting.setAutoCreateJmsQueues(true); + addressSetting.setAutoCreateQueues(true); + addressSetting.setAutoCreateAddresses(true); String address = "foo"; server.getAddressSettingsRepository().addMatch(address, addressSetting); @@ -504,7 +509,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { @Test public void testAutoDestinationNoCreationOnConsumer() throws JMSException { AddressSettings addressSetting = new AddressSettings(); - addressSetting.setAutoCreateJmsQueues(false); + addressSetting.setAutoCreateQueues(false); String address = "foo"; server.getAddressSettingsRepository().addMatch(address, addressSetting); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RolesConfigurationStorageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RolesConfigurationStorageTest.java index 8f15998c80..b525e9d8e0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RolesConfigurationStorageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RolesConfigurationStorageTest.java @@ -50,9 +50,9 @@ public class RolesConfigurationStorageTest extends StorageManagerTestBase { public void testStoreSecuritySettings() throws Exception { createStorage(); - addSetting(new PersistedRoles("a#", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1")); + addSetting(new PersistedRoles("a#", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1")); - addSetting(new PersistedRoles("a2", "a1", null, "a1", "a1", "a1", "a1", "a1", "a1", "a1")); + addSetting(new PersistedRoles("a2", "a1", null, "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1")); journal.stop(); @@ -62,9 +62,9 @@ public class RolesConfigurationStorageTest extends StorageManagerTestBase { checkSettings(); - addSetting(new PersistedRoles("a2", "a1", null, "a1", "a1", "a1", "a1", "a1", "a1", "a1")); + addSetting(new PersistedRoles("a2", "a1", null, "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1")); - addSetting(new PersistedRoles("a3", "a1", null, "a1", "a1", "a1", "a1", "a1", "a1", "a1")); + addSetting(new PersistedRoles("a3", "a1", null, "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1")); checkSettings(); @@ -92,7 +92,7 @@ public class RolesConfigurationStorageTest extends StorageManagerTestBase { checkSettings(); - addSetting(new PersistedRoles("a#", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1")); + addSetting(new PersistedRoles("a#", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1", "a1")); journal.stop(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java index c25d3db479..143ec27a43 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java @@ -67,7 +67,7 @@ public class ActiveMQMessageHandlerSecurityTest extends ActiveMQRATestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("testuser", "testpassword"); securityManager.getConfiguration().addRole("testuser", "arole"); - Role role = new Role("arole", false, true, false, false, false, false, false, false, false); + Role role = new Role("arole", false, true, false, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java index 895ebbe686..6956499e5b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java @@ -57,7 +57,7 @@ public class JMSContextTest extends ActiveMQRATestBase { securityManager.getConfiguration().setDefaultUser("guest"); securityManager.getConfiguration().addRole("testuser", "arole"); securityManager.getConfiguration().addRole("guest", "arole"); - Role role = new Role("arole", true, true, true, true, true, true, true, true, true); + Role role = new Role("arole", true, true, true, true, true, true, true, true, true, true); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java index a96c00eb8b..feed83c97c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java @@ -82,7 +82,7 @@ public class OutgoingConnectionTest extends ActiveMQRATestBase { securityManager.getConfiguration().setDefaultUser("guest"); securityManager.getConfiguration().addRole("testuser", "arole"); securityManager.getConfiguration().addRole("guest", "arole"); - Role role = new Role("arole", true, true, true, true, true, true, true, true, true); + Role role = new Role("arole", true, true, true, true, true, true, true, true, true, true); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java index c85140dc02..ab32ad3b2e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java @@ -71,7 +71,7 @@ public class OutgoingConnectionTestJTA extends ActiveMQRATestBase { ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("testuser", "arole"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "arole"); - Role role = new Role("arole", true, true, true, true, true, true, true, true, true); + Role role = new Role("arole", true, true, true, true, true, true, true, true, true, true); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java index 5bfdc622e9..caacdd078f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java @@ -174,7 +174,7 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); Set roles = new HashSet<>(); - roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false)); + roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false, false)); server.getConfiguration().putSecurityRoles("#", roles); server.start(); server.createQueue(ADDRESS, DURABLE_QUEUE, null, true, false); @@ -260,7 +260,7 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); Set roles = new HashSet<>(); - roles.add(new Role("admins", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("admins", true, true, true, true, true, true, true, true, true, true)); server.getConfiguration().putSecurityRoles("#", roles); server.start(); 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 d08afed28f..2829d80412 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 @@ -224,7 +224,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); Set roles = new HashSet<>(); - roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false)); + roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false, false)); server.getConfiguration().putSecurityRoles("#", roles); server.start(); server.createQueue(ADDRESS, DURABLE_QUEUE, null, true, false); @@ -309,10 +309,10 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); Set aRoles = new HashSet<>(); - aRoles.add(new Role(QUEUE_A.toString(), false, true, false, false, false, false, false, false, false)); + aRoles.add(new Role(QUEUE_A.toString(), false, true, false, false, false, false, false, false, false, false)); server.getConfiguration().putSecurityRoles(ADDRESS.concat(".").concat(QUEUE_A).toString(), aRoles); Set bRoles = new HashSet<>(); - bRoles.add(new Role(QUEUE_B.toString(), false, true, false, false, false, false, false, false, false)); + bRoles.add(new Role(QUEUE_B.toString(), false, true, false, false, false, false, false, false, false, false)); server.getConfiguration().putSecurityRoles(ADDRESS.concat(".").concat(QUEUE_B).toString(), bRoles); server.start(); server.createQueue(ADDRESS, QUEUE_A, null, true, false); @@ -375,7 +375,7 @@ public class SecurityTest extends ActiveMQTestBase { server.getConfiguration().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params)); Set roles = new HashSet<>(); - roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false)); + roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false, false)); server.getConfiguration().putSecurityRoles("#", roles); server.start(); @@ -470,7 +470,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); Set roles = new HashSet<>(); - roles.add(new Role("programmers", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("programmers", true, true, true, true, true, true, true, true, true, true)); server.getConfiguration().putSecurityRoles("#", roles); server.start(); @@ -558,7 +558,7 @@ public class SecurityTest extends ActiveMQTestBase { server.getConfiguration().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params)); Set roles = new HashSet<>(); - roles.add(new Role("programmers", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("programmers", true, true, true, true, true, true, true, true, true, true)); server.getConfiguration().putSecurityRoles("#", roles); server.start(); @@ -642,7 +642,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("GuestLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); Set roles = new HashSet<>(); - roles.add(new Role("bar", true, true, true, true, true, true, true, false, true)); + roles.add(new Role("bar", true, true, true, true, true, true, true, false, true, true)); server.getConfiguration().putSecurityRoles("#", roles); server.start(); @@ -789,7 +789,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, false, false, false, false, false, false); + Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -808,7 +808,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, false, false, false, false, false); + Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -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); + Role role = new Role("arole", false, false, true, true, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -852,7 +852,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, false, false, false, false, false, false); + Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -879,7 +879,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, false, false, false, false); + Role role = new Role("arole", false, false, false, false, true, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -898,7 +898,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, false, false, false, false, false); + Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); 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); + Role role = new Role("arole", false, false, false, false, true, true, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -942,7 +942,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, false, false, false, false); + Role role = new Role("arole", false, false, false, false, true, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -973,7 +973,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addUser("auser", "pass"); - Role role = new Role("arole", true, true, true, false, false, false, false, false, false); + Role role = new Role("arole", true, true, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); @@ -1005,7 +1005,7 @@ public class SecurityTest extends ActiveMQTestBase { receivedMessage.acknowledge(); - role = new Role("arole", false, false, true, false, false, false, false, false, false); + role = new Role("arole", false, false, true, false, false, false, false, false, false, false); roles = new HashSet<>(); @@ -1032,7 +1032,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, false, false, false, false, false, false); + Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -1060,7 +1060,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, false, false, false, false, false, false); + Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -1086,8 +1086,8 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addUser("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().setDefaultUser("guest"); - Role role = new Role("arole", false, true, false, false, false, false, false, false, false); - Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false); + Role role = new Role("arole", false, true, false, false, false, false, false, false, false, false); + Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); @@ -1114,8 +1114,8 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addUser("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().setDefaultUser("guest"); - Role role = new Role("arole", false, false, false, false, false, false, false, false, false); - Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false); + Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); + Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); @@ -1149,9 +1149,9 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addUser("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().setDefaultUser("guest"); - Role role = new Role("arole", false, false, false, false, false, false, false, false, false); - Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false); - Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false); + Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); + Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); + Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); @@ -1198,9 +1198,9 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addUser("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().setDefaultUser("guest"); - Role role = new Role("arole", false, false, false, false, false, false, false, false, false); - Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false); - Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false); + Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); + Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); + Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); @@ -1254,11 +1254,11 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addUser("guest", "guest"); securityManager.getConfiguration().addRole("guest", "guest"); securityManager.getConfiguration().setDefaultUser("guest"); - Role role = new Role("arole", false, false, false, false, false, false, false, false, false); + Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false); System.out.println("guest:" + role); - Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false); + Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false); System.out.println("guest:" + sendRole); - Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false); + Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false); System.out.println("guest:" + receiveRole); Set roles = new HashSet<>(); roles.add(sendRole); @@ -1339,7 +1339,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, false, false, true, false, false); + Role role = new Role("arole", false, false, false, false, false, false, true, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(configuration.getManagementAddress().toString(), roles); @@ -1360,7 +1360,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, false, false, false, false, false, false); + Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(configuration.getManagementAddress().toString(), roles); @@ -1389,7 +1389,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, false, false, false, false, false, false); + Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(configuration.getManagementAddress().toString(), roles); @@ -1425,23 +1425,23 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("frank", "user"); securityManager.getConfiguration().addRole("sam", "news-user"); securityManager.getConfiguration().addRole("sam", "user"); - Role all = new Role("all", true, true, true, true, true, true, true, true, true); + Role all = new Role("all", true, true, true, true, true, true, true, true, true, true); HierarchicalRepository> repository = server.getSecurityRepository(); Set add = new HashSet<>(); - add.add(new Role("user", true, true, true, true, true, true, false, true, true)); + add.add(new Role("user", true, true, true, true, true, true, false, true, true, true)); add.add(all); repository.addMatch("#", add); Set add1 = new HashSet<>(); add1.add(all); - add1.add(new Role("user", false, false, true, true, true, true, false, true, true)); - add1.add(new Role("europe-user", true, false, false, false, false, false, false, true, true)); - add1.add(new Role("news-user", false, true, false, false, false, false, false, true, true)); + add1.add(new Role("user", false, false, true, true, true, true, false, true, true, true)); + add1.add(new Role("europe-user", true, false, false, false, false, false, false, true, true, true)); + add1.add(new Role("news-user", false, true, false, false, false, false, false, true, true, true)); repository.addMatch("news.europe.#", add1); Set add2 = new HashSet<>(); add2.add(all); - add2.add(new Role("user", false, false, true, true, true, true, false, true, true)); - add2.add(new Role("us-user", true, false, false, false, false, false, false, true, true)); - add2.add(new Role("news-user", false, true, false, false, false, false, false, true, true)); + add2.add(new Role("user", false, false, true, true, true, true, false, true, true, true)); + add2.add(new Role("us-user", true, false, false, false, false, false, false, true, true, true)); + add2.add(new Role("news-user", false, true, false, false, false, false, false, true, true, true)); repository.addMatch("news.us.#", add2); ClientSession billConnection = null; ClientSession andrewConnection = null; @@ -1552,23 +1552,23 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("frank", "user"); securityManager.getConfiguration().addRole("sam", "news-user"); securityManager.getConfiguration().addRole("sam", "user"); - Role all = new Role("all", true, true, true, true, true, true, true, true, true); + Role all = new Role("all", true, true, true, true, true, true, true, true, true, true); HierarchicalRepository> repository = server.getSecurityRepository(); Set add = new HashSet<>(); - add.add(new Role("user", true, true, true, true, true, true, false, true, true)); + add.add(new Role("user", true, true, true, true, true, true, false, true, true, true)); add.add(all); repository.addMatch("#", add); Set add1 = new HashSet<>(); add1.add(all); - add1.add(new Role("user", false, false, true, true, true, true, false, true, true)); - add1.add(new Role("europe-user", true, false, false, false, false, false, false, true, true)); - add1.add(new Role("news-user", false, true, false, false, false, false, false, true, true)); + add1.add(new Role("user", false, false, true, true, true, true, false, true, true, true)); + add1.add(new Role("europe-user", true, false, false, false, false, false, false, true, true, true)); + add1.add(new Role("news-user", false, true, false, false, false, false, false, true, true, true)); repository.addMatch("news.europe.#", add1); Set add2 = new HashSet<>(); add2.add(all); - add2.add(new Role("user", false, false, true, true, true, true, false, true, true)); - add2.add(new Role("us-user", true, false, false, false, false, false, false, true, true)); - add2.add(new Role("news-user", false, true, false, false, false, false, false, true, true)); + add2.add(new Role("user", false, false, true, true, true, true, false, true, true, true)); + add2.add(new Role("us-user", true, false, false, false, false, false, false, true, true, true)); + add2.add(new Role("news-user", false, true, false, false, false, false, false, true, true, true)); repository.addMatch("news.us.#", add2); ClientSession billConnection = null; ClientSession andrewConnection = null; 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 b6ebc122e8..a672bb1334 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 @@ -59,7 +59,7 @@ public class ResourceLimitTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("myUser", "password"); securityManager.getConfiguration().addRole("myUser", "arole"); - Role role = new Role("arole", false, false, false, false, true, true, false, true, false); + Role role = new Role("arole", false, false, false, false, true, true, false, true, false, false); Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch("#", roles); 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 6529d9b0fa..6716e458a2 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 @@ -128,8 +128,8 @@ public class DualAuthenticationTest extends ActiveMQTestBase { server = addServer(ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager, false)); HierarchicalRepository> securityRepository = server.getSecurityRepository(); - Role sendRole = new Role("producers", true, false, true, false, true, false, false, false, false); - Role receiveRole = new Role("consumers", false, true, false, false, false, false, false, false, false); + Role sendRole = new Role("producers", true, false, true, false, true, false, false, false, false, false); + Role receiveRole = new Role("consumers", false, true, false, false, false, false, false, false, false, false); Set roles = new HashSet<>(); roles.add(sendRole); roles.add(receiveRole); 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 e7dcc91198..f1def686f0 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 @@ -31,6 +31,7 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -38,6 +39,8 @@ import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; +import org.apache.activemq.artemis.api.core.management.ManagementHelper; +import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.artemis.core.protocol.stomp.Stomp; @@ -1406,4 +1409,59 @@ public class StompTest extends StompTestBase { frame = conn.sendFrame(frame); assertEquals(Stomp.Responses.ERROR, frame.getCommand()); } + + @Test + public void testGetManagementAttributeFromStomp() throws Exception { + conn.connect(defUser, defPass); + + subscribe(conn, null); + + ClientStompFrame frame = conn.createFrame(Stomp.Commands.SEND) + .addHeader(Stomp.Headers.Send.DESTINATION, ActiveMQDefaultConfiguration.getDefaultManagementAddress().toString()) + .addHeader(Stomp.Headers.Send.REPLY_TO, getQueuePrefix() + getQueueName()) + .addHeader(ManagementHelper.HDR_RESOURCE_NAME.toString(), ResourceNames.QUEUE + getQueuePrefix() + getQueueName()) + .addHeader(ManagementHelper.HDR_ATTRIBUTE.toString(), "Address"); + + conn.sendFrame(frame); + + frame = conn.receiveFrame(10000); + + IntegrationTestLogger.LOGGER.info("Received: " + frame); + + Assert.assertEquals(Boolean.TRUE.toString(), frame.getHeader(ManagementHelper.HDR_OPERATION_SUCCEEDED.toString())); + // the address will be returned in the message body in a JSON array + Assert.assertEquals("[\"" + getQueuePrefix() + getQueueName() + "\"]", frame.getBody()); + + unsubscribe(conn, null); + + conn.disconnect(); + } + + @Test + public void testInvokeOperationFromStomp() throws Exception { + conn.connect(defUser, defPass); + + subscribe(conn, null); + + ClientStompFrame frame = conn.createFrame(Stomp.Commands.SEND) + .addHeader(Stomp.Headers.Send.DESTINATION, ActiveMQDefaultConfiguration.getDefaultManagementAddress().toString()) + .addHeader(Stomp.Headers.Send.REPLY_TO, getQueuePrefix() + getQueueName()) + .addHeader(ManagementHelper.HDR_RESOURCE_NAME.toString(), ResourceNames.QUEUE + getQueuePrefix() + getQueueName()) + .addHeader(ManagementHelper.HDR_OPERATION_NAME.toString(), "countMessages") + .setBody("[\"color = 'blue'\"]"); + + conn.sendFrame(frame); + + frame = conn.receiveFrame(10000); + + IntegrationTestLogger.LOGGER.info("Received: " + frame); + + Assert.assertEquals(Boolean.TRUE.toString(), frame.getHeader(ManagementHelper.HDR_OPERATION_SUCCEEDED.toString())); + // there is no such messages => 0 returned in a JSON array + Assert.assertEquals("[0]", frame.getBody()); + + unsubscribe(conn, null); + + conn.disconnect(); + } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java index bcac436daf..2cde849146 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java @@ -177,7 +177,7 @@ public abstract class StompTestBase extends ActiveMQTestBase { securityManager.getConfiguration().addRole(defUser, role); config.getSecurityRoles().put("#", new HashSet() { { - add(new Role(role, true, true, true, true, true, true, true, true, true)); + add(new Role(role, true, true, true, true, true, true, true, true, true, true)); } }); } @@ -314,20 +314,20 @@ public abstract class StompTestBase extends ActiveMQTestBase { public ClientStompFrame subscribe(StompClientConnection conn, String subscriptionId) throws IOException, InterruptedException { - return subscribe(conn, subscriptionId, Stomp.Headers.Subscribe.AckModeValues.AUTO, null, null); + return subscribe(conn, subscriptionId, Stomp.Headers.Subscribe.AckModeValues.AUTO); } public ClientStompFrame subscribe(StompClientConnection conn, String subscriptionId, String ack) throws IOException, InterruptedException { - return subscribe(conn, subscriptionId, ack, null, null); + return subscribe(conn, subscriptionId, ack, null); } public ClientStompFrame subscribe(StompClientConnection conn, String subscriptionId, String ack, String durableId) throws IOException, InterruptedException { - return subscribe(conn, subscriptionId, ack, durableId, null); + return subscribe(conn, subscriptionId, ack, durableId, false); } public ClientStompFrame subscribe(StompClientConnection conn, 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 9b1ad934d4..09fb0ba308 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 @@ -354,7 +354,8 @@ public class StompV12Test extends StompTestBase { @Test public void testHeaderRepetitive() throws Exception { AddressSettings addressSettings = new AddressSettings(); - addressSettings.setAutoCreateJmsQueues(false); + addressSettings.setAutoCreateQueues(false); + addressSettings.setAutoCreateAddresses(false); server.getActiveMQServer().getAddressSettingsRepository().addMatch("#", addressSettings); conn.connect(defUser, defPass); @@ -378,7 +379,7 @@ public class StompV12Test extends StompTestBase { //subscribe StompClientConnection newConn = StompClientConnectionFactory.createClientConnection("1.2", hostname, port); newConn.connect(defUser, defPass); - subscribe(newConn, "a-sub"); + subscribe(newConn, "a-sub", null, null, true); frame = newConn.receiveFrame(); @@ -389,7 +390,7 @@ public class StompV12Test extends StompTestBase { Assert.assertEquals("value1", frame.getHeader("foo")); //unsub - unsubscribe(newConn, "a-sub"); + unsubscribe(newConn, "a-sub", true); newConn.disconnect(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSClusteredTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSClusteredTestBase.java index 30fdfd4807..ac52d0266f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSClusteredTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSClusteredTestBase.java @@ -175,8 +175,6 @@ public class JMSClusteredTestBase extends ActiveMQTestBase { .addConnectorConfiguration(destinationLabel, new TransportConfiguration(InVMConnectorFactory.class.getName(), generateInVMParams(destination))) .addConnectorConfiguration(sourceLabel, new TransportConfiguration(InVMConnectorFactory.class.getName(), generateInVMParams(source))) .addClusterConfiguration(new ClusterConnectionConfiguration().setName(destinationLabel) - // TODO should this be changed? - .setAddress("jms") .setConnectorName(sourceLabel) .setRetryInterval(250) .setMaxHops(MAX_HOPS) diff --git a/tests/integration-tests/src/test/resources/reload-test-jms.xml b/tests/integration-tests/src/test/resources/reload-test-jms.xml index e914942095..5ff71843f3 100644 --- a/tests/integration-tests/src/test/resources/reload-test-jms.xml +++ b/tests/integration-tests/src/test/resources/reload-test-jms.xml @@ -99,7 +99,7 @@ under the License. - false + false DLQ ExpiryQueue 0 diff --git a/tests/integration-tests/src/test/resources/reload-test-updated-jms.xml b/tests/integration-tests/src/test/resources/reload-test-updated-jms.xml index 5195fed4c5..1a67013374 100644 --- a/tests/integration-tests/src/test/resources/reload-test-updated-jms.xml +++ b/tests/integration-tests/src/test/resources/reload-test-updated-jms.xml @@ -109,7 +109,7 @@ under the License. - false + false NewQueue NewQueue 0 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 fc97cd4d80..d001f5bcca 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 @@ -339,8 +339,8 @@ public class MessageProducerTest extends JMSTestCase { @Test public void testCreateProducerOnInexistentDestination() throws Exception { - getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsQueues(false)); - getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsTopics(false)); + getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); + getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false)); Connection pconn = createConnection(); try { Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SessionTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SessionTest.java index 1ff79d0b35..c2e700aa00 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SessionTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SessionTest.java @@ -104,7 +104,7 @@ public class SessionTest extends ActiveMQServerTestCase { @Test public void testCreateNonExistentQueue() throws Exception { AddressSettings addressSettings = new AddressSettings(); - addressSettings.setAutoCreateJmsQueues(false); + addressSettings.setAutoCreateQueues(false); getJmsServer().getAddressSettingsRepository().addMatch("#", addressSettings); Connection conn = getConnectionFactory().createConnection(); @@ -134,7 +134,8 @@ public class SessionTest extends ActiveMQServerTestCase { @Test public void testCreateQueueWhileTopicWithSameNameExists() throws Exception { AddressSettings addressSettings = new AddressSettings(); - addressSettings.setAutoCreateJmsQueues(false); + addressSettings.setAutoCreateQueues(false); + addressSettings.setAutoCreateAddresses(false); getJmsServer().getAddressSettingsRepository().addMatch("#", addressSettings); Connection conn = getConnectionFactory().createConnection(); @@ -169,8 +170,8 @@ public class SessionTest extends ActiveMQServerTestCase { @Test public void testCreateNonExistentTopic() throws Exception { - getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsQueues(false)); - getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsTopics(false)); + getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); + getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false)); Connection conn = getConnectionFactory().createConnection(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); try { @@ -198,8 +199,8 @@ public class SessionTest extends ActiveMQServerTestCase { @Test public void testCreateTopicWhileQueueWithSameNameExists() throws Exception { - getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsQueues(false)); - getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateJmsTopics(false)); + getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); + getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false)); Connection conn = getConnectionFactory().createConnection(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); try { 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 f8b7153536..6d70569094 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 @@ -821,18 +821,6 @@ public class MessageHeaderTest extends MessageHeaderTestBase { final boolean durable) throws ActiveMQException { } - public void createQueue(final SimpleString address, - final SimpleString queueName, - final boolean durable, - final boolean temporary) throws ActiveMQException { - } - - public void createQueue(final String address, - final String queueName, - final boolean durable, - final boolean temporary) throws ActiveMQException { - } - @Override public void createQueue(final String address, final String queueName, @@ -840,6 +828,24 @@ public class MessageHeaderTest extends MessageHeaderTestBase { final boolean durable) throws ActiveMQException { } + @Override + public void createQueue(SimpleString address, + SimpleString queueName, + SimpleString filter, + boolean durable, + boolean autoCreated) throws ActiveMQException { + + } + + @Override + public void createQueue(String address, + String queueName, + String filter, + boolean durable, + boolean autoCreated) throws ActiveMQException { + + } + @Override public void createTemporaryQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException { diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java index 7ad6c7602a..6eab31decb 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java @@ -115,6 +115,8 @@ public class TopicSessionTest extends PubSubTestCase { TextMessage m = (TextMessage) subscriber.receive(TestConfig.TIMEOUT); Assert.assertTrue(m != null); Assert.assertEquals("test", m.getText()); + subscriber.close(); + subscriberSession.unsubscribe("testTopic"); } catch (JMSException e) { fail(e); } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/security/impl/ActiveMQSecurityManagerImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/security/impl/ActiveMQSecurityManagerImplTest.java index 0df0e89630..eccdb5f5d5 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/security/impl/ActiveMQSecurityManagerImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/security/impl/ActiveMQSecurityManagerImplTest.java @@ -59,22 +59,22 @@ public class ActiveMQSecurityManagerImplTest extends ActiveMQTestBase { Assert.assertTrue(securityManager.validateUser("guest", "password")); Assert.assertFalse(securityManager.validateUser(null, "wrongpass")); HashSet roles = new HashSet<>(); - roles.add(new Role("guest", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("guest", true, true, true, true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME)); roles = new HashSet<>(); - roles.add(new Role("guest", true, true, false, true, true, true, true, true, true)); + roles.add(new Role("guest", true, true, false, true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME)); roles = new HashSet<>(); - roles.add(new Role("guest", true, false, false, true, true, true, true, true, true)); + roles.add(new Role("guest", true, false, false, true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME)); roles = new HashSet<>(); - roles.add(new Role("guest", false, false, false, true, true, true, true, true, true)); + roles.add(new Role("guest", false, false, false, true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME)); @@ -124,19 +124,19 @@ public class ActiveMQSecurityManagerImplTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("newuser1", "role3"); securityManager.getConfiguration().addRole("newuser1", "role4"); HashSet roles = new HashSet<>(); - roles.add(new Role("role1", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role1", true, true, true, true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); roles = new HashSet<>(); - roles.add(new Role("role2", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role2", true, true, true, true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); roles = new HashSet<>(); - roles.add(new Role("role3", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role3", true, true, true, true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); roles = new HashSet<>(); - roles.add(new Role("role4", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role4", true, true, true, true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); roles = new HashSet<>(); - roles.add(new Role("role5", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role5", true, true, true, true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); } @@ -150,19 +150,19 @@ public class ActiveMQSecurityManagerImplTest extends ActiveMQTestBase { securityManager.getConfiguration().removeRole("newuser1", "role2"); securityManager.getConfiguration().removeRole("newuser1", "role4"); HashSet roles = new HashSet<>(); - roles.add(new Role("role1", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role1", true, true, true, true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); roles = new HashSet<>(); - roles.add(new Role("role2", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role2", true, true, true, true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); roles = new HashSet<>(); - roles.add(new Role("role3", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role3", true, true, true, true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); roles = new HashSet<>(); - roles.add(new Role("role4", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role4", true, true, true, true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); roles = new HashSet<>(); - roles.add(new Role("role5", true, true, true, true, true, true, true, true, true)); + roles.add(new Role("role5", true, true, true, true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); } }