You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/11/30 13:27:21 UTC

[01/27] activemq-artemis git commit: Fix StompConnectionCleanupTest

Repository: activemq-artemis
Updated Branches:
  refs/heads/ARTEMIS-780 dad049606 -> df7b552ad


Fix StompConnectionCleanupTest


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

Branch: refs/heads/ARTEMIS-780
Commit: a980246d5c5dad929a2bd1b8cae7158b44ef5da9
Parents: 5aa1427
Author: jbertram <jb...@apache.com>
Authored: Wed Nov 23 14:06:20 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 14:19:20 2016 -0600

----------------------------------------------------------------------
 .../activemq/artemis/tests/integration/stomp/StompTest.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a980246d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
----------------------------------------------------------------------
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 45946ed..60ce168 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
@@ -83,7 +83,11 @@ public class StompTest extends StompTestBase {
          boolean connected = conn != null && conn.isConnected();
          log.debug("Connection 1.0 connected: " + connected);
          if (connected) {
-            conn.disconnect();
+            try {
+               conn.disconnect();
+            } catch (Exception e) {
+               // ignore
+            }
          }
       } finally {
          super.tearDown();


[21/27] activemq-artemis git commit: Use passed in parameters rather than defaults in createQueue

Posted by ma...@apache.org.
Use passed in parameters rather than defaults in createQueue


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

Branch: refs/heads/ARTEMIS-780
Commit: 24dd31adc16b15a5d02fc9ddf618275cd7a4012c
Parents: 87777e7
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 22:12:02 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 22:12:02 2016 -0600

----------------------------------------------------------------------
 .../core/client/impl/ClientSessionImpl.java     |   4 +-
 .../SessionQueueQueryResponseMessage_V3.java    | 125 +++++++++++++++++++
 2 files changed, 127 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/24dd31ad/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
----------------------------------------------------------------------
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 ae7603c..dd10e5b 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
@@ -1823,8 +1823,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
                                     filterString,
                                     durable,
                                     temp,
-                                    ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(),
-                                    ActiveMQDefaultConfiguration.getDefaultDeleteQueueOnNoConsumers(),
+                                    maxConsumers,
+                                    deleteOnNoConsumers,
                                     autoCreated);
       } finally {
          endCall();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/24dd31ad/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java
new file mode 100644
index 0000000..77ad0f3
--- /dev/null
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java
@@ -0,0 +1,125 @@
+/*
+ * 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;
+import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.core.client.impl.QueueQueryImpl;
+import org.apache.activemq.artemis.core.server.QueueQueryResult;
+
+public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryResponseMessage {
+
+   private boolean autoCreationEnabled;
+
+   public SessionQueueQueryResponseMessage_V2(final QueueQueryResult result) {
+      this(result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(), result.getFilterString(), result.getConsumerCount(), result.getMessageCount(), result.isExists(), result.isAutoCreateJmsQueues());
+   }
+
+   public SessionQueueQueryResponseMessage_V2() {
+      this(null, null, false, false, null, 0, 0, false, false);
+   }
+
+   private SessionQueueQueryResponseMessage_V2(final SimpleString name,
+                                               final SimpleString address,
+                                               final boolean durable,
+                                               final boolean temporary,
+                                               final SimpleString filterString,
+                                               final int consumerCount,
+                                               final long messageCount,
+                                               final boolean exists,
+                                               final boolean autoCreationEnabled) {
+      super(SESS_QUEUEQUERY_RESP_V2);
+
+      this.durable = durable;
+
+      this.temporary = temporary;
+
+      this.consumerCount = consumerCount;
+
+      this.messageCount = messageCount;
+
+      this.filterString = filterString;
+
+      this.address = address;
+
+      this.name = name;
+
+      this.exists = exists;
+
+      this.autoCreationEnabled = autoCreationEnabled;
+   }
+
+   public boolean isAutoCreationEnabled() {
+      return autoCreationEnabled;
+   }
+
+   @Override
+   public void encodeRest(final ActiveMQBuffer buffer) {
+      super.encodeRest(buffer);
+      buffer.writeBoolean(autoCreationEnabled);
+   }
+
+   @Override
+   public void decodeRest(final ActiveMQBuffer buffer) {
+      super.decodeRest(buffer);
+      autoCreationEnabled = buffer.readBoolean();
+   }
+
+   @Override
+   public int hashCode() {
+      final int prime = 31;
+      int result = super.hashCode();
+      result = prime * result + (autoCreationEnabled ? 1231 : 1237);
+      return result;
+   }
+
+   @Override
+   public String toString() {
+      StringBuffer buff = new StringBuffer(getParentString());
+      buff.append(", address=" + address);
+      buff.append(", name=" + name);
+      buff.append(", consumerCount=" + consumerCount);
+      buff.append(", filterString=" + filterString);
+      buff.append(", durable=" + durable);
+      buff.append(", exists=" + exists);
+      buff.append(", temporary=" + temporary);
+      buff.append(", messageCount=" + messageCount);
+      buff.append(", autoCreationEnabled=" + autoCreationEnabled);
+      buff.append("]");
+      return buff.toString();
+   }
+
+   @Override
+   public ClientSession.QueueQuery toQueueQuery() {
+      return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists(), isAutoCreationEnabled());
+   }
+
+   @Override
+   public boolean equals(Object obj) {
+      if (this == obj)
+         return true;
+      if (!super.equals(obj))
+         return false;
+      if (!(obj instanceof SessionQueueQueryResponseMessage_V2))
+         return false;
+      SessionQueueQueryResponseMessage_V2 other = (SessionQueueQueryResponseMessage_V2) obj;
+      if (autoCreationEnabled != other.autoCreationEnabled)
+         return false;
+      return true;
+   }
+}


[17/27] activemq-artemis git commit: Fix temporary queue API

Posted by ma...@apache.org.
Fix temporary queue API


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

Branch: refs/heads/ARTEMIS-780
Commit: 903d216ca837ae9dc8f6d510f297b8f9379e742a
Parents: c961c1d
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 17:26:04 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 17:26:04 2016 -0600

----------------------------------------------------------------------
 .../activemq/artemis/core/client/impl/ClientSessionImpl.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/903d216c/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
----------------------------------------------------------------------
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 310644a..ae7603c 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
@@ -422,7 +422,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
 
    @Override
    public void createTemporaryQueue(final String address, final RoutingType routingType, final String queueName, final String filter) throws ActiveMQException {
-      createTemporaryQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName));
+      createTemporaryQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter));
    }
 
    /**


[27/27] activemq-artemis git commit: Fix SelectorTest Topic prefix

Posted by ma...@apache.org.
Fix SelectorTest Topic prefix


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

Branch: refs/heads/ARTEMIS-780
Commit: df7b552ad21991da03975280c23ecb4b80e9de0d
Parents: 5547a6e
Author: Martyn Taylor <mt...@redhat.com>
Authored: Wed Nov 30 12:56:07 2016 +0000
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Nov 30 12:56:07 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/activemq/artemis/rest/test/SelectorTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/df7b552a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java
index 1491f51..245d25c 100644
--- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java
+++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/SelectorTest.java
@@ -46,7 +46,7 @@ public class SelectorTest extends MessageTestBase {
 
    public static ConnectionFactory connectionFactory;
    public static String topicName = "testTopic";
-   public static String prefixedTopicName = ActiveMQDestination.createQueueAddressFromName(topicName).toString();
+   public static String prefixedTopicName = ActiveMQDestination.createTopicAddressFromName(topicName).toString();
 
    @BeforeClass
    public static void setup() throws Exception {


[08/27] activemq-artemis git commit: Consolidate CreateQueueMessage impls

Posted by ma...@apache.org.
Consolidate CreateQueueMessage impls


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

Branch: refs/heads/ARTEMIS-780
Commit: 3017201ed2ddb4bcd63182bef5b8cb3c58928e9b
Parents: 806c688
Author: jbertram <jb...@apache.com>
Authored: Mon Nov 28 19:11:55 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 19:11:55 2016 -0600

----------------------------------------------------------------------
 .../core/impl/ActiveMQSessionContext.java       |   4 +-
 .../core/protocol/core/impl/PacketDecoder.java  |   6 -
 .../core/protocol/core/impl/PacketImpl.java     |   4 +-
 .../impl/wireformat/CreateAddressMessage.java   |   5 +-
 .../impl/wireformat/CreateQueueMessage_V2.java  |  64 ++++++++-
 .../impl/wireformat/CreateQueueMessage_V3.java  | 134 -------------------
 .../core/ServerSessionPacketHandler.java        |  20 ---
 7 files changed, 67 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3017201e/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
----------------------------------------------------------------------
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 29426dd..ed08142 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
@@ -54,7 +54,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_V3;
+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_V2;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.DisconnectConsumerMessage;
@@ -625,7 +625,7 @@ public class ActiveMQSessionContext extends SessionContext {
                            int maxConsumers,
                            boolean deleteOnNoConsumers,
                            boolean autoCreated) throws ActiveMQException {
-      CreateQueueMessage request = new CreateQueueMessage_V3(address, queueName, routingType, filterString, durable, temp, maxConsumers, deleteOnNoConsumers, autoCreated, true);
+      CreateQueueMessage request = new CreateQueueMessage_V2(address, queueName, routingType, filterString, durable, temp, maxConsumers, deleteOnNoConsumers, autoCreated, true);
       sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3017201e/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java
----------------------------------------------------------------------
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 dbd7091..15629c8 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
@@ -30,7 +30,6 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterTop
 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.CreateQueueMessage_V3;
 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;
@@ -95,7 +94,6 @@ import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CRE
 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_QUEUE_V3;
 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.CREATE_SHARED_QUEUE_V2;
 import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
@@ -255,10 +253,6 @@ public abstract class PacketDecoder implements Serializable {
             packet = new CreateQueueMessage_V2();
             break;
          }
-         case CREATE_QUEUE_V3: {
-            packet = new CreateQueueMessage_V3();
-            break;
-         }
          case CREATE_SHARED_QUEUE: {
             packet = new CreateSharedQueueMessage();
             break;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3017201e/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java
----------------------------------------------------------------------
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 e252623..a65bdfc 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
@@ -253,9 +253,7 @@ public class PacketImpl implements Packet {
 
    public static final byte CREATE_QUEUE_V2 = -12;
 
-   public static final byte CREATE_QUEUE_V3 = -13;
-
-   public static final byte CREATE_SHARED_QUEUE_V2 = -14;
+   public static final byte CREATE_SHARED_QUEUE_V2 = -13;
 
    // Static --------------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3017201e/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java
index 9b18e48..35f0f40 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java
@@ -134,7 +134,10 @@ public class CreateAddressMessage extends PacketImpl {
             return false;
       } else if (!address.equals(other.address))
          return false;
-      if (routingTypes.equals(other.routingTypes))
+      if (routingTypes == null) {
+         if (other.routingTypes != null)
+            return false;
+      } else if (!routingTypes.equals(other.routingTypes))
          return false;
       if (autoCreated != other.autoCreated)
          return false;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3017201e/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java
----------------------------------------------------------------------
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
index 610646e..e2867ab 100644
--- 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
@@ -18,16 +18,26 @@ 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;
+import org.apache.activemq.artemis.core.server.RoutingType;
 
 public class CreateQueueMessage_V2 extends CreateQueueMessage {
 
    protected boolean autoCreated;
 
+   private RoutingType routingType;
+
+   private int maxConsumers;
+
+   private boolean deleteOnNoConsumers;
+
    public CreateQueueMessage_V2(final SimpleString address,
                                 final SimpleString queueName,
+                                final RoutingType routingType,
                                 final SimpleString filterString,
                                 final boolean durable,
                                 final boolean temporary,
+                                final int maxConsumers,
+                                final boolean deleteOnNoConsumers,
                                 final boolean autoCreated,
                                 final boolean requiresResponse) {
       this();
@@ -39,26 +49,52 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage {
       this.temporary = temporary;
       this.autoCreated = autoCreated;
       this.requiresResponse = requiresResponse;
+      this.routingType = routingType;
+      this.maxConsumers = maxConsumers;
+      this.deleteOnNoConsumers = deleteOnNoConsumers;
    }
 
    public CreateQueueMessage_V2() {
       super(CREATE_QUEUE_V2);
    }
 
-   public CreateQueueMessage_V2(byte packet) {
-      super(packet);
-   }
-
    // Public --------------------------------------------------------
 
    @Override
    public String toString() {
       StringBuffer buff = new StringBuffer(super.getParentString());
       buff.append(", autoCreated=" + autoCreated);
+      buff.append(", routingType=" + routingType);
+      buff.append(", maxConsumers=" + maxConsumers);
+      buff.append(", deleteOnNoConsumers=" + deleteOnNoConsumers);
       buff.append("]");
       return buff.toString();
    }
 
+   public RoutingType getRoutingType() {
+      return routingType;
+   }
+
+   public void setRoutingType(RoutingType routingType) {
+      this.routingType = routingType;
+   }
+
+   public int getMaxConsumers() {
+      return maxConsumers;
+   }
+
+   public void setMaxConsumers(int maxConsumers) {
+      this.maxConsumers = maxConsumers;
+   }
+
+   public boolean isDeleteOnNoConsumers() {
+      return deleteOnNoConsumers;
+   }
+
+   public void setDeleteOnNoConsumers(boolean deleteOnNoConsumers) {
+      this.deleteOnNoConsumers = deleteOnNoConsumers;
+   }
+
    public boolean isAutoCreated() {
       return autoCreated;
    }
@@ -71,12 +107,18 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage {
    public void encodeRest(final ActiveMQBuffer buffer) {
       super.encodeRest(buffer);
       buffer.writeBoolean(autoCreated);
+      buffer.writeByte(routingType.getType());
+      buffer.writeInt(maxConsumers);
+      buffer.writeBoolean(deleteOnNoConsumers);
    }
 
    @Override
    public void decodeRest(final ActiveMQBuffer buffer) {
       super.decodeRest(buffer);
       autoCreated = buffer.readBoolean();
+      routingType = RoutingType.getType(buffer.readByte());
+      maxConsumers = buffer.readInt();
+      deleteOnNoConsumers = buffer.readBoolean();
    }
 
    @Override
@@ -84,6 +126,9 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage {
       final int prime = 31;
       int result = super.hashCode();
       result = prime * result + (autoCreated ? 1231 : 1237);
+      result = prime * result + (routingType.getType());
+      result = prime * result + (maxConsumers);
+      result = prime * result + (deleteOnNoConsumers ? 1231 : 1237);
       return result;
    }
 
@@ -98,6 +143,17 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage {
       CreateQueueMessage_V2 other = (CreateQueueMessage_V2) obj;
       if (autoCreated != other.autoCreated)
          return false;
+      if (maxConsumers != other.maxConsumers)
+         return false;
+      if (deleteOnNoConsumers != other.deleteOnNoConsumers)
+         return false;
+      if (deleteOnNoConsumers != other.deleteOnNoConsumers)
+         return false;
+      if (routingType == null) {
+         if (other.routingType != null)
+            return false;
+      } else if (!routingType.equals(other.routingType))
+         return false;
       return true;
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3017201e/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V3.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V3.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V3.java
deleted file mode 100644
index fb5c9ef..0000000
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V3.java
+++ /dev/null
@@ -1,134 +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.core.protocol.core.impl.wireformat;
-
-import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.core.server.RoutingType;
-
-public class CreateQueueMessage_V3 extends CreateQueueMessage_V2 {
-
-   private RoutingType routingType;
-
-   private int maxConsumers;
-
-   private boolean deleteOnNoConsumers;
-
-   public CreateQueueMessage_V3(final SimpleString address,
-                                final SimpleString queueName,
-                                final RoutingType routingType,
-                                final SimpleString filterString,
-                                final boolean durable,
-                                final boolean temporary,
-                                final int maxConsumers,
-                                final boolean deleteOnNoConsumers,
-                                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;
-      this.routingType = routingType;
-      this.maxConsumers = maxConsumers;
-      this.deleteOnNoConsumers = deleteOnNoConsumers;
-   }
-
-   public CreateQueueMessage_V3() {
-      super(CREATE_QUEUE_V3);
-   }
-
-   // Public --------------------------------------------------------
-
-   @Override
-   public String toString() {
-      StringBuffer buff = new StringBuffer(super.getParentString());
-      buff.append(", routingType=" + routingType);
-      buff.append(", maxConsumers=" + maxConsumers);
-      buff.append(", deleteOnNoConsumers=" + deleteOnNoConsumers);
-      buff.append("]");
-      return buff.toString();
-   }
-
-   public RoutingType getRoutingType() {
-      return routingType;
-   }
-
-   public void setRoutingType(RoutingType routingType) {
-      this.routingType = routingType;
-   }
-
-   public int getMaxConsumers() {
-      return maxConsumers;
-   }
-
-   public void setMaxConsumers(int maxConsumers) {
-      this.maxConsumers = maxConsumers;
-   }
-
-   public boolean isDeleteOnNoConsumers() {
-      return deleteOnNoConsumers;
-   }
-
-   public void setDeleteOnNoConsumers(boolean deleteOnNoConsumers) {
-      this.deleteOnNoConsumers = deleteOnNoConsumers;
-   }
-
-   @Override
-   public void encodeRest(final ActiveMQBuffer buffer) {
-      super.encodeRest(buffer);
-      buffer.writeByte(routingType.getType());
-      buffer.writeInt(maxConsumers);
-      buffer.writeBoolean(deleteOnNoConsumers);
-   }
-
-   @Override
-   public void decodeRest(final ActiveMQBuffer buffer) {
-      super.decodeRest(buffer);
-      routingType = RoutingType.getType(buffer.readByte());
-      maxConsumers = buffer.readInt();
-      deleteOnNoConsumers = buffer.readBoolean();
-   }
-
-   @Override
-   public int hashCode() {
-      final int prime = 31;
-      int result = super.hashCode();
-      result = prime * result + (routingType.getType());
-      result = prime * result + (maxConsumers);
-      result = prime * result + (deleteOnNoConsumers ? 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_V3))
-         return false;
-      CreateQueueMessage_V3 other = (CreateQueueMessage_V3) obj;
-      if (autoCreated != other.autoCreated)
-         return false;
-      return true;
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3017201e/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java
----------------------------------------------------------------------
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 5c43683..65ffc69 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
@@ -33,7 +33,6 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQEx
 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.CreateQueueMessage_V3;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.CreateSharedQueueMessage_V2;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.NullResponseMessage;
@@ -80,7 +79,6 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection;
 import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.BindingQueryResult;
-import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.QueueQueryResult;
 import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.ServerMessage;
@@ -91,7 +89,6 @@ 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_QUEUE_V3;
 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.CREATE_SHARED_QUEUE_V2;
 import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
@@ -251,23 +248,6 @@ public class ServerSessionPacketHandler implements ChannelHandler {
                case CREATE_QUEUE_V2: {
                   CreateQueueMessage_V2 request = (CreateQueueMessage_V2) packet;
                   requiresResponse = request.isRequiresResponse();
-                  session.createQueue(request.getAddress(),
-                                      request.getQueueName(),
-                                      RoutingType.MULTICAST,
-                                      request.getFilterString(),
-                                      request.isTemporary(),
-                                      request.isDurable(),
-                                      Queue.MAX_CONSUMERS_UNLIMITED,
-                                      false,
-                                      request.isAutoCreated());
-                  if (requiresResponse) {
-                     response = new NullResponseMessage();
-                  }
-                  break;
-               }
-               case CREATE_QUEUE_V3: {
-                  CreateQueueMessage_V3 request = (CreateQueueMessage_V3) packet;
-                  requiresResponse = request.isRequiresResponse();
                   session.createQueue(request.getAddress(), request.getQueueName(), request.getRoutingType(), request.getFilterString(), request.isTemporary(), request.isDurable(), request.getMaxConsumers(), request.isDeleteOnNoConsumers(),
                                       request.isAutoCreated());
                   if (requiresResponse) {


[14/27] activemq-artemis git commit: Fix broken JMS and JORAM tests

Posted by ma...@apache.org.
Fix broken JMS and JORAM tests


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

Branch: refs/heads/ARTEMIS-780
Commit: 13783768aa040e77de31c2c9cfb147b871bf3abb
Parents: 4e9cda3
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 13:04:14 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 13:04:14 2016 -0600

----------------------------------------------------------------------
 .../artemis/jms/client/ActiveMQSession.java     |  2 +-
 .../impl/ActiveMQServerControlImpl.java         |  2 +-
 .../core/persistence/QueueBindingInfo.java      |  4 +++
 .../journal/AbstractJournalStorageManager.java  |  2 +-
 .../codec/PersistentQueueBindingEncoding.java   | 29 +++++++++++++++++---
 .../core/postoffice/impl/LocalQueueBinding.java |  2 +-
 .../core/postoffice/impl/PostOfficeImpl.java    |  4 ---
 .../artemis/core/server/QueueConfig.java        |  2 +-
 .../core/server/impl/ActiveMQServerImpl.java    |  3 +-
 .../server/impl/PostOfficeJournalLoader.java    |  4 ++-
 .../ActiveMQServerControlUsingCoreTest.java     |  2 +-
 .../activemq/artemis/jms/tests/QueueTest.java   |  2 +-
 .../jms/tests/message/MessageHeaderTest.java    |  2 +-
 .../activemq/artemis/common/AbstractAdmin.java  |  3 +-
 14 files changed, 43 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
----------------------------------------------------------------------
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 fe2a1a0..d0c9592 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
@@ -820,7 +820,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
 
          SimpleString simpleAddress = queue.getSimpleAddress();
 
-         session.createTemporaryQueue(simpleAddress, simpleAddress);
+         session.createTemporaryQueue(simpleAddress, RoutingType.ANYCAST, simpleAddress);
 
          connection.addTemporaryQueue(simpleAddress);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/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 1e2ac0d..e6c32c8 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
@@ -564,7 +564,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
 
    @Override
    public void createAddress(@Parameter(name = "name", desc = "The name of the address") String name,
-                             @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception {
+                             @Parameter(name = "routingType", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception {
       checkStarted();
 
       clearIO();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/QueueBindingInfo.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/QueueBindingInfo.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/QueueBindingInfo.java
index 3a0c240..29f4277 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/QueueBindingInfo.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/QueueBindingInfo.java
@@ -53,4 +53,8 @@ public interface QueueBindingInfo {
    boolean isDeleteOnNoConsumers();
 
    void setDeleteOnNoConsumers(boolean deleteOnNoConsumers);
+
+   byte getRoutingType();
+
+   void setRoutingType(byte routingType);
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
----------------------------------------------------------------------
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 8f44642..f8c9859 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
@@ -1221,7 +1221,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
 
       SimpleString filterString = filter == null ? null : filter.getFilterString();
 
-      PersistentQueueBindingEncoding bindingEncoding = new PersistentQueueBindingEncoding(queue.getName(), binding.getAddress(), filterString, queue.getUser(), queue.isAutoCreated(), queue.getMaxConsumers(), queue.isDeleteOnNoConsumers());
+      PersistentQueueBindingEncoding bindingEncoding = new PersistentQueueBindingEncoding(queue.getName(), binding.getAddress(), filterString, queue.getUser(), queue.isAutoCreated(), queue.getMaxConsumers(), queue.isDeleteOnNoConsumers(), queue.getRoutingType().getType());
 
       readLock();
       try {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
index 88bc1cf..36a0ae6 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.persistence.impl.journal.codec;
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.journal.EncodingSupport;
@@ -45,6 +46,8 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
 
    public boolean deleteOnNoConsumers;
 
+   public byte routingType;
+
    public PersistentQueueBindingEncoding() {
    }
 
@@ -65,6 +68,8 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
          maxConsumers +
          ", deleteOnNoConsumers=" +
          deleteOnNoConsumers +
+         ", routingType=" +
+         routingType +
          "]";
    }
 
@@ -74,7 +79,8 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
                                          final SimpleString user,
                                          final boolean autoCreated,
                                          final int maxConsumers,
-                                         final boolean deleteOnNoConsumers) {
+                                         final boolean deleteOnNoConsumers,
+                                         final byte routingType) {
       this.name = name;
       this.address = address;
       this.filterString = filterString;
@@ -82,6 +88,7 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
       this.autoCreated = autoCreated;
       this.maxConsumers = maxConsumers;
       this.deleteOnNoConsumers = deleteOnNoConsumers;
+      this.routingType = routingType;
    }
 
    @Override
@@ -157,6 +164,16 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
    }
 
    @Override
+   public byte getRoutingType() {
+      return routingType;
+   }
+
+   @Override
+   public void setRoutingType(byte routingType) {
+      this.routingType = routingType;
+   }
+
+   @Override
    public void decode(final ActiveMQBuffer buffer) {
       name = buffer.readSimpleString();
       address = buffer.readSimpleString();
@@ -180,9 +197,11 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
       if (buffer.readableBytes() > 0) {
          maxConsumers = buffer.readInt();
          deleteOnNoConsumers = buffer.readBoolean();
+         routingType = buffer.readByte();
       } else {
-         maxConsumers = -1;
-         deleteOnNoConsumers = false;
+         maxConsumers = ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers();
+         deleteOnNoConsumers = ActiveMQDefaultConfiguration.getDefaultDeleteQueueOnNoConsumers();
+         routingType = ActiveMQDefaultConfiguration.getDefaultRoutingType().getType();
       }
    }
 
@@ -195,6 +214,7 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
       buffer.writeBoolean(autoCreated);
       buffer.writeInt(maxConsumers);
       buffer.writeBoolean(deleteOnNoConsumers);
+      buffer.writeByte(routingType);
    }
 
    @Override
@@ -203,7 +223,8 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
          SimpleString.sizeofNullableString(filterString) + DataConstants.SIZE_BOOLEAN +
          SimpleString.sizeofNullableString(createMetadata()) +
          DataConstants.SIZE_INT +
-         DataConstants.SIZE_BOOLEAN;
+         DataConstants.SIZE_BOOLEAN +
+         DataConstants.SIZE_BYTE;
    }
 
    private SimpleString createMetadata() {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
index d02f0f0..fb025af 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
@@ -132,7 +132,7 @@ public class LocalQueueBinding implements QueueBinding {
 
    private boolean isMatchRoutingType(ServerMessage message) {
       if (message.containsProperty(MessageInternal.HDR_ROUTING_TYPE)) {
-         return message.getByteProperty(MessageInternal.HDR_ROUTING_TYPE) == queue.getRoutingType().getType();
+         return message.getByteProperty(MessageInternal.HDR_ROUTING_TYPE).equals(queue.getRoutingType().getType());
       }
       return true;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
----------------------------------------------------------------------
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 2fc3409..e060542 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
@@ -664,10 +664,6 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
 
       SimpleString address = message.getAddress();
 
-      if (address.toString().equals("testQueue")) {
-         System.out.println("f");
-      }
-
       setPagingStore(message);
 
       AtomicBoolean startedTX = new AtomicBoolean(false);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java
index 3435ca0..6e0d5af 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java
@@ -126,7 +126,7 @@ public final class QueueConfig {
          return this;
       }
 
-      public Builder deliveryMode(RoutingType routingType) {
+      public Builder routingType(RoutingType routingType) {
          this.routingType = routingType;
          return this;
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/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 8546fc2..d6b1be4 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
@@ -1587,7 +1587,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
                             final boolean deleteOnNoConsumers,
                             final boolean autoCreateAddress) throws Exception {
 
-      // TODO: fix logging here as this could be for a topic or queue
       ActiveMQServerLogger.LOGGER.deployQueue(queueName);
 
       return createQueue(address, queueName, routingType, filterString, null, durable, temporary, true, false, autoCreated, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
@@ -2413,7 +2412,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
          }
       }
 
-      final QueueConfig queueConfig = queueConfigBuilder.filter(filter).pagingManager(pagingManager).user(user).durable(durable).temporary(temporary).autoCreated(autoCreated).deliveryMode(routingType).maxConsumers(maxConsumers).deleteOnNoConsumers(deleteOnNoConsumers).build();
+      final QueueConfig queueConfig = queueConfigBuilder.filter(filter).pagingManager(pagingManager).user(user).durable(durable).temporary(temporary).autoCreated(autoCreated).routingType(routingType).maxConsumers(maxConsumers).deleteOnNoConsumers(deleteOnNoConsumers).build();
 
       final Queue queue = queueFactory.createQueueWith(queueConfig);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java
index 20ef545..f52b5cc 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java
@@ -56,6 +56,7 @@ import org.apache.activemq.artemis.core.server.NodeManager;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.QueueConfig;
 import org.apache.activemq.artemis.core.server.QueueFactory;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.group.GroupingHandler;
 import org.apache.activemq.artemis.core.server.group.impl.GroupBinding;
@@ -149,7 +150,8 @@ public class PostOfficeJournalLoader implements JournalLoader {
             .temporary(false)
             .autoCreated(queueBindingInfo.isAutoCreated())
             .deleteOnNoConsumers(queueBindingInfo.isDeleteOnNoConsumers())
-            .maxConsumers(queueBindingInfo.getMaxConsumers());
+            .maxConsumers(queueBindingInfo.getMaxConsumers())
+            .routingType(RoutingType.getType(queueBindingInfo.getRoutingType()));
          final Queue queue = queueFactory.createQueueWith(queueConfigBuilder.build());
          queue.setConsumersRefCount(new AutoCreatedQueueManagerImpl(((PostOfficeImpl)postOffice).getServer(), queueBindingInfo.getQueueName()));
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
----------------------------------------------------------------------
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 193c58c..5e02ff8 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
@@ -566,7 +566,7 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
 
          @Override
          public void createAddress(@Parameter(name = "name", desc = "The name of the address") String name,
-                                   @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception {
+                                   @Parameter(name = "routingType", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception {
 
          }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java
index f47dfb6..3f9e548 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java
@@ -47,7 +47,7 @@ public class QueueTest extends JMSTestCase {
          conn.start();
 
          p.send(s.createTextMessage("payload"));
-         TextMessage m = (TextMessage) c.receive();
+         TextMessage m = (TextMessage) c.receive(5000);
 
          ProxyAssertSupport.assertEquals("payload", m.getText());
       } finally {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java
----------------------------------------------------------------------
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 90b4d3e..71bc8a1 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java
@@ -275,7 +275,7 @@ public class MessageHeaderTest extends MessageHeaderTestBase {
          propNames.add(propName);
       }
 
-      ProxyAssertSupport.assertEquals(9, propNames.size());
+      ProxyAssertSupport.assertTrue(propNames.size() >= 9);
 
       ProxyAssertSupport.assertTrue(propNames.contains("myBool"));
       ProxyAssertSupport.assertTrue(propNames.contains("myByte"));

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13783768/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java
----------------------------------------------------------------------
diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java
index 8ea7828..2ada3be 100644
--- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java
+++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java
@@ -34,6 +34,7 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.api.core.management.ManagementHelper;
 import org.apache.activemq.artemis.api.core.management.ResourceNames;
 import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.tests.util.SpawnedVMSupport;
 import org.objectweb.jtests.jms.admin.Admin;
 
@@ -119,7 +120,7 @@ public class AbstractAdmin implements Admin {
    public void createQueue(final String name) {
       Boolean result;
       try {
-         invokeSyncOperation(ResourceNames.BROKER, "createQueue", name, name);
+         invokeSyncOperation(ResourceNames.BROKER, "createQueue", name, RoutingType.ANYCAST.toString(), name, null, true, ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), ActiveMQDefaultConfiguration.getDefaultDeleteQueueOnNoConsumers(), true);
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }


[13/27] activemq-artemis git commit: CreateAddress CLI work

Posted by ma...@apache.org.
CreateAddress CLI work


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

Branch: refs/heads/ARTEMIS-780
Commit: e2844e0cce016e1e5af0fa36d42e959e1360cb6c
Parents: fea23a1
Author: jbertram <jb...@apache.com>
Authored: Mon Nov 28 21:45:23 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 10:56:16 2016 -0600

----------------------------------------------------------------------
 .../artemis/cli/commands/address/CreateAddress.java    | 13 ++++++++-----
 .../management/impl/ActiveMQServerControlImpl.java     |  2 +-
 .../activemq/artemis/core/server/impl/AddressInfo.java |  3 +++
 .../tests/integration/cli/AddressCommandTest.java      |  6 +++++-
 4 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e2844e0c/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
----------------------------------------------------------------------
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 ac1a9a9..05df14b 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
@@ -35,7 +35,7 @@ public class CreateAddress extends AbstractAction {
    String name;
 
    @Option(name = "--routingTypes", description = "The routing types supported by this address, options are 'anycast' or 'multicast', enter comma separated list, defaults to 'multicast' only")
-   Set<RoutingType> routingTypes = new HashSet<>();
+   String[] routingTypes = new String[] {RoutingType.MULTICAST.toString()};
 
    @Option(name = "--defaultMaxConsumers", description = "Sets the default max consumers for any queues created under this address, default = -1 (no limit)")
    int defaultMaxConsumers = -1;
@@ -54,7 +54,7 @@ public class CreateAddress extends AbstractAction {
       performCoreManagement(new ManagementCallback<ClientMessage>() {
          @Override
          public void setUpInvocation(ClientMessage message) throws Exception {
-            ManagementHelper.putOperationInvocation(message, "broker", "createAddress", getName(), routingTypes, defaultDeleteOnNoConsumers, defaultMaxConsumers);
+            ManagementHelper.putOperationInvocation(message, "broker", "createAddress", getName(), routingTypes);
          }
 
          @Override
@@ -78,13 +78,16 @@ public class CreateAddress extends AbstractAction {
       return name;
    }
 
-   public Set<RoutingType> getRoutingTypes() {
+   public String[] getRoutingTypes() {
       return routingTypes;
    }
 
    public void setRoutingTypes(String routingTypes) {
-      for (String s : routingTypes.split(",")) {
-         this.routingTypes.add(RoutingType.valueOf(s.trim()));
+      String[] split = routingTypes.split(",");
+      this.routingTypes = new String[split.length];
+      for (int i = 0; i < split.length; i++) {
+         RoutingType.valueOf(split[i].trim());
+         this.routingTypes[i] = split[i].trim();
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e2844e0c/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 9e103f4..1e2ac0d 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
@@ -665,7 +665,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
             filter = new SimpleString(filterStr);
          }
 
-         server.createQueue(SimpleString.toSimpleString(address), RoutingType.valueOf(routingType), new SimpleString(name), filter, durable, false, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
+         server.createQueue(SimpleString.toSimpleString(address), RoutingType.valueOf(routingType.toUpperCase()), new SimpleString(name), filter, durable, false, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
       } finally {
          blockOnIO();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e2844e0c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
----------------------------------------------------------------------
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 7816cde..d05628c 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
@@ -119,6 +119,9 @@ public class AddressInfo {
       for (RoutingType routingType : routingTypes) {
          buff.append(routingType.toString() + ",");
       }
+      // delete hanging comma
+      buff.deleteCharAt(buff.length() - 1);
+      buff.append("}");
       buff.append(", autoCreated=" + autoCreated);
       buff.append("]");
       return buff.toString();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e2844e0c/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/AddressCommandTest.java
----------------------------------------------------------------------
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 c04fc0b..6c373ec 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/AddressCommandTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/AddressCommandTest.java
@@ -51,9 +51,13 @@ public class AddressCommandTest extends JMSTestBase {
       String address = "address";
       CreateAddress command = new CreateAddress();
       command.setName(address);
+      command.setRoutingTypes(RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString());
       command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
       checkExecutionPassed(command);
-      assertNotNull(server.getAddressInfo(new SimpleString(address)));
+      AddressInfo addressInfo = server.getAddressInfo(new SimpleString(address));
+      assertNotNull(addressInfo);
+      assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST));
+      assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST));
    }
 
    @Test


[23/27] activemq-artemis git commit: Fix SecurityTest

Posted by ma...@apache.org.
Fix SecurityTest


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

Branch: refs/heads/ARTEMIS-780
Commit: 762e4f1de37ec6a81b6cb50bbfa031c365ecc401
Parents: be9483a
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 22:47:36 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 22:47:36 2016 -0600

----------------------------------------------------------------------
 .../artemis/tests/integration/security/SecurityTest.java         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/762e4f1d/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java
----------------------------------------------------------------------
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 2829d80..21b2c6d 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java
@@ -833,7 +833,7 @@ public class SecurityTest extends ActiveMQTestBase {
       HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
       ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
       securityManager.getConfiguration().addUser("auser", "pass");
-      Role role = new Role("arole", false, false, true, true, false, false, false, false, false, false);
+      Role role = new Role("arole", false, false, true, true, false, false, false, false, false, true);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -923,7 +923,7 @@ public class SecurityTest extends ActiveMQTestBase {
       HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
       ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
       securityManager.getConfiguration().addUser("auser", "pass");
-      Role role = new Role("arole", false, false, false, false, true, true, false, false, false, false);
+      Role role = new Role("arole", false, false, false, false, true, true, false, false, false, true);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);


[26/27] activemq-artemis git commit: Fix TopicServiceManager

Posted by ma...@apache.org.
Fix TopicServiceManager


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

Branch: refs/heads/ARTEMIS-780
Commit: 5547a6eb1a0ad15d0c61c2057b99e9629c1a9389
Parents: ea81ad1
Author: Martyn Taylor <mt...@redhat.com>
Authored: Wed Nov 30 12:55:56 2016 +0000
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Nov 30 12:55:56 2016 +0000

----------------------------------------------------------------------
 .../activemq/artemis/rest/topic/TopicServiceManager.java | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5547a6eb/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java
index 1b710ee..8944ecf 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java
@@ -21,6 +21,7 @@ import java.util.List;
 
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.jms.client.ConnectionFactoryOptions;
 import org.apache.activemq.artemis.rest.queue.DestinationServiceManager;
 
@@ -83,14 +84,12 @@ public class TopicServiceManager extends DestinationServiceManager {
       }
       String queueName = topicDeployment.getName();
       boolean defaultDurable;
+
       try (ClientSession session = sessionFactory.createSession(false, false, false)) {
-         ClientSession.QueueQuery query = session.queueQuery(new SimpleString(queueName));
          defaultDurable = topicDeployment.isDurableSend();
-         if (query.isExists()) {
-            defaultDurable = query.isDurable();
-         } else {
-            session.createQueue(queueName, queueName, topicDeployment.isDurableSend());
-         }
+         ClientSession.AddressQuery query = session.addressQuery(new SimpleString(queueName));
+         if (!query.isExists())
+            session.createAddress(SimpleString.toSimpleString(queueName), RoutingType.MULTICAST, true);
       }
 
       destination.createTopicResource(queueName, defaultDurable, topicDeployment.getConsumerSessionTimeoutSeconds(), topicDeployment.isDuplicatesAllowed());


[18/27] activemq-artemis git commit: Fix InterceptorTest

Posted by ma...@apache.org.
Fix InterceptorTest


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

Branch: refs/heads/ARTEMIS-780
Commit: d25ac0537f410932a85935d98f027776594b980e
Parents: 903d216
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 17:26:12 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 17:26:12 2016 -0600

----------------------------------------------------------------------
 .../artemis/tests/integration/interceptors/InterceptorTest.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/d25ac053/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
----------------------------------------------------------------------
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 f6ad723..dd8b7ce 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java
@@ -49,6 +49,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionCre
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendMessage;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
@@ -1052,7 +1053,7 @@ public class InterceptorTest extends ActiveMQTestBase {
    public void testInterceptorOnURI() throws Exception {
       locator.close();
 
-      server.createQueue(QUEUE, QUEUE, null, true, false);
+      server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false);
 
       String uri = "tcp://localhost:61616?incomingInterceptorList=" + Incoming.class.getCanonicalName() + "&outgoingInterceptorList=" + Outgoing.class.getName();
 


[05/27] activemq-artemis git commit: Checkstyle + ArtemisTest fix

Posted by ma...@apache.org.
Checkstyle + ArtemisTest fix


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

Branch: refs/heads/ARTEMIS-780
Commit: 617a02b804fa1483220b94174648976074be5b5b
Parents: a980246
Author: jbertram <jb...@apache.com>
Authored: Mon Nov 28 15:30:48 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 15:30:48 2016 -0600

----------------------------------------------------------------------
 .../apache/activemq/artemis/cli/commands/Create.java    |  8 ++++----
 .../apache/activemq/artemis/cli/commands/etc/broker.xml | 12 ++++++------
 .../impl/wireformat/CreateSharedQueueMessage_V2.java    |  1 -
 .../artemis/jms/server/impl/JMSServerManagerImpl.java   |  2 +-
 .../artemis/junit/ActiveMQConsumerResource.java         |  4 ----
 .../artemis/core/server/impl/ActiveMQServerImpl.java    |  4 ++--
 .../activemq/artemis/core/server/impl/AddressInfo.java  |  1 -
 .../tests/integration/server/PredefinedQueueTest.java   |  1 -
 8 files changed, 13 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/617a02b8/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
----------------------------------------------------------------------
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 ae2734c..d13b225 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
@@ -783,14 +783,14 @@ public class Create extends InputAbstract {
       printWriter.println();
 
       for (String str : getQueueList()) {
-         printWriter.println("         <address name=\"" + str + "\" type=\"anycast\">");
-         printWriter.println("            <queues>");
+         printWriter.println("         <address name=\"" + str + "\">");
+         printWriter.println("            <anycast>");
          printWriter.println("               <queue name=\"" + str + "\" />");
-         printWriter.println("            </queues>");
+         printWriter.println("            </anycast>");
          printWriter.println("         </address>");
       }
       for (String str : getAddressList()) {
-         printWriter.println("         <address name=\"" + str + "\" type=\"multicast\"/>");
+         printWriter.println("         <address name=\"" + str + "\"/>");
       }
       filters.put("${address-queue.settings}", writer.toString());
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/617a02b8/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
----------------------------------------------------------------------
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 3b67a09..d86637d 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
@@ -97,15 +97,15 @@ ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st
       </address-settings>
 
       <addresses>
-         <address name="DLQ" type="anycast">
-            <queues>
+         <address name="DLQ">
+            <anycast>
                <queue name="DLQ" />
-            </queues>
+            </anycast>
          </address>
-         <address name="ExpiryQueue" type="anycast">
-            <queues>
+         <address name="ExpiryQueue">
+            <anycast>
                <queue name="ExpiryQueue" />
-            </queues>
+            </anycast>
          </address>${address-queue.settings}
       </addresses>
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/617a02b8/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java
index 7c45ca7..40b9cb5 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java
@@ -18,7 +18,6 @@ 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;
-import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
 import org.apache.activemq.artemis.core.server.RoutingType;
 
 public class CreateSharedQueueMessage_V2 extends CreateSharedQueueMessage {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/617a02b8/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
----------------------------------------------------------------------
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 ee405fc..8532a92 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
@@ -464,7 +464,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
                                            final String... bindings) throws Exception {
       return internalCreateJMSQueue(storeConfig, queueName, selectorString, durable, false, bindings);
    }
-tt
+
    protected boolean internalCreateJMSQueue(final boolean storeConfig,
                                             final String queueName,
                                             final String selectorString,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/617a02b8/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
----------------------------------------------------------------------
diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
index 8b09827..bab092d 100644
--- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
+++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java
@@ -16,16 +16,12 @@
  */
 package org.apache.activemq.artemis.junit;
 
-import java.util.Collections;
-import java.util.HashSet;
-
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientConsumer;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.core.server.RoutingType;
-import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 
 /**
  * A JUnit Rule that embeds an ActiveMQ Artemis ClientConsumer into a test.

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/617a02b8/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 5f60429..ccc0b89 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
@@ -109,7 +109,6 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.Bindable;
 import org.apache.activemq.artemis.core.server.BindingQueryResult;
-import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.Divert;
 import org.apache.activemq.artemis.core.server.JournalType;
 import org.apache.activemq.artemis.core.server.LargeServerMessage;
@@ -121,6 +120,7 @@ import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.QueueConfig;
 import org.apache.activemq.artemis.core.server.QueueFactory;
 import org.apache.activemq.artemis.core.server.QueueQueryResult;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.SecuritySettingPlugin;
 import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.server.ServiceRegistry;
@@ -1407,7 +1407,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
                             final SimpleString filterString,
                             final boolean durable,
                             final boolean temporary) throws Exception {
-       return createQueue(address, ActiveMQDefaultConfiguration.getDefaultRoutingType(), queueName, filterString, durable, temporary);
+      return createQueue(address, ActiveMQDefaultConfiguration.getDefaultRoutingType(), queueName, filterString, durable, temporary);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/617a02b8/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
----------------------------------------------------------------------
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 64d6dd5..7816cde 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
@@ -16,7 +16,6 @@
  */
 package org.apache.activemq.artemis.core.server.impl;
 
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/617a02b8/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java
index 93eec9c..0df3846 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java
@@ -33,7 +33,6 @@ import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
 import org.apache.activemq.artemis.core.postoffice.Bindings;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServers;
-import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.junit.Assert;


[22/27] activemq-artemis git commit: Support new attributes on queue queries, etc.

Posted by ma...@apache.org.
Support new attributes on queue queries, etc.


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

Branch: refs/heads/ARTEMIS-780
Commit: be9483a741f89cf2eaf64c4b8edac90d3b61c9fc
Parents: 24dd31a
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 22:14:15 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 22:32:07 2016 -0600

----------------------------------------------------------------------
 .../artemis/api/core/client/ClientSession.java  |  10 +-
 .../core/client/impl/QueueQueryImpl.java        |  59 ++++++++-
 .../core/impl/ActiveMQSessionContext.java       |   6 +-
 .../core/protocol/core/impl/ChannelImpl.java    |   2 +
 .../core/protocol/core/impl/PacketDecoder.java  |   6 +
 .../core/protocol/core/impl/PacketImpl.java     |   2 +
 .../SessionQueueQueryResponseMessage.java       |  12 +-
 .../SessionQueueQueryResponseMessage_V2.java    |  41 ++++---
 .../SessionQueueQueryResponseMessage_V3.java    | 122 ++++++++++++++-----
 .../artemis/core/server/QueueQueryResult.java   |  56 ++++++---
 .../artemis/jms/client/ActiveMQQueue.java       |   5 +
 .../artemis/jms/client/ActiveMQSession.java     |   2 +-
 .../jms/client/ActiveMQTemporaryQueue.java      |   5 +
 .../jms/client/ActiveMQTemporaryTopic.java      |   5 +
 .../artemis/jms/client/ActiveMQTopic.java       |   5 +
 .../amqp/broker/AMQPSessionCallback.java        |   4 +-
 .../core/ServerSessionPacketHandler.java        |   9 +-
 .../core/server/impl/ActiveMQServerImpl.java    |  12 +-
 .../tests/integration/client/SessionTest.java   |   2 +-
 .../jms/cluster/JMSReconnectTest.java           |   3 +-
 20 files changed, 279 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
----------------------------------------------------------------------
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 a414f95..c8d483c 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
@@ -100,7 +100,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
        * Returns <code>true</code> if auto-creation for this queue is enabled and if the queue queried is a JMS queue,
        * <code>false</code> else.
        */
-      boolean isAutoCreateJmsQueues();
+      boolean isAutoCreateQueues();
 
       /**
        * Returns the number of consumers attached to the queue.
@@ -128,6 +128,14 @@ public interface ClientSession extends XAResource, AutoCloseable {
        * @return
        */
       SimpleString getName();
+
+      RoutingType getRoutingType();
+
+      int getMaxConsumers();
+
+      boolean isDeleteOnNoConsumers();
+
+      boolean isAutoCreated();
    }
 
    // Lifecycle operations ------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/QueueQueryImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/QueueQueryImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/QueueQueryImpl.java
