You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/12/15 22:56:40 UTC
[1/3] activemq-artemis git commit: This closes #927
Repository: activemq-artemis
Updated Branches:
refs/heads/master ce4f9b5ff -> db6ee74a3
This closes #927
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/db6ee74a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/db6ee74a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/db6ee74a
Branch: refs/heads/master
Commit: db6ee74a3329197fd1382708af7bcae44282bbc5
Parents: ce4f9b5 49f1c99
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Dec 15 17:53:50 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Dec 15 17:53:50 2016 -0500
----------------------------------------------------------------------
.../config/ActiveMQDefaultConfiguration.java | 3 +-
.../server/DivertConfigurationRoutingType.java | 57 +++++++++++++++++
.../artemis/core/server/RoutingType.java | 10 +--
.../core/config/DivertConfiguration.java | 8 +--
.../artemis/core/config/impl/Validators.java | 9 +--
.../deployers/impl/FileConfigurationParser.java | 3 +-
.../impl/ActiveMQServerControlImpl.java | 3 +-
.../core/server/impl/ActiveMQServerImpl.java | 18 +++++-
.../artemis/core/server/impl/DivertImpl.java | 5 +-
.../client/AutoDeleteAddressTest.java | 66 ++++++++++++++++++++
.../integration/client/AutoDeleteQueueTest.java | 66 ++++++++++++++++++++
11 files changed, 223 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
[2/3] activemq-artemis git commit: NO-JIRA move divert specific
routing types
Posted by cl...@apache.org.
NO-JIRA move divert specific routing types
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/49f1c993
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/49f1c993
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/49f1c993
Branch: refs/heads/master
Commit: 49f1c9935c9892f1ba999558e6c887e31ce3aed1
Parents: 6cb6e95
Author: jbertram <jb...@apache.org>
Authored: Thu Dec 15 15:40:47 2016 -0600
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Dec 15 17:53:50 2016 -0500
----------------------------------------------------------------------
.../config/ActiveMQDefaultConfiguration.java | 3 +-
.../server/DivertConfigurationRoutingType.java | 57 ++++++++++++++++++++
.../artemis/core/server/RoutingType.java | 10 +---
.../core/config/DivertConfiguration.java | 8 +--
.../artemis/core/config/impl/Validators.java | 9 ++--
.../deployers/impl/FileConfigurationParser.java | 3 +-
.../impl/ActiveMQServerControlImpl.java | 3 +-
.../artemis/core/server/impl/DivertImpl.java | 5 +-
8 files changed, 76 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/49f1c993/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
----------------------------------------------------------------------
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 2af3a79..c216d30 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
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.api.config;
import org.apache.activemq.artemis.ArtemisConstants;
import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
import org.apache.activemq.artemis.core.server.RoutingType;
/**
@@ -361,7 +362,7 @@ public final class ActiveMQDefaultConfiguration {
private static boolean DEFAULT_DIVERT_EXCLUSIVE = false;
// how the divert should handle the message's routing type
- private static String DEFAULT_DIVERT_ROUTING_TYPE = RoutingType.STRIP.toString();
+ private static String DEFAULT_DIVERT_ROUTING_TYPE = DivertConfigurationRoutingType.STRIP.toString();
// If true then the server will request a backup on another node
private static boolean DEFAULT_HAPOLICY_REQUEST_BACKUP = false;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/49f1c993/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/DivertConfigurationRoutingType.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/DivertConfigurationRoutingType.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/DivertConfigurationRoutingType.java
new file mode 100644
index 0000000..84f45f9
--- /dev/null
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/DivertConfigurationRoutingType.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.core.server;
+
+/**
+ * This class essentially mirrors {@code RoutingType} except it has some additional members to support special
+ * configuration semantics for diverts. These additional members weren't put in {@code RoutingType} so as to not
+ * confuse users.
+ */
+public enum DivertConfigurationRoutingType {
+
+ MULTICAST, ANYCAST, STRIP, PASS;
+
+ public byte getType() {
+ switch (this) {
+ case MULTICAST:
+ return 0;
+ case ANYCAST:
+ return 1;
+ case STRIP:
+ return 2;
+ case PASS:
+ return 3;
+ default:
+ return -1;
+ }
+ }
+
+ public static DivertConfigurationRoutingType getType(byte type) {
+ switch (type) {
+ case 0:
+ return MULTICAST;
+ case 1:
+ return ANYCAST;
+ case 2:
+ return STRIP;
+ case 3:
+ return PASS;
+ default:
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/49f1c993/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/RoutingType.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/RoutingType.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/RoutingType.java
index c9b1d09..2f17335 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/RoutingType.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/RoutingType.java
@@ -18,7 +18,7 @@ package org.apache.activemq.artemis.core.server;
public enum RoutingType {
- MULTICAST, ANYCAST, STRIP, PASS;
+ MULTICAST, ANYCAST;
public byte getType() {
switch (this) {
@@ -26,10 +26,6 @@ public enum RoutingType {
return 0;
case ANYCAST:
return 1;
- case STRIP:
- return 2;
- case PASS:
- return 3;
default:
return -1;
}
@@ -41,10 +37,6 @@ public enum RoutingType {
return MULTICAST;
case 1:
return ANYCAST;
- case 2:
- return STRIP;
- case 3:
- return PASS;
default:
return null;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/49f1c993/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java
index 5326c72..2baef0d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/DivertConfiguration.java
@@ -19,7 +19,7 @@ package org.apache.activemq.artemis.core.config;
import java.io.Serializable;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
-import org.apache.activemq.artemis.core.server.RoutingType;
+import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
import org.apache.activemq.artemis.utils.UUIDGenerator;
public class DivertConfiguration implements Serializable {
@@ -40,7 +40,7 @@ public class DivertConfiguration implements Serializable {
private String transformerClassName = null;
- private RoutingType routingType = RoutingType.valueOf(ActiveMQDefaultConfiguration.getDefaultDivertRoutingType());
+ private DivertConfigurationRoutingType routingType = DivertConfigurationRoutingType.valueOf(ActiveMQDefaultConfiguration.getDefaultDivertRoutingType());
public DivertConfiguration() {
}
@@ -73,7 +73,7 @@ public class DivertConfiguration implements Serializable {
return transformerClassName;
}
- public RoutingType getRoutingType() {
+ public DivertConfigurationRoutingType getRoutingType() {
return routingType;
}
@@ -140,7 +140,7 @@ public class DivertConfiguration implements Serializable {
/**
* @param routingType the routingType to set
*/
- public DivertConfiguration setRoutingType(final RoutingType routingType) {
+ public DivertConfiguration setRoutingType(final DivertConfigurationRoutingType routingType) {
this.routingType = routingType;
return this;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/49f1c993/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java
index d87fba3..4d688c8 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java
@@ -17,6 +17,7 @@
package org.apache.activemq.artemis.core.config.impl;
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
+import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.core.server.RoutingType;
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
@@ -180,10 +181,10 @@ public final class Validators {
@Override
public void validate(final String name, final Object value) {
String val = (String) value;
- if (val == null || !val.equals(RoutingType.ANYCAST.toString()) &&
- !val.equals(RoutingType.MULTICAST.toString()) &&
- !val.equals(RoutingType.PASS.toString()) &&
- !val.equals(RoutingType.STRIP.toString())) {
+ if (val == null || !val.equals(DivertConfigurationRoutingType.ANYCAST.toString()) &&
+ !val.equals(DivertConfigurationRoutingType.MULTICAST.toString()) &&
+ !val.equals(DivertConfigurationRoutingType.PASS.toString()) &&
+ !val.equals(DivertConfigurationRoutingType.STRIP.toString())) {
throw ActiveMQMessageBundle.BUNDLE.invalidRoutingType(val);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/49f1c993/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
----------------------------------------------------------------------
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 05f953b..c2176dc 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
@@ -60,6 +60,7 @@ import org.apache.activemq.artemis.core.config.storage.FileStorageConfiguration;
import org.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
+import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
import org.apache.activemq.artemis.core.server.RoutingType;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.core.server.SecuritySettingPlugin;
@@ -1592,7 +1593,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
String transformerClassName = getString(e, "transformer-class-name", null, Validators.NO_CHECK);
- RoutingType routingType = RoutingType.valueOf(getString(e, "routing-type", ActiveMQDefaultConfiguration.getDefaultDivertRoutingType(), Validators.DIVERT_ROUTING_TYPE));
+ DivertConfigurationRoutingType routingType = DivertConfigurationRoutingType.valueOf(getString(e, "routing-type", ActiveMQDefaultConfiguration.getDefaultDivertRoutingType(), Validators.DIVERT_ROUTING_TYPE));
String filterString = null;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/49f1c993/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
----------------------------------------------------------------------
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 c43f509..e5e01d0 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
@@ -79,6 +79,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.ConnectorServiceFactory;
import org.apache.activemq.artemis.core.server.Consumer;
+import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.RoutingType;
@@ -1996,7 +1997,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO();
try {
- DivertConfiguration config = new DivertConfiguration().setName(name).setRoutingName(routingName).setAddress(address).setForwardingAddress(forwardingAddress).setExclusive(exclusive).setFilterString(filterString).setTransformerClassName(transformerClassName).setRoutingType(RoutingType.valueOf(routingType));
+ DivertConfiguration config = new DivertConfiguration().setName(name).setRoutingName(routingName).setAddress(address).setForwardingAddress(forwardingAddress).setExclusive(exclusive).setFilterString(filterString).setTransformerClassName(transformerClassName).setRoutingType(DivertConfigurationRoutingType.valueOf(routingType));
server.deployDivert(config);
} finally {
blockOnIO();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/49f1c993/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java
index 6fe885b..5ea1c0e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java
@@ -22,6 +22,7 @@ import org.apache.activemq.artemis.core.filter.Filter;
import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.postoffice.PostOffice;
import org.apache.activemq.artemis.core.server.Divert;
+import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
import org.apache.activemq.artemis.core.server.RoutingContext;
import org.apache.activemq.artemis.core.server.RoutingType;
import org.apache.activemq.artemis.core.server.ServerMessage;
@@ -51,7 +52,7 @@ public class DivertImpl implements Divert {
private final StorageManager storageManager;
- private final RoutingType routingType;
+ private final DivertConfigurationRoutingType routingType;
public DivertImpl(final SimpleString forwardAddress,
final SimpleString uniqueName,
@@ -61,7 +62,7 @@ public class DivertImpl implements Divert {
final Transformer transformer,
final PostOffice postOffice,
final StorageManager storageManager,
- final RoutingType routingType) {
+ final DivertConfigurationRoutingType routingType) {
this.forwardAddress = forwardAddress;
this.uniqueName = uniqueName;
[3/3] activemq-artemis git commit: ARTEMIS-789 tests/fixes for auto
create/delete
Posted by cl...@apache.org.
ARTEMIS-789 tests/fixes for auto create/delete
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/6cb6e95c
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/6cb6e95c
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/6cb6e95c
Branch: refs/heads/master
Commit: 6cb6e95c9b7fad3d8582d822d576fc9c829b7487
Parents: ce4f9b5
Author: jbertram <jb...@apache.org>
Authored: Thu Dec 15 11:43:02 2016 -0600
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Dec 15 17:53:50 2016 -0500
----------------------------------------------------------------------
.../core/server/impl/ActiveMQServerImpl.java | 18 +++++-
.../client/AutoDeleteAddressTest.java | 66 ++++++++++++++++++++
.../integration/client/AutoDeleteQueueTest.java | 66 ++++++++++++++++++++
3 files changed, 147 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6cb6e95c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
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 76ba050..bfe57e3 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
@@ -1561,9 +1561,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
final boolean temporary,
final boolean autoCreated) throws Exception {
AddressSettings as = getAddressSettingsRepository().getMatch(address.toString());
- return createQueue(address, routingType, queueName, filterString, user, durable, temporary,
+ return createQueue(address, routingType, queueName, filterString, user, durable, temporary, autoCreated,
as.getDefaultMaxConsumers(),
- as.isDefaultDeleteOnNoConsumers(), autoCreated);
+ as.isDefaultDeleteOnNoConsumers(), as.isAutoCreateAddresses());
}
@Override
@@ -1725,7 +1725,19 @@ public class ActiveMQServerImpl implements ActiveMQServer {
final SecurityAuth session,
final boolean checkConsumerCount,
final boolean removeConsumers) throws Exception {
- destroyQueue(queueName, session, checkConsumerCount, removeConsumers, true);
+ if (postOffice == null) {
+ return;
+ }
+
+ Binding binding = postOffice.getBinding(queueName);
+
+ if (binding == null) {
+ throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(queueName);
+ }
+
+ String address = binding.getAddress().toString();
+
+ destroyQueue(queueName, session, checkConsumerCount, removeConsumers, addressSettingsRepository.getMatch(address).isAutoDeleteAddresses());
}
@Override
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6cb6e95c/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteAddressTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteAddressTest.java
new file mode 100644
index 0000000..a66f069
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteAddressTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.client;
+
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.RoutingType;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AutoDeleteAddressTest extends ActiveMQTestBase {
+
+ public final SimpleString addressA = new SimpleString("addressA");
+ public final SimpleString queueA = new SimpleString("queueA");
+
+ private ServerLocator locator;
+ private ActiveMQServer server;
+ private ClientSessionFactory cf;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ locator = createInVMNonHALocator();
+ server = createServer(false);
+
+ server.start();
+ cf = createSessionFactory(locator);
+ }
+
+ @Test
+ public void testAutoDeleteAutoCreatedAddress() throws Exception {
+ // auto-delete-addresses defaults to true
+ server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, true);
+ assertNotNull(server.getAddressInfo(addressA));
+ cf.createSession().createConsumer(queueA).close();
+ assertNull(server.getAddressInfo(addressA));
+ }
+
+ @Test
+ public void testNegativeAutoDeleteAutoCreatedAddress() throws Exception {
+ server.getAddressSettingsRepository().addMatch(addressA.toString(), new AddressSettings().setAutoDeleteAddresses(false));
+ server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, true);
+ assertNotNull(server.getAddressInfo(addressA));
+ cf.createSession().createConsumer(queueA).close();
+ assertNotNull(server.getAddressInfo(addressA));
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6cb6e95c/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteQueueTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteQueueTest.java
new file mode 100644
index 0000000..ad68c58
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteQueueTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.client;
+
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.RoutingType;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AutoDeleteQueueTest extends ActiveMQTestBase {
+
+ public final SimpleString addressA = new SimpleString("addressA");
+ public final SimpleString queueA = new SimpleString("queueA");
+
+ private ServerLocator locator;
+ private ActiveMQServer server;
+ private ClientSessionFactory cf;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ locator = createInVMNonHALocator();
+ server = createServer(false);
+
+ server.start();
+ cf = createSessionFactory(locator);
+ }
+
+ @Test
+ public void testAutoDeleteAutoCreatedQueue() throws Exception {
+ // auto-delete-queues defaults to true
+ server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, true);
+ assertNotNull(server.locateQueue(queueA));
+ cf.createSession().createConsumer(queueA).close();
+ assertNull(server.locateQueue(queueA));
+ }
+
+ @Test
+ public void testNegativeAutoDeleteAutoCreatedQueue() throws Exception {
+ server.getAddressSettingsRepository().addMatch(addressA.toString(), new AddressSettings().setAutoDeleteQueues(false));
+ server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, true);
+ assertNotNull(server.locateQueue(queueA));
+ cf.createSession().createConsumer(queueA).close();
+ assertNotNull(server.locateQueue(queueA));
+ }
+}