activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-1797 Auto-create-address flag shouldn't avoid temp destination creation
Date Tue, 10 Apr 2018 17:38:49 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8d4bf953f -> fa3e37fdb


ARTEMIS-1797 Auto-create-address flag shouldn't avoid temp destination creation

When creating a temp destination and auto-create-address set to false, the
broker throws an error and refuse to create it. This doesn't conform to
normal use-case (like amqp dynamic flag) where the temp destination should
be allowed even if the auto-create-address is false.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/1175d777
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/1175d777
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/1175d777

Branch: refs/heads/master
Commit: 1175d777b3ce20606ac63548a934ad245a9eb666
Parents: 8d4bf95
Author: Howard Gao <howard.gao@gmail.com>
Authored: Tue Apr 10 15:26:27 2018 +0800
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue Apr 10 13:38:27 2018 -0400

----------------------------------------------------------------------
 .../core/server/impl/ActiveMQServerImpl.java    |  2 +-
 .../integration/amqp/AmqpClientTestSupport.java | 55 +++++++++++++++++++-
 .../amqp/AmqpTempDestinationTest.java           | 47 -----------------
 .../amqp/AmqpTempDestinationTest2.java          | 25 +++++++++
 4 files changed, 80 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1175d777/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 96076cf..050a776 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
@@ -2752,7 +2752,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
 
       RoutingType routingType = addrInfo == null ? null : addrInfo.getRoutingType();
       RoutingType rt = (routingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType()
: routingType);
-      if (autoCreateAddress) {
+      if (autoCreateAddress || temporary) {
          if (info == null) {
             final AddressInfo addressInfo = new AddressInfo(addressToUse, rt);
             addressInfo.setAutoCreated(true);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1175d777/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpClientTestSupport.java
----------------------------------------------------------------------
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 991f467..d7cf3f4 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
@@ -44,9 +44,18 @@ import org.apache.activemq.transport.amqp.client.AmqpMessage;
 import org.apache.activemq.transport.amqp.client.AmqpSender;
 import org.apache.activemq.transport.amqp.client.AmqpSession;
 import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.messaging.DeleteOnClose;
+import org.apache.qpid.proton.amqp.messaging.Source;
+import org.apache.qpid.proton.amqp.messaging.Target;
+import org.apache.qpid.proton.amqp.messaging.TerminusDurability;
+import org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy;
 import org.junit.After;
 import org.junit.Before;
 
+import static org.apache.activemq.transport.amqp.AmqpSupport.LIFETIME_POLICY;
+import static org.apache.activemq.transport.amqp.AmqpSupport.TEMP_QUEUE_CAPABILITY;
+import static org.apache.activemq.transport.amqp.AmqpSupport.TEMP_TOPIC_CAPABILITY;
+
 /**
  * Test support class for tests that will be using the AMQP Proton wrapper client. This is
to
  * make it easier to migrate tests from ActiveMQ5
@@ -201,7 +210,7 @@ public class AmqpClientTestSupport extends AmqpTestSupport {
 
       addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
       addressSettings.setAutoCreateQueues(isAutoCreateQueues());
-      addressSettings.setAutoCreateAddresses(isAutoCreateQueues());
+      addressSettings.setAutoCreateAddresses(isAutoCreateAddresses());
       addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress()));
       addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress()));
 
@@ -345,4 +354,48 @@ public class AmqpClientTestSupport extends AmqpTestSupport {
          connection.close();
       }
    }
+
+   protected Source createDynamicSource(boolean topic) {
+
+      Source source = new Source();
+      source.setDynamic(true);
+      source.setDurable(TerminusDurability.NONE);
+      source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
+
+      // Set the dynamic node lifetime-policy
+      Map<Symbol, Object> dynamicNodeProperties = new HashMap<>();
+      dynamicNodeProperties.put(LIFETIME_POLICY, DeleteOnClose.getInstance());
+      source.setDynamicNodeProperties(dynamicNodeProperties);
+
+      // Set the capability to indicate the node type being created
+      if (!topic) {
+         source.setCapabilities(TEMP_QUEUE_CAPABILITY);
+      } else {
+         source.setCapabilities(TEMP_TOPIC_CAPABILITY);
+      }
+
+      return source;
+   }
+
+   protected Target createDynamicTarget(boolean topic) {
+
+      Target target = new Target();
+      target.setDynamic(true);
+      target.setDurable(TerminusDurability.NONE);
+      target.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
+
+      // Set the dynamic node lifetime-policy
+      Map<Symbol, Object> dynamicNodeProperties = new HashMap<>();
+      dynamicNodeProperties.put(LIFETIME_POLICY, DeleteOnClose.getInstance());
+      target.setDynamicNodeProperties(dynamicNodeProperties);
+
+      // Set the capability to indicate the node type being created
+      if (!topic) {
+         target.setCapabilities(TEMP_QUEUE_CAPABILITY);
+      } else {
+         target.setCapabilities(TEMP_TOPIC_CAPABILITY);
+      }
+
+      return target;
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1175d777/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest.java
index 4dbe21e..07c81f9 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest.java
@@ -17,10 +17,7 @@
 package org.apache.activemq.artemis.tests.integration.amqp;
 
 import static org.apache.activemq.transport.amqp.AmqpSupport.LIFETIME_POLICY;
-import static org.apache.activemq.transport.amqp.AmqpSupport.TEMP_QUEUE_CAPABILITY;
-import static org.apache.activemq.transport.amqp.AmqpSupport.TEMP_TOPIC_CAPABILITY;
 
-import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
@@ -282,48 +279,4 @@ public class AmqpTempDestinationTest extends AmqpClientTestSupport {
 
       connection.close();
    }
-
-   protected Source createDynamicSource(boolean topic) {
-
-      Source source = new Source();
-      source.setDynamic(true);
-      source.setDurable(TerminusDurability.NONE);
-      source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
-
-      // Set the dynamic node lifetime-policy
-      Map<Symbol, Object> dynamicNodeProperties = new HashMap<>();
-      dynamicNodeProperties.put(LIFETIME_POLICY, DeleteOnClose.getInstance());
-      source.setDynamicNodeProperties(dynamicNodeProperties);
-
-      // Set the capability to indicate the node type being created
-      if (!topic) {
-         source.setCapabilities(TEMP_QUEUE_CAPABILITY);
-      } else {
-         source.setCapabilities(TEMP_TOPIC_CAPABILITY);
-      }
-
-      return source;
-   }
-
-   protected Target createDynamicTarget(boolean topic) {
-
-      Target target = new Target();
-      target.setDynamic(true);
-      target.setDurable(TerminusDurability.NONE);
-      target.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
-
-      // Set the dynamic node lifetime-policy
-      Map<Symbol, Object> dynamicNodeProperties = new HashMap<>();
-      dynamicNodeProperties.put(LIFETIME_POLICY, DeleteOnClose.getInstance());
-      target.setDynamicNodeProperties(dynamicNodeProperties);
-
-      // Set the capability to indicate the node type being created
-      if (!topic) {
-         target.setCapabilities(TEMP_QUEUE_CAPABILITY);
-      } else {
-         target.setCapabilities(TEMP_TOPIC_CAPABILITY);
-      }
-
-      return target;
-   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1175d777/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest2.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest2.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest2.java
new file mode 100644
index 0000000..23079f4
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTempDestinationTest2.java
@@ -0,0 +1,25 @@
+/*
+ * 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.amqp;
+
+public class AmqpTempDestinationTest2 extends AmqpTempDestinationTest {
+
+   @Override
+   protected boolean isAutoCreateAddresses() {
+      return false;
+   }
+}


Mime
View raw message