index 40ea86a..5afdd8d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/QueueQueryImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/QueueQueryImpl.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.client.impl;
 
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.core.server.RoutingType;
 
 public class QueueQueryImpl implements ClientSession.QueueQuery {
 
@@ -37,7 +38,15 @@ public class QueueQueryImpl implements ClientSession.QueueQuery {
 
    private final SimpleString name;
 
-   private final boolean autoCreateJmsQueues;
+   private final boolean autoCreateQueues;
+
+   private final boolean autoCreated;
+
+   private final RoutingType routingType;
+
+   private final boolean deleteOnNoConsumers;
+
+   private final int maxConsumers;
 
    public QueueQueryImpl(final boolean durable,
                          final boolean temporary,
@@ -58,7 +67,23 @@ public class QueueQueryImpl implements ClientSession.QueueQuery {
                          final SimpleString address,
                          final SimpleString name,
                          final boolean exists,
-                         final boolean autoCreateJmsQueues) {
+                         final boolean autoCreateQueues) {
+      this(durable, temporary, consumerCount, messageCount, filterString, address, name, exists, autoCreateQueues, -1, false, false, RoutingType.MULTICAST);
+   }
+
+   public QueueQueryImpl(final boolean durable,
+                         final boolean temporary,
+                         final int consumerCount,
+                         final long messageCount,
+                         final SimpleString filterString,
+                         final SimpleString address,
+                         final SimpleString name,
+                         final boolean exists,
+                         final boolean autoCreateQueues,
+                         final int maxConsumers,
+                         final boolean autoCreated,
+                         final boolean deleteOnNoConsumers,
+                         final RoutingType routingType) {
       this.durable = durable;
       this.temporary = temporary;
       this.consumerCount = consumerCount;
@@ -67,7 +92,11 @@ public class QueueQueryImpl implements ClientSession.QueueQuery {
       this.address = address;
       this.name = name;
       this.exists = exists;
-      this.autoCreateJmsQueues = autoCreateJmsQueues;
+      this.autoCreateQueues = autoCreateQueues;
+      this.maxConsumers = maxConsumers;
+      this.autoCreated = autoCreated;
+      this.deleteOnNoConsumers = deleteOnNoConsumers;
+      this.routingType = routingType;
    }
 
    @Override
@@ -101,8 +130,8 @@ public class QueueQueryImpl implements ClientSession.QueueQuery {
    }
 
    @Override
-   public boolean isAutoCreateJmsQueues() {
-      return autoCreateJmsQueues;
+   public boolean isAutoCreateQueues() {
+      return autoCreateQueues;
    }
 
    @Override
@@ -115,5 +144,25 @@ public class QueueQueryImpl implements ClientSession.QueueQuery {
       return exists;
    }
 
+   @Override
+   public RoutingType getRoutingType() {
+      return routingType;
+   }
+
+   @Override
+   public int getMaxConsumers() {
+      return maxConsumers;
+   }
+
+   @Override
+   public boolean isDeleteOnNoConsumers() {
+      return deleteOnNoConsumers;
+   }
+
+   @Override
+   public boolean isAutoCreated() {
+      return autoCreated;
+   }
+
 }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
----------------------------------------------------------------------
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 ed08142..1a52e9b 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
@@ -80,6 +80,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionPro
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V2;
+import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V3;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveMessage;
@@ -290,7 +291,7 @@ public class ActiveMQSessionContext extends SessionContext {
 
       SessionCreateConsumerMessage request = new SessionCreateConsumerMessage(consumerID, queueName, filterString, browseOnly, true);
 
-      SessionQueueQueryResponseMessage_V2 queueInfo = (SessionQueueQueryResponseMessage_V2) sessionChannel.sendBlocking(request, PacketImpl.SESS_QUEUEQUERY_RESP_V2);
+      SessionQueueQueryResponseMessage_V3 queueInfo = (SessionQueueQueryResponseMessage_V3) sessionChannel.sendBlocking(request, PacketImpl.SESS_QUEUEQUERY_RESP_V3);
 
       // The actual windows size that gets used is determined by the user since
       // could be overridden on the queue settings
@@ -710,8 +711,7 @@ public class ActiveMQSessionContext extends SessionContext {
       // they are defined in broker.xml
       // This allows e.g. JMS non durable subs and temporary queues to continue to be used after failover
       if (!queueInfo.isDurable()) {
-         // TODO (mtaylor) QueueInfo needs updating to include new parameters, this method should pass in del mode
-         CreateQueueMessage createQueueRequest = new CreateQueueMessage(queueInfo.getAddress(), queueInfo.getName(), queueInfo.getFilterString(), false, queueInfo.isTemporary(), false);
+         CreateQueueMessage_V2 createQueueRequest = new CreateQueueMessage_V2(queueInfo.getAddress(), queueInfo.getName(), queueInfo.getRoutingType(), queueInfo.getFilterString(), false, queueInfo.isTemporary(), queueInfo.getMaxConsumers(), queueInfo.isDeleteOnNoConsumers(), queueInfo.isAutoCreated(), false);
 
          sendPacketWithoutLock(sessionChannel, createQueueRequest);
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java
index 41be080..d1b17bf 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java
@@ -172,6 +172,8 @@ public final class ChannelImpl implements Channel {
             return version >= 126;
          case PacketImpl.SESS_BINDINGQUERY_RESP_V3:
             return version >= 127;
+         case PacketImpl.SESS_QUEUEQUERY_RESP_V3:
+            return version >= 129;
          default:
             return true;
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketDecoder.java
----------------------------------------------------------------------
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 15629c8..89a6c9a 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
@@ -64,6 +64,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionPro
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V2;
+import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V3;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
@@ -127,6 +128,7 @@ import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SES
 import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY;
 import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY_RESP;
 import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY_RESP_V2;
+import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY_RESP_V3;
 import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_CONTINUATION;
 import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_ROLLBACK;
 import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_SEND_CONTINUATION;
@@ -241,6 +243,10 @@ public abstract class PacketDecoder implements Serializable {
             packet = new SessionQueueQueryResponseMessage_V2();
             break;
          }
+         case SESS_QUEUEQUERY_RESP_V3: {
+            packet = new SessionQueueQueryResponseMessage_V3();
+            break;
+         }
          case CREATE_ADDRESS: {
             packet = new CreateAddressMessage();
             break;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java
----------------------------------------------------------------------
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 a65bdfc..5bdf727 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
@@ -255,6 +255,8 @@ public class PacketImpl implements Packet {
 
    public static final byte CREATE_SHARED_QUEUE_V2 = -13;
 
+   public static final byte SESS_QUEUEQUERY_RESP_V3 = -14;
+
    // Static --------------------------------------------------------
 
    public PacketImpl(final byte type) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
index b8313b2..7d9c184 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
@@ -49,8 +49,8 @@ public class SessionQueueQueryResponseMessage extends PacketImpl {
       this(null, null, false, false, null, 0, 0, false);
    }
 
-   public SessionQueueQueryResponseMessage(byte v2) {
-      super(v2);
+   public SessionQueueQueryResponseMessage(byte v) {
+      super(v);
    }
 
    private SessionQueueQueryResponseMessage(final SimpleString name,
@@ -159,6 +159,13 @@ public class SessionQueueQueryResponseMessage extends PacketImpl {
    @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(", name=" + name);
       buff.append(", consumerCount=" + consumerCount);
@@ -167,7 +174,6 @@ public class SessionQueueQueryResponseMessage extends PacketImpl {
       buff.append(", exists=" + exists);
       buff.append(", temporary=" + temporary);
       buff.append(", messageCount=" + messageCount);
-      buff.append("]");
       return buff.toString();
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V2.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V2.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V2.java
index 77ad0f3..667ce6e 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V2.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V2.java
@@ -24,10 +24,10 @@ import org.apache.activemq.artemis.core.server.QueueQueryResult;
 
 public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryResponseMessage {
 
-   private boolean autoCreationEnabled;
+   protected boolean autoCreateQueues;
 
    public SessionQueueQueryResponseMessage_V2(final QueueQueryResult result) {
-      this(result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(), result.getFilterString(), result.getConsumerCount(), result.getMessageCount(), result.isExists(), result.isAutoCreateJmsQueues());
+      this(result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(), result.getFilterString(), result.getConsumerCount(), result.getMessageCount(), result.isExists(), result.isAutoCreateQueues());
    }
 
    public SessionQueueQueryResponseMessage_V2() {
@@ -42,7 +42,7 @@ public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryRespon
                                                final int consumerCount,
                                                final long messageCount,
                                                final boolean exists,
-                                               final boolean autoCreationEnabled) {
+                                               final boolean autoCreateQueues) {
       super(SESS_QUEUEQUERY_RESP_V2);
 
       this.durable = durable;
@@ -61,52 +61,53 @@ public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryRespon
 
       this.exists = exists;
 
-      this.autoCreationEnabled = autoCreationEnabled;
+      this.autoCreateQueues = autoCreateQueues;
+   }
+   public SessionQueueQueryResponseMessage_V2(byte v) {
+      super(v);
    }
 
-   public boolean isAutoCreationEnabled() {
-      return autoCreationEnabled;
+   public boolean isAutoCreateQueues() {
+      return autoCreateQueues;
    }
 
    @Override
    public void encodeRest(final ActiveMQBuffer buffer) {
       super.encodeRest(buffer);
-      buffer.writeBoolean(autoCreationEnabled);
+      buffer.writeBoolean(autoCreateQueues);
    }
 
    @Override
    public void decodeRest(final ActiveMQBuffer buffer) {
       super.decodeRest(buffer);
-      autoCreationEnabled = buffer.readBoolean();
+      autoCreateQueues = buffer.readBoolean();
    }
 
    @Override
    public int hashCode() {
       final int prime = 31;
       int result = super.hashCode();
-      result = prime * result + (autoCreationEnabled ? 1231 : 1237);
+      result = prime * result + (autoCreateQueues ? 1231 : 1237);
       return result;
    }
 
    @Override
    public String toString() {
       StringBuffer buff = new StringBuffer(getParentString());
-      buff.append(", address=" + address);
-      buff.append(", name=" + name);
-      buff.append(", consumerCount=" + consumerCount);
-      buff.append(", filterString=" + filterString);
-      buff.append(", durable=" + durable);
-      buff.append(", exists=" + exists);
-      buff.append(", temporary=" + temporary);
-      buff.append(", messageCount=" + messageCount);
-      buff.append(", autoCreationEnabled=" + autoCreationEnabled);
       buff.append("]");
       return buff.toString();
    }
 
    @Override
+   public String getParentString() {
+      StringBuffer buff = new StringBuffer(super.getParentString());
+      buff.append(", autoCreationEnabled=" + autoCreateQueues);
+      return buff.toString();
+   }
+
+   @Override
    public ClientSession.QueueQuery toQueueQuery() {
-      return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists(), isAutoCreationEnabled());
+      return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists(), isAutoCreateQueues());
    }
 
    @Override
@@ -118,7 +119,7 @@ public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryRespon
       if (!(obj instanceof SessionQueueQueryResponseMessage_V2))
          return false;
       SessionQueueQueryResponseMessage_V2 other = (SessionQueueQueryResponseMessage_V2) obj;
-      if (autoCreationEnabled != other.autoCreationEnabled)
+      if (autoCreateQueues != other.autoCreateQueues)
          return false;
       return true;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java
index 77ad0f3..b3664da 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage_V3.java
@@ -21,20 +21,27 @@ import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
 import org.apache.activemq.artemis.core.client.impl.QueueQueryImpl;
 import org.apache.activemq.artemis.core.server.QueueQueryResult;
+import org.apache.activemq.artemis.core.server.RoutingType;
 
-public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryResponseMessage {
+public class SessionQueueQueryResponseMessage_V3 extends SessionQueueQueryResponseMessage_V2 {
 
-   private boolean autoCreationEnabled;
+   protected boolean autoCreated;
 
-   public SessionQueueQueryResponseMessage_V2(final QueueQueryResult result) {
-      this(result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(), result.getFilterString(), result.getConsumerCount(), result.getMessageCount(), result.isExists(), result.isAutoCreateJmsQueues());
+   protected boolean deleteOnNoConsumers;
+
+   protected RoutingType routingType;
+
+   protected int maxConsumers;
+
+   public SessionQueueQueryResponseMessage_V3(final QueueQueryResult result) {
+      this(result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(), result.getFilterString(), result.getConsumerCount(), result.getMessageCount(), result.isExists(), result.isAutoCreateQueues(), result.isAutoCreated(), result.isDeleteOnNoConsumers(), result.getRoutingType(), result.getMaxConsumers());
    }
 
-   public SessionQueueQueryResponseMessage_V2() {
-      this(null, null, false, false, null, 0, 0, false, false);
+   public SessionQueueQueryResponseMessage_V3() {
+      this(null, null, false, false, null, 0, 0, false, false, false, false, RoutingType.MULTICAST, -1);
    }
 
-   private SessionQueueQueryResponseMessage_V2(final SimpleString name,
+   private SessionQueueQueryResponseMessage_V3(final SimpleString name,
                                                final SimpleString address,
                                                final boolean durable,
                                                final boolean temporary,
@@ -42,8 +49,12 @@ public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryRespon
                                                final int consumerCount,
                                                final long messageCount,
                                                final boolean exists,
-                                               final boolean autoCreationEnabled) {
-      super(SESS_QUEUEQUERY_RESP_V2);
+                                               final boolean autoCreateQueues,
+                                               final boolean autoCreated,
+                                               final boolean deleteOnNoConsumers,
+                                               final RoutingType routingType,
+                                               final int maxConsumers) {
+      super(SESS_QUEUEQUERY_RESP_V3);
 
       this.durable = durable;
 
@@ -61,52 +72,98 @@ public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryRespon
 
       this.exists = exists;
 
-      this.autoCreationEnabled = autoCreationEnabled;
+      this.autoCreateQueues = autoCreateQueues;
+
+      this.autoCreated = autoCreated;
+
+      this.deleteOnNoConsumers = deleteOnNoConsumers;
+
+      this.routingType = routingType;
+
+      this.maxConsumers = maxConsumers;
+   }
+
+   public boolean isAutoCreated() {
+      return autoCreated;
+   }
+
+   public void setAutoCreated(boolean autoCreated) {
+      this.autoCreated = autoCreated;
+   }
+
+   public boolean isDeleteOnNoConsumers() {
+      return deleteOnNoConsumers;
+   }
+
+   public void setDeleteOnNoConsumers(boolean deleteOnNoConsumers) {
+      this.deleteOnNoConsumers = deleteOnNoConsumers;
+   }
+
+   public RoutingType getRoutingType() {
+      return routingType;
+   }
+
+   public void setRoutingType(RoutingType routingType) {
+      this.routingType = routingType;
+   }
+
+   public int getMaxConsumers() {
+      return maxConsumers;
    }
 
-   public boolean isAutoCreationEnabled() {
-      return autoCreationEnabled;
+   public void setMaxConsumers(int maxConsumers) {
+      this.maxConsumers = maxConsumers;
    }
 
    @Override
    public void encodeRest(final ActiveMQBuffer buffer) {
       super.encodeRest(buffer);
-      buffer.writeBoolean(autoCreationEnabled);
+      buffer.writeBoolean(autoCreated);
+      buffer.writeBoolean(deleteOnNoConsumers);
+      buffer.writeByte(routingType.getType());
+      buffer.writeInt(maxConsumers);
    }
 
    @Override
    public void decodeRest(final ActiveMQBuffer buffer) {
       super.decodeRest(buffer);
-      autoCreationEnabled = buffer.readBoolean();
+      autoCreated = buffer.readBoolean();
+      deleteOnNoConsumers = buffer.readBoolean();
+      routingType = RoutingType.getType(buffer.readByte());
+      maxConsumers = buffer.readInt();
    }
 
    @Override
    public int hashCode() {
       final int prime = 31;
       int result = super.hashCode();
-      result = prime * result + (autoCreationEnabled ? 1231 : 1237);
+      result = prime * result + (autoCreated ? 1231 : 1237);
+      result = prime * result + (deleteOnNoConsumers ? 1231 : 1237);
+      result = prime * result + routingType.hashCode();
+      result = prime * result + maxConsumers;
       return result;
    }
 
    @Override
    public String toString() {
       StringBuffer buff = new StringBuffer(getParentString());
-      buff.append(", address=" + address);
-      buff.append(", name=" + name);
-      buff.append(", consumerCount=" + consumerCount);
-      buff.append(", filterString=" + filterString);
-      buff.append(", durable=" + durable);
-      buff.append(", exists=" + exists);
-      buff.append(", temporary=" + temporary);
-      buff.append(", messageCount=" + messageCount);
-      buff.append(", autoCreationEnabled=" + autoCreationEnabled);
       buff.append("]");
       return buff.toString();
    }
 
    @Override
+   public String getParentString() {
+      StringBuffer buff = new StringBuffer(super.getParentString());
+      buff.append(", autoCreated=" + autoCreated);
+      buff.append(", deleteOnNoConsumers=" + deleteOnNoConsumers);
+      buff.append(", routingType=" + routingType);
+      buff.append(", maxConsumers=" + maxConsumers);
+      return buff.toString();
+   }
+
+   @Override
    public ClientSession.QueueQuery toQueueQuery() {
-      return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists(), isAutoCreationEnabled());
+      return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists(), isAutoCreateQueues(), getMaxConsumers(), isAutoCreated(), isDeleteOnNoConsumers(), getRoutingType());
    }
 
    @Override
@@ -115,10 +172,19 @@ public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryRespon
          return true;
       if (!super.equals(obj))
          return false;
-      if (!(obj instanceof SessionQueueQueryResponseMessage_V2))
+      if (!(obj instanceof SessionQueueQueryResponseMessage_V3))
+         return false;
+      SessionQueueQueryResponseMessage_V3 other = (SessionQueueQueryResponseMessage_V3) obj;
+      if (autoCreated != other.autoCreated)
+         return false;
+      if (deleteOnNoConsumers != other.deleteOnNoConsumers)
+         return false;
+      if (routingType == null) {
+         if (other.routingType != null)
+            return false;
+      } else if (!routingType.equals(other.routingType))
          return false;
-      SessionQueueQueryResponseMessage_V2 other = (SessionQueueQueryResponseMessage_V2) obj;
-      if (autoCreationEnabled != other.autoCreationEnabled)
+      if (maxConsumers != other.maxConsumers)
          return false;
       return true;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/QueueQueryResult.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/QueueQueryResult.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/QueueQueryResult.java
index f9740de..de14888 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/QueueQueryResult.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/QueueQueryResult.java
@@ -36,18 +36,15 @@ public class QueueQueryResult {
 
    private boolean temporary;
 
-   private boolean autoCreateJmsQueues;
+   private boolean autoCreateQueues;
 
-   public QueueQueryResult(final SimpleString name,
-                           final SimpleString address,
-                           final boolean durable,
-                           final boolean temporary,
-                           final SimpleString filterString,
-                           final int consumerCount,
-                           final long messageCount,
-                           final boolean autoCreateJmsQueues) {
-      this(name, address, durable, temporary, filterString, consumerCount, messageCount, autoCreateJmsQueues, true);
-   }
+   private boolean autoCreated;
+
+   private boolean deleteOnNoConsumers;
+
+   private RoutingType routingType;
+
+   private int maxConsumers;
 
    public QueueQueryResult(final SimpleString name,
                            final SimpleString address,
@@ -56,8 +53,12 @@ public class QueueQueryResult {
                            final SimpleString filterString,
                            final int consumerCount,
                            final long messageCount,
-                           final boolean autoCreateJmsQueues,
-                           final boolean exists) {
+                           final boolean autoCreateQueues,
+                           final boolean exists,
+                           final boolean autoCreated,
+                           final boolean deleteOnNoConsumers,
+                           final RoutingType routingType,
+                           final int maxConsumers) {
       this.durable = durable;
 
       this.temporary = temporary;
@@ -72,9 +73,17 @@ public class QueueQueryResult {
 
       this.name = name;
 
-      this.autoCreateJmsQueues = autoCreateJmsQueues;
+      this.autoCreateQueues = autoCreateQueues;
 
       this.exists = exists;
+
+      this.autoCreated = autoCreated;
+
+      this.deleteOnNoConsumers = deleteOnNoConsumers;
+
+      this.routingType = routingType;
+
+      this.maxConsumers = maxConsumers;
    }
 
    public boolean isExists() {
@@ -109,8 +118,23 @@ public class QueueQueryResult {
       return temporary;
    }
 
-   public boolean isAutoCreateJmsQueues() {
-      return autoCreateJmsQueues;
+   public boolean isAutoCreateQueues() {
+      return autoCreateQueues;
+   }
+
+   public boolean isAutoCreated() {
+      return autoCreated;
    }
 
+   public boolean isDeleteOnNoConsumers() {
+      return deleteOnNoConsumers;
+   }
+
+   public RoutingType getRoutingType() {
+      return routingType;
+   }
+
+   public int getMaxConsumers() {
+      return maxConsumers;
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java
index 883a71d..a6d047a 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java
@@ -91,6 +91,11 @@ public class ActiveMQQueue extends ActiveMQDestination implements Queue {
       return super.getAddress().equals(that.getAddress());
    }
 
+   @Override
+   public int hashCode() {
+      return super.getAddress().hashCode();
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java
----------------------------------------------------------------------
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 d0c9592..3e9b76f 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
@@ -1074,7 +1074,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
 
       QueueQuery response = session.queueQuery(queue.getSimpleAddress());
 
-      if (!response.isExists() && !response.isAutoCreateJmsQueues()) {
+      if (!response.isExists() && !response.isAutoCreateQueues()) {
          return null;
       } else {
          return queue;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java
index daae8ed..88a822a 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java
@@ -67,6 +67,11 @@ public class ActiveMQTemporaryQueue extends ActiveMQQueue implements TemporaryQu
       return super.getAddress().equals(that.getAddress());
    }
 
+   @Override
+   public int hashCode() {
+      return super.getAddress().hashCode();
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java
index 4cccb81..98b5ba6 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java
@@ -51,6 +51,11 @@ public class ActiveMQTemporaryTopic extends ActiveMQTopic implements TemporaryTo
       return super.getAddress().equals(that.getAddress());
    }
 
+   @Override
+   public int hashCode() {
+      return super.getAddress().hashCode();
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java
index e251e6a..941b440 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java
@@ -86,6 +86,11 @@ public class ActiveMQTopic extends ActiveMQDestination implements Topic {
       return super.getAddress().equals(that.getAddress());
    }
 
+   @Override
+   public int hashCode() {
+      return super.getAddress().hashCode();
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
index acbb2e9..6382cb2 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
@@ -207,13 +207,13 @@ public class AMQPSessionCallback implements SessionCallback {
    public QueueQueryResult queueQuery(String queueName, boolean autoCreate) throws Exception {
       QueueQueryResult queueQueryResult = serverSession.executeQueueQuery(SimpleString.toSimpleString(queueName));
 
-      if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateJmsQueues() && autoCreate) {
+      if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateQueues() && autoCreate) {
          try {
             serverSession.createQueue(new SimpleString(queueName), new SimpleString(queueName), null, false, true);
          } catch (ActiveMQQueueExistsException e) {
             // The queue may have been created by another thread in the mean time.  Catch and do nothing.
          }
-         queueQueryResult = new QueueQueryResult(queueQueryResult.getName(), queueQueryResult.getAddress(), queueQueryResult.isDurable(), queueQueryResult.isTemporary(), queueQueryResult.getFilterString(), queueQueryResult.getConsumerCount(), queueQueryResult.getMessageCount(), queueQueryResult.isAutoCreateJmsQueues(), true);
+         queueQueryResult = new QueueQueryResult(queueQueryResult.getName(), queueQueryResult.getAddress(), queueQueryResult.isDurable(), queueQueryResult.isTemporary(), queueQueryResult.getFilterString(), queueQueryResult.getConsumerCount(), queueQueryResult.getMessageCount(), queueQueryResult.isAutoCreateQueues(), true, queueQueryResult.isAutoCreated(), queueQueryResult.isDeleteOnNoConsumers(), queueQueryResult.getRoutingType(), queueQueryResult.getMaxConsumers());
       }
       return queueQueryResult;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java
----------------------------------------------------------------------
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 65ffc69..d3cc617 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
@@ -54,6 +54,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionInd
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V2;
+import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V3;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
@@ -218,7 +219,9 @@ public class ServerSessionPacketHandler implements ChannelHandler {
                      // We send back queue information on the queue as a response- this allows the queue to
                      // be automatically recreated on failover
                      QueueQueryResult queueQueryResult = session.executeQueueQuery(request.getQueueName());
-                     if (channel.supports(PacketImpl.SESS_QUEUEQUERY_RESP_V2)) {
+                     if (channel.supports(PacketImpl.SESS_QUEUEQUERY_RESP_V3)) {
+                        response = new SessionQueueQueryResponseMessage_V3(queueQueryResult);
+                     } else if (channel.supports(PacketImpl.SESS_QUEUEQUERY_RESP_V2)) {
                         response = new SessionQueueQueryResponseMessage_V2(queueQueryResult);
                      } else {
                         response = new SessionQueueQueryResponseMessage(queueQueryResult);
@@ -284,7 +287,9 @@ public class ServerSessionPacketHandler implements ChannelHandler {
                   requiresResponse = true;
                   SessionQueueQueryMessage request = (SessionQueueQueryMessage) packet;
                   QueueQueryResult result = session.executeQueueQuery(request.getQueueName());
-                  if (channel.supports(PacketImpl.SESS_QUEUEQUERY_RESP_V2)) {
+                  if (channel.supports(PacketImpl.SESS_QUEUEQUERY_RESP_V3)) {
+                     response = new SessionQueueQueryResponseMessage_V3(result);
+                  } else if (channel.supports(PacketImpl.SESS_QUEUEQUERY_RESP_V2)) {
                      response = new SessionQueueQueryResponseMessage_V2(result);
                   } else {
                      response = new SessionQueueQueryResponseMessage(result);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/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 d6b1be4..2147868 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
@@ -651,7 +651,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
          throw ActiveMQMessageBundle.BUNDLE.queueNameIsNull();
       }
 
-      boolean autoCreateJmsQueues = getAddressSettingsRepository().getMatch(name.toString()).isAutoCreateQueues();
+      boolean autoCreateQueues = getAddressSettingsRepository().getMatch(name.toString()).isAutoCreateQueues();
 
       QueueQueryResult response;
 
@@ -666,14 +666,14 @@ public class ActiveMQServerImpl implements ActiveMQServer {
 
          SimpleString filterString = filter == null ? null : filter.getFilterString();
 
-         response = new QueueQueryResult(name, binding.getAddress(), queue.isDurable(), queue.isTemporary(), filterString, queue.getConsumerCount(), queue.getMessageCount(), autoCreateJmsQueues);
+         response = new QueueQueryResult(name, binding.getAddress(), queue.isDurable(), queue.isTemporary(), filterString, queue.getConsumerCount(), queue.getMessageCount(), autoCreateQueues, true, queue.isAutoCreated(), queue.isDeleteOnNoConsumers(), queue.getRoutingType(), queue.getMaxConsumers());
       } else if (name.equals(managementAddress)) {
          // make an exception for the management address (see HORNETQ-29)
-         response = new QueueQueryResult(name, managementAddress, true, false, null, -1, -1, autoCreateJmsQueues);
-      } else if (autoCreateJmsQueues) {
-         response = new QueueQueryResult(name, name, true, false, null, 0, 0, true, false);
+         response = new QueueQueryResult(name, managementAddress, true, false, null, -1, -1, autoCreateQueues, true, false, false, RoutingType.MULTICAST, -1);
+      } else if (autoCreateQueues) {
+         response = new QueueQueryResult(name, name, true, false, null, 0, 0, true, false, false, false, null, 0);
       } else {
-         response = new QueueQueryResult(null, null, false, false, null, 0, 0, false, false);
+         response = new QueueQueryResult(null, null, false, false, null, 0, 0, false, false, false, false, null, 0);
       }
 
       return response;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionTest.java
----------------------------------------------------------------------
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 0882078..2242cfc 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionTest.java
@@ -234,7 +234,7 @@ public class SessionTest extends ActiveMQTestBase {
       ClientSession clientSession = cf.createSession(false, true, true);
       QueueQuery resp = clientSession.queueQuery(new SimpleString(queueName));
       Assert.assertFalse(resp.isExists());
-      Assert.assertFalse(resp.isAutoCreateJmsQueues());
+      Assert.assertFalse(resp.isAutoCreateQueues());
       Assert.assertEquals(null, resp.getAddress());
       clientSession.close();
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be9483a7/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java
index 92741e7..da05fae 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java
@@ -39,6 +39,7 @@ import org.apache.activemq.artemis.api.jms.JMSFactoryType;
 import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServers;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.jms.client.ActiveMQSession;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
@@ -100,7 +101,7 @@ public class JMSReconnectTest extends ActiveMQTestBase {
 
       SimpleString jmsQueueName = new SimpleString("myqueue");
 
-      coreSession.createQueue(jmsQueueName, jmsQueueName, null, true);
+      coreSession.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true);
 
       Queue queue = sess.createQueue("myqueue");
 


[10/27] activemq-artemis git commit: Fix createSharedQueue Impl

Posted by ma...@apache.org.
Fix createSharedQueue Impl


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

Branch: refs/heads/ARTEMIS-780
Commit: fa926e48854975cf107f39ff07f21d7e2b49a320
Parents: 9e3953b
Author: Martyn Taylor <mt...@redhat.com>
Authored: Tue Nov 29 14:11:27 2016 +0000
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Tue Nov 29 14:11:27 2016 +0000

----------------------------------------------------------------------
 .../core/server/impl/ActiveMQServerImpl.java     | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fa926e48/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 d27fad2..8546fc2 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
@@ -1472,7 +1472,10 @@ public class ActiveMQServerImpl implements ActiveMQServer {
    }
 
    @Override
-   public void createSharedQueue(final SimpleString address, RoutingType routingType, final SimpleString name, final SimpleString filterString,
+   public void createSharedQueue(final SimpleString address,
+                                 RoutingType routingType,
+                                 final SimpleString name,
+                                 final SimpleString filterString,
                                  final SimpleString user,
                                  boolean durable) throws Exception {
       //force the old contract about address
@@ -1488,7 +1491,19 @@ public class ActiveMQServerImpl implements ActiveMQServer {
          }
       }
 
-      final Queue queue = createQueue(address, routingType, name, filterString, user, durable, !durable, false);
+      final Queue queue = createQueue(address,
+                                      name,
+                                      routingType,
+                                      filterString,
+                                      user,
+                                      durable,
+                                      !durable,
+                                      true,
+                                      !durable,
+                                      false,
+                                      Queue.MAX_CONSUMERS_UNLIMITED,
+                                      false,
+                                      true);
 
       if (!queue.getAddress().equals(address)) {
          throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentAddress(name);


[11/27] activemq-artemis git commit: Added RoutingType to message

Posted by ma...@apache.org.
Added RoutingType to message


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

Branch: refs/heads/ARTEMIS-780
Commit: fea23a1c7c7bb8e96f1a9d13b156e81ffecb0b49
Parents: fa926e4
Author: Martyn Taylor <mt...@redhat.com>
Authored: Tue Nov 29 15:24:31 2016 +0000
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Tue Nov 29 15:36:41 2016 +0000

----------------------------------------------------------------------
 .../activemq/artemis/api/core/Message.java      |  5 +++
 .../wireformat/CreateSharedQueueMessage_V2.java |  1 -
 .../jms/client/ActiveMQMessageProducer.java     |  4 ++
 .../core/postoffice/impl/LocalQueueBinding.java | 18 ++++++--
 .../core/postoffice/impl/PostOfficeImpl.java    |  5 +++
 .../artemis/jms/tests/MessageProducerTest.java  | 46 ++++++++++++++++++++
 6 files changed, 75 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fea23a1c/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
index 1ea9309..80116ed 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
@@ -112,6 +112,11 @@ public interface Message {
     */
    SimpleString HDR_VALIDATED_USER = new SimpleString("_AMQ_VALIDATED_USER");
 
+   /**
+    * The Routing Type for this message.  Ensures that this message is only routed to queues with matching routing type.
+    */
+   SimpleString HDR_ROUTING_TYPE = new SimpleString("_AMQ_ROUTING_TYPE");
+
    byte DEFAULT_TYPE = 0;
 
    byte OBJECT_TYPE = 2;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fea23a1c/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java
index 40b9cb5..c8bf86e 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java
@@ -64,7 +64,6 @@ public class CreateSharedQueueMessage_V2 extends CreateSharedQueueMessage {
       return buff.toString();
    }
 
-
    @Override
    public void encodeRest(final ActiveMQBuffer buffer) {
       buffer.writeSimpleString(address);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fea23a1c/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
----------------------------------------------------------------------
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 47d9ff2..aa4754b 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
@@ -41,6 +41,7 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage;
 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.SendAcknowledgementHandler;
+import org.apache.activemq.artemis.core.message.impl.MessageImpl;
 import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.utils.UUID;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
@@ -491,6 +492,9 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
       ClientMessage coreMessage = activeMQJmsMessage.getCoreMessage();
       coreMessage.putStringProperty(ActiveMQConnection.CONNECTION_ID_PROPERTY_NAME, connID);
 
+      byte routingType = destination.isQueue() ? RoutingType.ANYCAST.getType() : RoutingType.MULTICAST.getType();
+      coreMessage.putByteProperty(MessageImpl.HDR_ROUTING_TYPE, routingType);
+
       try {
          /**
           * Using a completionListener requires wrapping using a {@link CompletionListenerWrapper},

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fea23a1c/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
index 30e3768..d02f0f0 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
@@ -18,12 +18,13 @@ package org.apache.activemq.artemis.core.postoffice.impl;
 
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.filter.Filter;
+import org.apache.activemq.artemis.core.message.impl.MessageInternal;
 import org.apache.activemq.artemis.core.postoffice.BindingType;
 import org.apache.activemq.artemis.core.postoffice.QueueBinding;
 import org.apache.activemq.artemis.core.server.Bindable;
-import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.RoutingContext;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.ServerMessage;
 
 public class LocalQueueBinding implements QueueBinding {
@@ -117,12 +118,23 @@ public class LocalQueueBinding implements QueueBinding {
 
    @Override
    public void route(final ServerMessage message, final RoutingContext context) throws Exception {
-      queue.route(message, context);
+      if (isMatchRoutingType(message)) {
+         queue.route(message, context);
+      }
    }
 
    @Override
    public void routeWithAck(ServerMessage message, RoutingContext context) throws Exception {
-      queue.routeWithAck(message, context);
+      if (isMatchRoutingType(message)) {
+         queue.routeWithAck(message, context);
+      }
+   }
+
+   private boolean isMatchRoutingType(ServerMessage message) {
+      if (message.containsProperty(MessageInternal.HDR_ROUTING_TYPE)) {
+         return message.getByteProperty(MessageInternal.HDR_ROUTING_TYPE) == queue.getRoutingType().getType();
+      }
+      return true;
    }
 
    public boolean isQueueBinding() {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fea23a1c/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
----------------------------------------------------------------------
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 dc73680..2fc3409 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
@@ -655,6 +655,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
                               final RoutingContext context,
                               final boolean direct,
                               boolean rejectDuplicates) throws Exception {
+
       RoutingStatus result = RoutingStatus.OK;
       // Sanity check
       if (message.getRefCount() > 0) {
@@ -663,6 +664,10 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
 
       SimpleString address = message.getAddress();
 
+      if (address.toString().equals("testQueue")) {
+         System.out.println("f");
+      }
+
       setPagingStore(message);
 
       AtomicBoolean startedTX = new AtomicBoolean(false);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fea23a1c/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java
----------------------------------------------------------------------
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 d001f5b..c5fb964 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
@@ -25,19 +25,29 @@ import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
+import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.TextMessage;
+import javax.jms.Topic;
 import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.core.server.RoutingType;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.jms.tests.message.SimpleJMSMessage;
 import org.apache.activemq.artemis.jms.tests.message.SimpleJMSTextMessage;
 import org.apache.activemq.artemis.jms.tests.util.ProxyAssertSupport;
 import org.junit.Test;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 public class MessageProducerTest extends JMSTestCase {
 
    @Test
@@ -695,6 +705,42 @@ public class MessageProducerTest extends JMSTestCase {
 
       ProxyAssertSupport.assertTrue(listener.exception instanceof javax.jms.IllegalStateException);
    }
+
+   @Test
+   public void testSendToQueueOnlyWhenTopicWithSameAddress() throws Exception {
+      SimpleString addr = SimpleString.toSimpleString("testAddr");
+
+      Set<RoutingType> supportedRoutingTypes = new HashSet<>();
+      supportedRoutingTypes.add(RoutingType.ANYCAST);
+      supportedRoutingTypes.add(RoutingType.MULTICAST);
+
+      servers.get(0).getActiveMQServer().createAddressInfo(new AddressInfo(addr, supportedRoutingTypes));
+      servers.get(0).getActiveMQServer().createQueue(addr, RoutingType.ANYCAST, addr, null, false, false);
+
+      Connection pconn = createConnection();
+      pconn.start();
+
+      Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      Queue queue = ps.createQueue(addr.toString());
+      Topic topic = ps.createTopic(addr.toString());
+
+      MessageConsumer queueConsumer = ps.createConsumer(queue);
+      MessageConsumer topicConsumer = ps.createConsumer(topic);
+
+      MessageProducer queueProducer = ps.createProducer(queue);
+      queueProducer.send(ps.createMessage());
+
+      assertNotNull(queueConsumer.receive(1000));
+      assertNull(topicConsumer.receive(1000));
+
+      MessageProducer topicProducer = ps.createProducer(topic);
+      topicProducer.send(ps.createMessage());
+
+      assertNull(queueConsumer.receive(1000));
+      assertNotNull(topicConsumer.receive(1000));
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------


[04/27] activemq-artemis git commit: Security for removing address

Posted by ma...@apache.org.
Security for removing address


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

Branch: refs/heads/ARTEMIS-780
Commit: 644db6334d9665421054df7c7926457e1e629ffd
Parents: dad0496
Author: jbertram <jb...@apache.com>
Authored: Wed Nov 23 13:34:00 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 14:19:20 2016 -0600

----------------------------------------------------------------------
 .../core/management/impl/ActiveMQServerControlImpl.java     | 2 +-
 .../apache/activemq/artemis/core/security/CheckType.java    | 6 ++++++
 .../apache/activemq/artemis/core/server/ActiveMQServer.java | 2 +-
 .../artemis/core/server/impl/ActiveMQServerImpl.java        | 9 +++++++--
 4 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/644db633/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 185d5c4..c237b70 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
@@ -580,7 +580,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
 
       clearIO();
       try {
-         server.removeAddressInfo(new SimpleString(name));
+         server.removeAddressInfo(new SimpleString(name), null);
       } finally {
          blockOnIO();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/644db633/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/CheckType.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/CheckType.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/CheckType.java
index abea943..92e92df 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/CheckType.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/CheckType.java
@@ -35,6 +35,12 @@ public enum CheckType {
          return role.isCreateAddress();
       }
    },
+   DELETE_ADDRESS {
+      @Override
+      public boolean hasRole(final Role role) {
+         return role.isDeleteAddress();
+      }
+   },
    CREATE_DURABLE_QUEUE {
       @Override
       public boolean hasRole(final Role role) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/644db633/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
----------------------------------------------------------------------
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 31a6080..443ced7 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
@@ -448,7 +448,7 @@ public interface ActiveMQServer extends ActiveMQComponent {
 
    AddressInfo createOrUpdateAddressInfo(AddressInfo addressInfo) throws Exception;
 
-   void removeAddressInfo(SimpleString address) throws Exception;
+   void removeAddressInfo(SimpleString address, SecurityAuth session) throws Exception;
 
    String getInternalNamingPrefix();
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/644db633/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 9128424..5f60429 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
@@ -1647,7 +1647,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
 
       if (autoDeleteAddress && postOffice != null) {
          try {
-            removeAddressInfo(address);
+            removeAddressInfo(address, session);
          } catch (ActiveMQDeleteAddressException e) {
             // Could be thrown if the address has bindings or is not deletable.
          }
@@ -2322,7 +2322,12 @@ public class ActiveMQServerImpl implements ActiveMQServer {
    }
 
    @Override
-   public void removeAddressInfo(SimpleString address) throws Exception {
+   public void removeAddressInfo(final SimpleString address,
+                                 final SecurityAuth session) throws Exception {
+      if (session != null) {
+         securityStore.check(address, CheckType.DELETE_ADDRESS, session);
+      }
+
       AddressInfo addressInfo = getAddressInfo(address);
       if (postOffice.removeAddressInfo(address) == null) {
          throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(address);


[09/27] activemq-artemis git commit: Create/delete queue JMX stuff

Posted by ma...@apache.org.
Create/delete queue JMX stuff


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

Branch: refs/heads/ARTEMIS-780
Commit: 9e3953b3afa1bfa0672a39bdffba00755fd9f7dc
Parents: 3017201
Author: jbertram <jb...@apache.com>
Authored: Mon Nov 28 21:20:25 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 21:20:25 2016 -0600

----------------------------------------------------------------------
 .../core/management/ActiveMQServerControl.java  | 44 ++++++++++++++------
 .../api/core/management/QueueControl.java       | 12 ++++++
 .../impl/ActiveMQServerControlImpl.java         | 18 ++++----
 .../core/management/impl/QueueControlImpl.java  | 24 +++++++++++
 .../core/server/impl/ActiveMQServerImpl.java    |  2 +-
 .../management/ActiveMQServerControlTest.java   | 37 ++++++++++++++++
 .../ActiveMQServerControlUsingCoreTest.java     | 24 +++++------
 .../management/QueueControlUsingCoreTest.java   | 10 +++++
 8 files changed, 136 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e3953b3/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
----------------------------------------------------------------------
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 f002b5c..b6b5b5e 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
@@ -20,7 +20,6 @@ import javax.management.MBeanOperationInfo;
 import java.util.Map;
 
 import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException;
-import org.apache.activemq.artemis.core.server.RoutingType;
 
 /**
  * An ActiveMQServerControl is used to manage ActiveMQ Artemis servers.
@@ -456,14 +455,21 @@ public interface ActiveMQServerControl {
    void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
                     @Parameter(name = "name", desc = "Name of the queue") String name) throws Exception;
 
+   /**
+    * Create a queue.
+    * <br>
+    * If {@code address} is {@code null} it will be defaulted to {@code name}.
+    * <br>
+    * This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exits.
+    *
+    * @param address address to bind the queue to
+    * @param name    name of the queue
+    * @param durable whether the queue is durable
+    */
+   @Operation(desc = "Create a queue with the specified address, name and durability", impact = MBeanOperationInfo.ACTION)
    void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
-                    @Parameter(name = "routingType", desc = "The routing type used for this address, 0=multicast, 1=anycast") RoutingType routingType,
                     @Parameter(name = "name", desc = "Name of the queue") String name,
-                    @Parameter(name = "filter", desc = "Filter of the queue") String filterStr,
-                    @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable,
-                    @Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers,
-                    @Parameter(name = "deleteOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean deleteOnNoConsumers,
-                    @Parameter(name = "autoCreateAddress", desc = "Create an address with default values should a matching address not be found") boolean autoCreateAddress) throws Exception;
+                    @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable) throws Exception;
 
    /**
     * Create a queue.
@@ -490,14 +496,25 @@ public interface ActiveMQServerControl {
     * <br>
     * This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exits.
     *
-    * @param address address to bind the queue to
-    * @param name    name of the queue
-    * @param durable whether the queue is durable
+    * @param address             address to bind the queue to
+    * @param routingType         the routing type used for this address, {@code MULTICAST} or {@code ANYCAST}
+    * @param name                name of the queue
+    * @param filterStr           filter of the queue
+    * @param durable             is the queue durable?
+    * @param maxConsumers        the maximum number of consumers allowed on this queue at any one time
+    * @param deleteOnNoConsumers delete this queue when the last consumer disconnects
+    * @param autoCreateAddress   create an address with default values should a matching address not be found
+    * @throws Exception
     */
-   @Operation(desc = "Create a queue with the specified address, name and durability", impact = MBeanOperationInfo.ACTION)
    void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
+                    @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType,
                     @Parameter(name = "name", desc = "Name of the queue") String name,
-                    @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable) throws Exception;
+                    @Parameter(name = "filter", desc = "Filter of the queue") String filterStr,
+                    @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable,
+                    @Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers,
+                    @Parameter(name = "deleteOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean deleteOnNoConsumers,
+                    @Parameter(name = "autoCreateAddress", desc = "Create an address with default values should a matching address not be found") boolean autoCreateAddress) throws Exception;
+
 
    /**
     * Deploy a durable queue.
@@ -551,7 +568,8 @@ public interface ActiveMQServerControl {
     */
    @Operation(desc = "Destroy a queue", impact = MBeanOperationInfo.ACTION)
    void destroyQueue(@Parameter(name = "name", desc = "Name of the queue to destroy") String name,
-                     @Parameter(name = "removeConsumers", desc = "Remove consumers of this queue") boolean removeConsumers, boolean autoDeleteAddress) throws Exception;
+                     @Parameter(name = "removeConsumers", desc = "Remove consumers of this queue") boolean removeConsumers,
+                     @Parameter(name = "autoDeleteAddress", desc = "Automatically delete the address if this was the last queue") boolean autoDeleteAddress) throws Exception;
 
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e3953b3/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java
index bbf365c..dbd3ea5 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java
@@ -140,6 +140,18 @@ public interface QueueControl {
    @Attribute(desc = "dead-letter address associated with this queue")
    String getDeadLetterAddress();
 
+   /**
+    *
+    */
+   @Attribute(desc = "maximum number of consumers allowed on this queue at any one time")
+   int getMaxConsumers();
+
+   /**
+    *
+    */
+   @Attribute(desc = "delete this queue when the last consumer disconnects")
+   boolean isDeleteOnNoConsumers();
+
    // Operations ----------------------------------------------------
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e3953b3/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 c9214f3..9e103f4 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
@@ -647,14 +647,14 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
    }
 
    @Override
-   public void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
-                           @Parameter(name = "routingType", desc = "The routing type used for this address, 0=multicast, 1=anycast") RoutingType routingType,
-                           @Parameter(name = "name", desc = "Name of the queue") String name,
-                           @Parameter(name = "filter", desc = "Filter of the queue") String filterStr,
-                           @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable,
-                           @Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers,
-                           @Parameter(name = "deleteOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean deleteOnNoConsumers,
-                           @Parameter(name = "autoCreateAddress", desc = "Create an address with default values should a matching address not be found") boolean autoCreateAddress) throws Exception {
+   public void createQueue(String address,
+                           String routingType,
+                           String name,
+                           String filterStr,
+                           boolean durable,
+                           int maxConsumers,
+                           boolean deleteOnNoConsumers,
+                           boolean autoCreateAddress) throws Exception {
       checkStarted();
 
       clearIO();
@@ -665,7 +665,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
             filter = new SimpleString(filterStr);
          }
 
-         server.createQueue(SimpleString.toSimpleString(address), routingType, new SimpleString(name), filter, durable, false, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
+         server.createQueue(SimpleString.toSimpleString(address), RoutingType.valueOf(routingType), new SimpleString(name), filter, durable, false, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
       } finally {
          blockOnIO();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e3953b3/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
index c4d25ac..3bbbac8 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
@@ -332,6 +332,30 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
    }
 
    @Override
+   public int getMaxConsumers() {
+      checkStarted();
+
+      clearIO();
+      try {
+         return queue.getMaxConsumers();
+      } finally {
+         blockOnIO();
+      }
+   }
+
+   @Override
+   public boolean isDeleteOnNoConsumers() {
+      checkStarted();
+
+      clearIO();
+      try {
+         return queue.isDeleteOnNoConsumers();
+      } finally {
+         blockOnIO();
+      }
+   }
+
+   @Override
    public Map<String, Object>[] listScheduledMessages() throws Exception {
       checkStarted();
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e3953b3/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 ccc0b89..d27fad2 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
@@ -2386,7 +2386,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       }
 
       AddressInfo defaultAddressInfo = new AddressInfo(addressName);
-      defaultAddressInfo.addRoutingType(ActiveMQDefaultConfiguration.getDefaultRoutingType());
+      defaultAddressInfo.addRoutingType(routingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType() : routingType);
       AddressInfo info = postOffice.getAddressInfo(addressName);
 
       if (info == null) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e3953b3/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
----------------------------------------------------------------------
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 142c3d5..1073f67 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
@@ -37,6 +37,7 @@ 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.ActiveMQServerControl;
+import org.apache.activemq.artemis.api.core.management.AddressControl;
 import org.apache.activemq.artemis.api.core.management.AddressSettingsInfo;
 import org.apache.activemq.artemis.api.core.management.BridgeControl;
 import org.apache.activemq.artemis.api.core.management.DivertControl;
@@ -52,6 +53,7 @@ import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
 import org.apache.activemq.artemis.core.security.Role;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServers;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
 import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
 import org.apache.activemq.artemis.jlibaio.LibaioContext;
@@ -252,6 +254,41 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
    }
 
    @Test
+   public void testCreateAndDestroyQueue_4() throws Exception {
+      SimpleString address = RandomUtil.randomSimpleString();
+      SimpleString name = RandomUtil.randomSimpleString();
+      boolean durable = RandomUtil.randomBoolean();
+      boolean deleteOnNoConsumers = RandomUtil.randomBoolean();
+      boolean autoCreateAddress = true;
+      int maxConsumers = RandomUtil.randomInt();
+
+      ActiveMQServerControl serverControl = createManagementControl();
+
+      checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
+
+      serverControl.createQueue(address.toString(), RoutingType.ANYCAST.toString(), name.toString(), null, durable, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
+
+      checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
+      QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, mbeanServer);
+      Assert.assertEquals(address.toString(), queueControl.getAddress());
+      Assert.assertEquals(name.toString(), queueControl.getName());
+      Assert.assertNull(queueControl.getFilter());
+      Assert.assertEquals(durable, queueControl.isDurable());
+      Assert.assertEquals(deleteOnNoConsumers, queueControl.isDeleteOnNoConsumers());
+      Assert.assertEquals(maxConsumers, queueControl.getMaxConsumers());
+      Assert.assertEquals(false, queueControl.isTemporary());
+
+      checkResource(ObjectNameBuilder.DEFAULT.getAddressObjectName(address));
+      AddressControl addressControl = ManagementControlHelper.createAddressControl(address, mbeanServer);
+      Assert.assertEquals(address.toString(), addressControl.getAddress());
+
+      serverControl.destroyQueue(name.toString(), true, true);
+
+      checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
+      checkNoResource(ObjectNameBuilder.DEFAULT.getAddressObjectName(address));
+   }
+
+   @Test
    public void testCreateAndDestroyQueueClosingConsumers() throws Exception {
       SimpleString address = RandomUtil.randomSimpleString();
       SimpleString name = RandomUtil.randomSimpleString();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e3953b3/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
----------------------------------------------------------------------
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 7508a37..193c58c 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
@@ -22,7 +22,6 @@ 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 org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 
 public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTest {
@@ -102,15 +101,15 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
          }
 
          @Override
-         public void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address,
-                                 @Parameter(name = "routingType", desc = "The routing type used for this address, 0=multicast, 1=anycast") RoutingType routingType,
-                                 @Parameter(name = "name", desc = "Name of the queue") String name,
-                                 @Parameter(name = "filter", desc = "Filter of the queue") String filterStr,
-                                 @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable,
-                                 @Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers,
-                                 @Parameter(name = "deleteOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean deleteOnNoConsumers,
-                                 @Parameter(name = "autoCreateAddress", desc = "Create an address with default values should a matching address not be found") boolean autoCreateAddress) throws Exception {
-
+         public void createQueue(String address,
+                                 String routingType,
+                                 String name,
+                                 String filterStr,
+                                 boolean durable,
+                                 int maxConsumers,
+                                 boolean deleteOnNoConsumers,
+                                 boolean autoCreateAddress) throws Exception {
+            proxy.invokeOperation("createQueue", address, routingType, name, filterStr, durable, maxConsumers, deleteOnNoConsumers, autoCreateAddress);
          }
 
 
@@ -157,9 +156,10 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
          }
 
          @Override
-         public void destroyQueue(@Parameter(name = "name", desc = "Name of the queue to destroy") String name,
-                                  @Parameter(name = "removeConsumers", desc = "Remove consumers of this queue") boolean removeConsumers,
+         public void destroyQueue(String name,
+                                  boolean removeConsumers,
                                   boolean autoDeleteAddress) throws Exception {
+            proxy.invokeOperation("destroyQueue", name, removeConsumers, autoDeleteAddress);
          }
 
          @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9e3953b3/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
index 250289a..34a6e4f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlUsingCoreTest.java
@@ -82,6 +82,16 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
          }
 
          @Override
+         public int getMaxConsumers() {
+            return (Integer) proxy.retrieveAttributeValue("maxConsumers");
+         }
+
+         @Override
+         public boolean isDeleteOnNoConsumers() {
+            return (Boolean) proxy.retrieveAttributeValue("deleteOnNoConsumers");
+         }
+
+         @Override
          public int getDeliveringCount() {
             return (Integer) proxy.retrieveAttributeValue("deliveringCount", Integer.class);
          }


[03/27] activemq-artemis git commit: Fix AutoDeleteJmsDestinationTest

Posted by ma...@apache.org.
Fix AutoDeleteJmsDestinationTest


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

Branch: refs/heads/ARTEMIS-780
Commit: 8be9a467348424d939c71d31ceef867492994d45
Parents: 644db63
Author: jbertram <jb...@apache.com>
Authored: Wed Nov 23 13:36:16 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 14:19:20 2016 -0600

----------------------------------------------------------------------
 .../tests/integration/client/AutoDeleteJmsDestinationTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8be9a467/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java
index 0e9b2e9..0c63e4c 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java
@@ -82,7 +82,7 @@ public class AutoDeleteJmsDestinationTest extends JMSTestBase {
 
    @Test
    public void testAutoDeleteNegative() throws Exception {
-      server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoDeleteJmsQueues(false));
+      server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoDeleteQueues(false));
       Connection connection = cf.createConnection();
       Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 


[24/27] activemq-artemis git commit: Fix NPE with QueueQueryV3 plus a couple other things

Posted by ma...@apache.org.
Fix NPE with QueueQueryV3 plus a couple other things


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

Branch: refs/heads/ARTEMIS-780
Commit: 6ae97b22fff26c1eaa6a192529d0ab34125db73f
Parents: 762e4f1
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 23:57:05 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Wed Nov 30 00:05:27 2016 -0600

----------------------------------------------------------------------
 .../core/protocol/core/impl/ActiveMQSessionContext.java        | 3 +--
 .../activemq/artemis/core/server/impl/ActiveMQServerImpl.java  | 6 +++---
 .../apache/activemq/artemis/core/server/impl/AddressInfo.java  | 4 +++-
 3 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6ae97b22/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
----------------------------------------------------------------------
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 1a52e9b..5707645 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
@@ -79,7 +79,6 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionInd
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionProducerCreditsFailMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
-import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V2;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage_V3;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
 import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
@@ -266,7 +265,7 @@ public class ActiveMQSessionContext extends SessionContext {
    @Override
    public ClientSession.QueueQuery queueQuery(final SimpleString queueName) throws ActiveMQException {
       SessionQueueQueryMessage request = new SessionQueueQueryMessage(queueName);
-      SessionQueueQueryResponseMessage_V2 response = (SessionQueueQueryResponseMessage_V2) sessionChannel.sendBlocking(request, PacketImpl.SESS_QUEUEQUERY_RESP_V2);
+      SessionQueueQueryResponseMessage_V3 response = (SessionQueueQueryResponseMessage_V3) sessionChannel.sendBlocking(request, PacketImpl.SESS_QUEUEQUERY_RESP_V3);
 
       return response.toQueueQuery();
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6ae97b22/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 2147868..cf862c5 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
@@ -671,9 +671,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
          // make an exception for the management address (see HORNETQ-29)
          response = new QueueQueryResult(name, managementAddress, true, false, null, -1, -1, autoCreateQueues, true, false, false, RoutingType.MULTICAST, -1);
       } else if (autoCreateQueues) {
-         response = new QueueQueryResult(name, name, true, false, null, 0, 0, true, false, false, false, null, 0);
+         response = new QueueQueryResult(name, name, true, false, null, 0, 0, true, false, false, false, RoutingType.MULTICAST, 0);
       } else {
-         response = new QueueQueryResult(null, null, false, false, null, 0, 0, false, false, false, false, null, 0);
+         response = new QueueQueryResult(null, null, false, false, null, 0, 0, false, false, false, false, RoutingType.MULTICAST, 0);
       }
 
       return response;
@@ -2405,7 +2405,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
 
       if (info == null) {
          if (autoCreateAddress) {
-            postOffice.addAddressInfo(defaultAddressInfo);
+            postOffice.addAddressInfo(defaultAddressInfo.setAutoCreated(true));
             info = postOffice.getAddressInfo(addressName);
          } else {
             throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(addressName);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6ae97b22/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
----------------------------------------------------------------------
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 d05628c..6384ae9 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
@@ -120,7 +120,9 @@ public class AddressInfo {
          buff.append(routingType.toString() + ",");
       }
       // delete hanging comma
-      buff.deleteCharAt(buff.length() - 1);
+      if (buff.charAt(buff.length() - 1) == ',') {
+         buff.deleteCharAt(buff.length() - 1);
+      }
       buff.append("}");
       buff.append(", autoCreated=" + autoCreated);
       buff.append("]");


[15/27] activemq-artemis git commit: Clean up usage of HDR_ROUTING_TYPE; fix JMS tests

Posted by ma...@apache.org.
Clean up usage of HDR_ROUTING_TYPE; fix JMS tests


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

Branch: refs/heads/ARTEMIS-780
Commit: ebf14506321c0d745c0cef9fdbe0d8b0eb600e43
Parents: 1378376
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 15:00:44 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 15:00:44 2016 -0600

----------------------------------------------------------------------
 .../activemq/artemis/reader/MessageUtil.java      | 13 ++++++++++---
 .../artemis/jms/client/ActiveMQMessage.java       | 18 +++++++++++-------
 .../jms/client/ActiveMQMessageConsumer.java       |  2 --
 .../jms/client/ActiveMQMessageProducer.java       |  3 +--
 .../artemis/jms/client/ActiveMQQueue.java         | 15 +++++++++++++++
 .../jms/client/ActiveMQTemporaryQueue.java        | 15 +++++++++++++++
 .../jms/client/ActiveMQTemporaryTopic.java        | 15 +++++++++++++++
 .../artemis/jms/client/ActiveMQTopic.java         | 15 +++++++++++++++
 .../core/postoffice/impl/LocalQueueBinding.java   |  6 +++---
 9 files changed, 85 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java
index 09b1902..9d37cd3 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java
@@ -120,12 +120,19 @@ public class MessageUtil {
    }
 
    public static void clearProperties(Message message) {
+      /**
+       * JavaDoc for this method states:
+       *    Clears a message's properties.
+       *    The message's header fields and body are not cleared.
+       *
+       * Since the {@code Message.HDR_ROUTING_TYPE} is used for the JMSDestination header it isn't cleared
+       */
 
       List<SimpleString> toRemove = new ArrayList<>();
 
       for (SimpleString propName : message.getPropertyNames()) {
-         if (!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
-            propName.startsWith(JMS_)) {
+         if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
+            propName.startsWith(JMS_)) && !propName.equals(Message.HDR_ROUTING_TYPE)) {
             toRemove.add(propName);
          }
       }
@@ -140,7 +147,7 @@ public class MessageUtil {
 
       for (SimpleString propName : message.getPropertyNames()) {
          if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
-            propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME)) {
+            propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME) && !propName.equals(Message.HDR_ROUTING_TYPE)) {
             set.add(propName.toString());
          }
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java
index 283f958..4f0be81 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java
@@ -44,6 +44,7 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
 import org.apache.activemq.artemis.api.jms.ActiveMQJMSConstants;
 import org.apache.activemq.artemis.core.message.impl.MessageInternal;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.reader.MessageUtil;
 import org.apache.activemq.artemis.utils.UUID;
 
@@ -201,8 +202,6 @@ public class ActiveMQMessage implements javax.jms.Message {
 
    private long jmsDeliveryTime;
 
-   private boolean fromQueue;
-
    // Constructors --------------------------------------------------
 
    /*
@@ -399,8 +398,17 @@ public class ActiveMQMessage implements javax.jms.Message {
    public Destination getJMSDestination() throws JMSException {
       if (dest == null) {
          SimpleString address = message.getAddress();
+         String prefix = "";
+         if (message.containsProperty(org.apache.activemq.artemis.api.core.Message.HDR_ROUTING_TYPE)) {
+            RoutingType routingType = RoutingType.getType(message.getByteProperty(org.apache.activemq.artemis.api.core.Message.HDR_ROUTING_TYPE));
+            if (routingType.equals(RoutingType.ANYCAST)) {
+               prefix = QUEUE_QUALIFIED_PREFIX;
+            } else if (routingType.equals(RoutingType.MULTICAST)) {
+               prefix = TOPIC_QUALIFIED_PREFIX;
+            }
+         }
 
-         dest = address == null ? null : ActiveMQDestination.fromPrefixedName((fromQueue ? QUEUE_QUALIFIED_PREFIX : TOPIC_QUALIFIED_PREFIX) + address.toString());
+         dest = address == null ? null : ActiveMQDestination.fromPrefixedName(prefix + address.toString());
       }
 
       return dest;
@@ -779,10 +787,6 @@ public class ActiveMQMessage implements javax.jms.Message {
 
    // Public --------------------------------------------------------
 
-   public void setFromQueue(boolean fromQueue) {
-      this.fromQueue = fromQueue;
-   }
-
    public void setIndividualAcknowledge() {
       this.individualAck = true;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
index b449aea..8bc1fd8 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
@@ -240,8 +240,6 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr
             } else {
                coreMessage.acknowledge();
             }
-
-            jmsMsg.setFromQueue(destination instanceof ActiveMQQueue);
          }
 
          return jmsMsg;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
----------------------------------------------------------------------
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 aa4754b..4c1d335 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
@@ -41,7 +41,6 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage;
 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.SendAcknowledgementHandler;
-import org.apache.activemq.artemis.core.message.impl.MessageImpl;
 import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.utils.UUID;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
@@ -493,7 +492,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
       coreMessage.putStringProperty(ActiveMQConnection.CONNECTION_ID_PROPERTY_NAME, connID);
 
       byte routingType = destination.isQueue() ? RoutingType.ANYCAST.getType() : RoutingType.MULTICAST.getType();
-      coreMessage.putByteProperty(MessageImpl.HDR_ROUTING_TYPE, routingType);
+      coreMessage.putByteProperty(org.apache.activemq.artemis.api.core.Message.HDR_ROUTING_TYPE, routingType);
 
       try {
          /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java
index 2632dae..883a71d 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java
@@ -76,6 +76,21 @@ public class ActiveMQQueue extends ActiveMQDestination implements Queue {
       return "ActiveMQQueue[" + name + "]";
    }
 
+   @Override
+   public boolean equals(final Object o) {
+      if (this == o) {
+         return true;
+      }
+
+      if (!(o instanceof ActiveMQQueue)) {
+         return false;
+      }
+
+      ActiveMQQueue that = (ActiveMQQueue) o;
+
+      return super.getAddress().equals(that.getAddress());
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java
index fa01409..daae8ed 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryQueue.java
@@ -52,6 +52,21 @@ public class ActiveMQTemporaryQueue extends ActiveMQQueue implements TemporaryQu
       return "ActiveMQTemporaryQueue[" + name + "]";
    }
 
+   @Override
+   public boolean equals(final Object o) {
+      if (this == o) {
+         return true;
+      }
+
+      if (!(o instanceof ActiveMQTemporaryQueue)) {
+         return false;
+      }
+
+      ActiveMQTemporaryQueue that = (ActiveMQTemporaryQueue) o;
+
+      return super.getAddress().equals(that.getAddress());
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java
index 07c3ec9..4cccb81 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTemporaryTopic.java
@@ -36,6 +36,21 @@ public class ActiveMQTemporaryTopic extends ActiveMQTopic implements TemporaryTo
 
    // Public --------------------------------------------------------
 
+   @Override
+   public boolean equals(final Object o) {
+      if (this == o) {
+         return true;
+      }
+
+      if (!(o instanceof ActiveMQTemporaryTopic)) {
+         return false;
+      }
+
+      ActiveMQTemporaryTopic that = (ActiveMQTemporaryTopic) o;
+
+      return super.getAddress().equals(that.getAddress());
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java
index 5ffd918..e251e6a 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTopic.java
@@ -71,6 +71,21 @@ public class ActiveMQTopic extends ActiveMQDestination implements Topic {
       return "ActiveMQTopic[" + name + "]";
    }
 
+   @Override
+   public boolean equals(final Object o) {
+      if (this == o) {
+         return true;
+      }
+
+      if (!(o instanceof ActiveMQTopic)) {
+         return false;
+      }
+
+      ActiveMQTopic that = (ActiveMQTopic) o;
+
+      return super.getAddress().equals(that.getAddress());
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ebf14506/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
index fb025af..e09d108 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/LocalQueueBinding.java
@@ -16,9 +16,9 @@
  */
 package org.apache.activemq.artemis.core.postoffice.impl;
 
+import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.filter.Filter;
-import org.apache.activemq.artemis.core.message.impl.MessageInternal;
 import org.apache.activemq.artemis.core.postoffice.BindingType;
 import org.apache.activemq.artemis.core.postoffice.QueueBinding;
 import org.apache.activemq.artemis.core.server.Bindable;
@@ -131,8 +131,8 @@ public class LocalQueueBinding implements QueueBinding {
    }
 
    private boolean isMatchRoutingType(ServerMessage message) {
-      if (message.containsProperty(MessageInternal.HDR_ROUTING_TYPE)) {
-         return message.getByteProperty(MessageInternal.HDR_ROUTING_TYPE).equals(queue.getRoutingType().getType());
+      if (message.containsProperty(Message.HDR_ROUTING_TYPE)) {
+         return message.getByteProperty(Message.HDR_ROUTING_TYPE).equals(queue.getRoutingType().getType());
       }
       return true;
    }


[12/27] activemq-artemis git commit: Fix a few cluster tests

Posted by ma...@apache.org.
Fix a few cluster tests


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

Branch: refs/heads/ARTEMIS-780
Commit: 4e9cda3f6f84675b7c9b26868e4d4a5399951468
Parents: e2844e0
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 10:55:53 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 10:56:16 2016 -0600

----------------------------------------------------------------------
 .../cli/commands/address/CreateAddress.java     |  3 ---
 .../AnycastRoutingWithClusterTest.java          | 10 ++++-----
 .../cluster/distribution/ClusterTestBase.java   | 22 +++++++++++++++++++-
 3 files changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4e9cda3f/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
----------------------------------------------------------------------
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 05df14b..42f721a 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
@@ -17,9 +17,6 @@
 
 package org.apache.activemq.artemis.cli.commands.address;
 
-import java.util.HashSet;
-import java.util.Set;
-
 import io.airlift.airline.Command;
 import io.airlift.airline.Option;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4e9cda3f/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java
index ba7ddd4..6fda0ac 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java
@@ -57,7 +57,7 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase {
       for (int i = 0; i < 3; i++) {
          createAddressInfo(i, address, RoutingType.ANYCAST, -1, false);
          setupSessionFactory(i, isNetty());
-         createQueue(i, address, queueName, null, false);
+         createQueue(i, address, queueName, null, false, RoutingType.ANYCAST);
          addConsumer(i, i, queueName, null);
       }
 
@@ -118,7 +118,7 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase {
       for (int i = 0; i < 3; i++) {
          createAddressInfo(i, address, RoutingType.ANYCAST, -1, false);
          setupSessionFactory(i, isNetty());
-         createQueue(i, address, queueNamePrefix + i, null, false);
+         createQueue(i, address, queueNamePrefix + i, null, false, RoutingType.ANYCAST);
          addConsumer(i, i, queueNamePrefix + i, null);
       }
 
@@ -184,9 +184,9 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase {
       String filter1 = "giraffe";
       String filter2 = "platypus";
 
-      createQueue(0, address, queueNamePrefix + 0, filter1, false);
-      createQueue(1, address, queueNamePrefix + 1, filter1, false);
-      createQueue(2, address, queueNamePrefix + 2, filter2, false);
+      createQueue(0, address, queueNamePrefix + 0, filter1, false, RoutingType.ANYCAST);
+      createQueue(1, address, queueNamePrefix + 1, filter1, false, RoutingType.ANYCAST);
+      createQueue(2, address, queueNamePrefix + 2, filter2, false, RoutingType.ANYCAST);
 
       for (int i = 0; i < 3; i++) {
          addConsumer(i, i, queueNamePrefix + i, null);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4e9cda3f/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java
index 49482d8..e3a39f2 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java
@@ -497,8 +497,28 @@ public abstract class ClusterTestBase extends ActiveMQTestBase {
                               final String queueName,
                               final String filterVal,
                               final boolean durable,
+                              RoutingType routingType) throws Exception {
+      createQueue(node, address, queueName, filterVal, durable, null, null, routingType);
+   }
+
+   protected void createQueue(final int node,
+                              final String address,
+                              final String queueName,
+                              final String filterVal,
+                              final boolean durable,
                               final String user,
                               final String password) throws Exception {
+      createQueue(node, address, queueName, filterVal, durable, user, password, RoutingType.MULTICAST);
+   }
+
+   protected void createQueue(final int node,
+                              final String address,
+                              final String queueName,
+                              final String filterVal,
+                              final boolean durable,
+                              final String user,
+                              final String password,
+                              RoutingType routingType) throws Exception {
       ClientSessionFactory sf = sfs[node];
 
       if (sf == null) {
@@ -515,7 +535,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase {
 
       log.info("Creating " + queueName + " , address " + address + " on " + servers[node]);
 
-      session.createQueue(address, queueName, filterString, durable);
+      session.createQueue(address, routingType, queueName, filterString, durable);
 
       session.close();
    }


[25/27] activemq-artemis git commit: Fix REST Module QueueServiceManager

Posted by ma...@apache.org.
Fix REST Module QueueServiceManager


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

Branch: refs/heads/ARTEMIS-780
Commit: ea81ad182d81e21f6eb3a94cb1911c32a36711a1
Parents: 6ae97b2
Author: Martyn Taylor <mt...@redhat.com>
Authored: Wed Nov 30 12:49:38 2016 +0000
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Wed Nov 30 12:49:38 2016 +0000

----------------------------------------------------------------------
 .../artemis/rest/queue/QueueServiceManager.java        | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea81ad18/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java
----------------------------------------------------------------------
diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java
index a606044..f3efacb 100644
--- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java
+++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java
@@ -21,6 +21,8 @@ import java.util.List;
 
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.core.server.RoutingType;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.jms.client.ConnectionFactoryOptions;
 import org.apache.activemq.artemis.rest.queue.push.FilePushStore;
 import org.apache.activemq.artemis.rest.queue.push.PushStore;
@@ -82,9 +84,16 @@ public class QueueServiceManager extends DestinationServiceManager {
       }
       String queueName = queueDeployment.getName();
       try (ClientSession session = sessionFactory.createSession(false, false, false)) {
-         ClientSession.QueueQuery query = session.queueQuery(new SimpleString(queueName));
+         ClientSession.AddressQuery query = session.addressQuery(SimpleString.toSimpleString(queueName));
          if (!query.isExists()) {
-            session.createQueue(queueName, queueName, queueDeployment.isDurableSend());
+            session.createAddress(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, true);
+            session.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), queueDeployment.isDurableSend());
+         }
+         else {
+            ClientSession.QueueQuery qquery = session.queueQuery(SimpleString.toSimpleString(queueName));
+            if (!qquery.isExists()) {
+               session.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), queueDeployment.isDurableSend());
+            }
          }
       }
 


[07/27] activemq-artemis git commit: Fix address management to use JSON compatible types

Posted by ma...@apache.org.
Fix address management to use JSON compatible 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/806c688e
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/806c688e
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/806c688e

Branch: refs/heads/ARTEMIS-780
Commit: 806c688e6ceacc7f2bdf1bba2318f14e79107c24
Parents: 842c5e5
Author: jbertram <jb...@apache.com>
Authored: Mon Nov 28 17:29:50 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 17:29:50 2016 -0600

----------------------------------------------------------------------
 .../api/core/management/ActiveMQServerControl.java       |  3 +--
 .../core/management/impl/ActiveMQServerControlImpl.java  | 11 ++++++++---
 .../server/management/impl/ManagementServiceImpl.java    |  3 ++-
 .../management/ActiveMQServerControlUsingCoreTest.java   |  3 +--
 .../apache/activemq/artemis/common/AbstractAdmin.java    |  4 +---
 5 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
----------------------------------------------------------------------
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 43e7a4d..f002b5c 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
@@ -18,7 +18,6 @@ package org.apache.activemq.artemis.api.core.management;
 
 import javax.management.MBeanOperationInfo;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException;
 import org.apache.activemq.artemis.core.server.RoutingType;
@@ -438,7 +437,7 @@ public interface ActiveMQServerControl {
 
    @Operation(desc = "delete an address", impact = MBeanOperationInfo.ACTION)
    void createAddress(@Parameter(name = "name", desc = "The name of the address") String name,
-                      @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Set<RoutingType> routingTypes) throws Exception;
+                      @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception;
 
    @Operation(desc = "delete an address", impact = MBeanOperationInfo.ACTION)
    void deleteAddress(@Parameter(name = "name", desc = "The name of the address") String name) throws Exception;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/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 c237b70..c9214f3 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
@@ -36,6 +36,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -77,9 +78,9 @@ 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.RoutingType;
 import org.apache.activemq.artemis.core.server.JournalType;
 import org.apache.activemq.artemis.core.server.Queue;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.ServerConsumer;
 import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
@@ -563,12 +564,16 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
 
    @Override
    public void createAddress(@Parameter(name = "name", desc = "The name of the address") String name,
-                             @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Set<RoutingType> routingTypes) throws Exception {
+                             @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception {
       checkStarted();
 
       clearIO();
       try {
-         server.createAddressInfo(new AddressInfo(new SimpleString(name), routingTypes));
+         Set<RoutingType> set = new HashSet<>();
+         for (Object routingType : routingTypes) {
+            set.add(RoutingType.valueOf(routingType.toString()));
+         }
+         server.createAddressInfo(new AddressInfo(new SimpleString(name), set));
       } finally {
          blockOnIO();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
index 61365c7..b736c42 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
@@ -719,7 +719,8 @@ public class ManagementServiceImpl implements ManagementService {
                   paramTypes[i] == Long.TYPE && params[i].getClass() == Long.class ||
                   paramTypes[i] == Double.TYPE && params[i].getClass() == Double.class ||
                   paramTypes[i] == Integer.TYPE && params[i].getClass() == Integer.class ||
-                  paramTypes[i] == Boolean.TYPE && params[i].getClass() == Boolean.class) {
+                  paramTypes[i] == Boolean.TYPE && params[i].getClass() == Boolean.class ||
+                  paramTypes[i] == Object[].class && params[i].getClass() == Object[].class) {
                   // parameter match
                } else {
                   match = false;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
----------------------------------------------------------------------
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 3dc5fb2..7508a37 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
@@ -17,7 +17,6 @@
 package org.apache.activemq.artemis.tests.integration.management;
 
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException;
 import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
@@ -567,7 +566,7 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
 
          @Override
          public void createAddress(@Parameter(name = "name", desc = "The name of the address") String name,
-                                   @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Set<RoutingType> routingTypes) throws Exception {
+                                   @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception {
 
          }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/806c688e/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java
----------------------------------------------------------------------
diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java
index bbe99fc..8ea7828 100644
--- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java
+++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java
@@ -34,7 +34,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
 import org.apache.activemq.artemis.api.core.management.ManagementHelper;
 import org.apache.activemq.artemis.api.core.management.ResourceNames;
 import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
-import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.tests.util.SpawnedVMSupport;
 import org.objectweb.jtests.jms.admin.Admin;
 
@@ -148,9 +147,8 @@ public class AbstractAdmin implements Admin {
 
    @Override
    public void createTopic(final String name) {
-      Boolean result;
       try {
-         invokeSyncOperation(ResourceNames.BROKER, "createAddress", name, (int) RoutingType.MULTICAST.getType(), false, -1);
+         invokeSyncOperation(ResourceNames.BROKER, "createAddress", name, new Object[]{"MULTICAST"});
       } catch (Exception e) {
          throw new IllegalStateException(e);
       }


[06/27] activemq-artemis git commit: Spelling fix

Posted by ma...@apache.org.
Spelling fix


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

Branch: refs/heads/ARTEMIS-780
Commit: 842c5e5d8728655f3609fdbbd3e63fe29c047623
Parents: 617a02b
Author: jbertram <jb...@apache.com>
Authored: Mon Nov 28 15:32:14 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 15:32:14 2016 -0600

----------------------------------------------------------------------
 .../jms/tests/AutoAckMesageListenerTest.java    | 141 -------------------
 .../jms/tests/AutoAckMessageListenerTest.java   | 141 +++++++++++++++++++
 2 files changed, 141 insertions(+), 141 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/842c5e5d/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AutoAckMesageListenerTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AutoAckMesageListenerTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AutoAckMesageListenerTest.java
deleted file mode 100644
index e7877ce..0000000
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AutoAckMesageListenerTest.java
+++ /dev/null
@@ -1,141 +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.jms.tests;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Test;
-
-public class AutoAckMesageListenerTest extends JMSTestCase {
-
-   // Constants -----------------------------------------------------
-
-   private static final JmsTestLogger log = JmsTestLogger.LOGGER;
-
-   // Attributes ----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   @Test
-   public void testAutoAckMsgListenerQueue() throws Exception {
-      Connection conn = null;
-
-      try {
-         CountDownLatch latch = new CountDownLatch(1);
-
-         conn = createConnection();
-         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer producer = session.createProducer(queue1);
-         MessageConsumer consumer = session.createConsumer(queue1);
-         AutoAckMsgListener listener = new AutoAckMsgListener(latch, session);
-         consumer.setMessageListener(listener);
-
-         // create and send messages
-         log.info("Send and receive two message");
-         Message messageSent = session.createMessage();
-         messageSent.setBooleanProperty("last", false);
-         producer.send(messageSent);
-         messageSent.setBooleanProperty("last", true);
-         producer.send(messageSent);
-
-         conn.start();
-
-         // wait until message is received
-         log.info("waiting until message has been received by message listener...");
-         latch.await(10, TimeUnit.SECONDS);
-
-         // check message listener status
-         if (listener.getPassed() == false) {
-            throw new Exception("failed");
-         }
-      } finally {
-         if (conn != null) {
-            conn.close();
-         }
-      }
-   }
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-
-   private static class AutoAckMsgListener implements MessageListener {
-
-      private boolean passed;
-
-      private final Session session;
-
-      private final CountDownLatch monitor;
-
-      private AutoAckMsgListener(CountDownLatch latch, Session session) {
-         this.monitor = latch;
-         this.session = session;
-      }
-
-      // get state of test
-      public boolean getPassed() {
-         return passed;
-      }
-
-      // will receive two messages
-      @Override
-      public void onMessage(Message message) {
-         try {
-            if (message.getBooleanProperty("last") == false) {
-               log.info("Received first message.");
-               if (message.getJMSRedelivered() == true) {
-                  // should not re-receive this one
-                  log.info("Error: received first message twice");
-                  passed = false;
-               }
-            } else {
-               if (message.getJMSRedelivered() == false) {
-                  // received second message for first time
-                  log.info("Received second message. Calling recover()");
-                  session.recover();
-               } else {
-                  // should be redelivered after recover
-                  log.info("Received second message again as expected");
-                  passed = true;
-                  monitor.countDown();
-               }
-            }
-         } catch (JMSException e) {
-            log.warn("Exception caught in message listener:\n" + e);
-            passed = false;
-            monitor.countDown();
-         }
-
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/842c5e5d/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AutoAckMessageListenerTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AutoAckMessageListenerTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AutoAckMessageListenerTest.java
new file mode 100644
index 0000000..b667c58
--- /dev/null
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/AutoAckMessageListenerTest.java
@@ -0,0 +1,141 @@
+/*
+ * 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.jms.tests;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+
+public class AutoAckMessageListenerTest extends JMSTestCase {
+
+   // Constants -----------------------------------------------------
+
+   private static final JmsTestLogger log = JmsTestLogger.LOGGER;
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   @Test
+   public void testAutoAckMsgListenerQueue() throws Exception {
+      Connection conn = null;
+
+      try {
+         CountDownLatch latch = new CountDownLatch(1);
+
+         conn = createConnection();
+         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer producer = session.createProducer(queue1);
+         MessageConsumer consumer = session.createConsumer(queue1);
+         AutoAckMsgListener listener = new AutoAckMsgListener(latch, session);
+         consumer.setMessageListener(listener);
+
+         // create and send messages
+         log.info("Send and receive two message");
+         Message messageSent = session.createMessage();
+         messageSent.setBooleanProperty("last", false);
+         producer.send(messageSent);
+         messageSent.setBooleanProperty("last", true);
+         producer.send(messageSent);
+
+         conn.start();
+
+         // wait until message is received
+         log.info("waiting until message has been received by message listener...");
+         latch.await(10, TimeUnit.SECONDS);
+
+         // check message listener status
+         if (listener.getPassed() == false) {
+            throw new Exception("failed");
+         }
+      } finally {
+         if (conn != null) {
+            conn.close();
+         }
+      }
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+   private static class AutoAckMsgListener implements MessageListener {
+
+      private boolean passed;
+
+      private final Session session;
+
+      private final CountDownLatch monitor;
+
+      private AutoAckMsgListener(CountDownLatch latch, Session session) {
+         this.monitor = latch;
+         this.session = session;
+      }
+
+      // get state of test
+      public boolean getPassed() {
+         return passed;
+      }
+
+      // will receive two messages
+      @Override
+      public void onMessage(Message message) {
+         try {
+            if (message.getBooleanProperty("last") == false) {
+               log.info("Received first message.");
+               if (message.getJMSRedelivered() == true) {
+                  // should not re-receive this one
+                  log.info("Error: received first message twice");
+                  passed = false;
+               }
+            } else {
+               if (message.getJMSRedelivered() == false) {
+                  // received second message for first time
+                  log.info("Received second message. Calling recover()");
+                  session.recover();
+               } else {
+                  // should be redelivered after recover
+                  log.info("Received second message again as expected");
+                  passed = true;
+                  monitor.countDown();
+               }
+            }
+         } catch (JMSException e) {
+            log.warn("Exception caught in message listener:\n" + e);
+            passed = false;
+            monitor.countDown();
+         }
+
+      }
+   }
+}


[19/27] activemq-artemis git commit: Fix ActiveMQConnectionFactoryTest

Posted by ma...@apache.org.
Fix ActiveMQConnectionFactoryTest


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

Branch: refs/heads/ARTEMIS-780
Commit: 5ba43e3aded2893b61dd98ba56460cfdcb249ca0
Parents: d25ac05
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 17:28:56 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 17:28:56 2016 -0600

----------------------------------------------------------------------
 .../tests/integration/jms/ActiveMQConnectionFactoryTest.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ba43e3a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java
index 37e55c0..7b6f7cf 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java
@@ -45,6 +45,7 @@ import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServers;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.integration.jms.serializables.TestClass1;
@@ -243,7 +244,7 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase {
    private void testDeserializationOptions(boolean useJndi, boolean useBrowser) throws Exception {
       String qname = "SerialTestQueue";
       SimpleString qaddr = new SimpleString(qname);
-      liveService.createQueue(qaddr, qaddr, null, true, false);
+      liveService.createQueue(qaddr, RoutingType.ANYCAST, qaddr, null, true, false);
 
       //default ok
       String blackList = null;
@@ -316,7 +317,7 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase {
 
       String qname = "SerialTestQueue";
       SimpleString qaddr = new SimpleString(qname);
-      liveService.createQueue(qaddr, qaddr, null, true, false);
+      liveService.createQueue(qaddr, RoutingType.ANYCAST, qaddr, null, true, false);
 
       try {
          String blackList = null;


[20/27] activemq-artemis git commit: Fix JMSFailoverListenerTest

Posted by ma...@apache.org.
Fix JMSFailoverListenerTest


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

Branch: refs/heads/ARTEMIS-780
Commit: 87777e7010a69d83c4d355e48a8f1f29a2e30fd0
Parents: 5ba43e3
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 17:30:11 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 17:30:11 2016 -0600

----------------------------------------------------------------------
 .../tests/integration/jms/cluster/JMSFailoverListenerTest.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/87777e70/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java
index 538260e..6f9e9fc 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java
@@ -43,6 +43,7 @@ import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
 import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.NodeManager;
+import org.apache.activemq.artemis.core.server.RoutingType;
 import org.apache.activemq.artemis.core.server.impl.InVMNodeManager;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnection;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
@@ -133,7 +134,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase {
 
       SimpleString jmsQueueName = new SimpleString("myqueue");
 
-      coreSession.createQueue(jmsQueueName, jmsQueueName, null, true);
+      coreSession.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true);
 
       Queue queue = sess.createQueue("myqueue");
 
@@ -206,7 +207,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase {
 
       SimpleString jmsQueueName = new SimpleString("myqueue");
 
-      coreSessionLive.createQueue(jmsQueueName, jmsQueueName, null, true);
+      coreSessionLive.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true);
 
       Queue queue = sessLive.createQueue("myqueue");
 


[02/27] activemq-artemis git commit: Fix SessionTest.testQueueQueryNoQ

Posted by ma...@apache.org.
Fix SessionTest.testQueueQueryNoQ


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

Branch: refs/heads/ARTEMIS-780
Commit: 5aa14279c96f5830ea09cc58aeb227ad928a414c
Parents: 8be9a46
Author: jbertram <jb...@apache.com>
Authored: Wed Nov 23 13:54:51 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Mon Nov 28 14:19:20 2016 -0600

----------------------------------------------------------------------
 .../activemq/artemis/tests/integration/client/SessionTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5aa14279/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionTest.java
----------------------------------------------------------------------
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 b3c7a4c..0882078 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
@@ -230,11 +230,11 @@ public class SessionTest extends ActiveMQTestBase {
    @Test
    public void testQueueQueryNoQ() throws Exception {
       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));
       Assert.assertFalse(resp.isExists());
+      Assert.assertFalse(resp.isAutoCreateJmsQueues());
       Assert.assertEquals(null, resp.getAddress());
       clientSession.close();
    }


[16/27] activemq-artemis git commit: Fix bug where non-durable queues were always being created as temporary

Posted by ma...@apache.org.
Fix bug where non-durable queues were always being created as temporary


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

Branch: refs/heads/ARTEMIS-780
Commit: c961c1d4dc6c9a648fb045f23ac1150c8780b534
Parents: ebf1450
Author: jbertram <jb...@apache.com>
Authored: Tue Nov 29 17:12:32 2016 -0600
Committer: jbertram <jb...@apache.com>
Committed: Tue Nov 29 17:12:32 2016 -0600

----------------------------------------------------------------------
 .../activemq/artemis/core/client/impl/ClientSessionImpl.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c961c1d4/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
----------------------------------------------------------------------
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 1ed825b..310644a 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
@@ -560,7 +560,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
                           routingType,
                           filter,
                           durable,
-                          !durable,
+                          false,
                           ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(),
                           ActiveMQDefaultConfiguration.getDefaultDeleteQueueOnNoConsumers(),
                           false);