You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/05/24 20:29:16 UTC

[01/33] activemq-artemis git commit: NO-JIRA Update NOTICE files to have correct year range.

Repository: activemq-artemis
Updated Branches:
  refs/heads/2.6.x 23b5a0585 -> 5e5ae4041


NO-JIRA Update NOTICE files to have correct year range.

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

Branch: refs/heads/2.6.x
Commit: 07197b8c1537e4d5e531a1383c449ed223700aa0
Parents: 23b5a05
Author: Timothy Bish <ta...@gmail.com>
Authored: Thu May 17 15:43:13 2018 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Thu May 17 15:43:31 2018 -0400

----------------------------------------------------------------------
 NOTICE                                                      | 2 +-
 artemis-distribution/src/main/resources/licenses/bin/NOTICE | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/07197b8c/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index 1004e21..dcb7bb6 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache ActiveMQ Artemis
-Copyright [2014-2017] The Apache Software Foundation
+Copyright [2014-2018] The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/07197b8c/artemis-distribution/src/main/resources/licenses/bin/NOTICE
----------------------------------------------------------------------
diff --git a/artemis-distribution/src/main/resources/licenses/bin/NOTICE b/artemis-distribution/src/main/resources/licenses/bin/NOTICE
index 1004e21..dcb7bb6 100644
--- a/artemis-distribution/src/main/resources/licenses/bin/NOTICE
+++ b/artemis-distribution/src/main/resources/licenses/bin/NOTICE
@@ -1,5 +1,5 @@
 Apache ActiveMQ Artemis
-Copyright [2014-2017] The Apache Software Foundation
+Copyright [2014-2018] The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).


[07/33] activemq-artemis git commit: This closes #2092

Posted by cl...@apache.org.
This closes #2092


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

Branch: refs/heads/2.6.x
Commit: 6e6a76deabb3dab18d959128c92aaecdef7f93f6
Parents: ef03ce4 8b458b5
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 21 18:09:29 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 18:09:29 2018 -0400

----------------------------------------------------------------------
 .../core/remoting/impl/ssl/SSLSupport.java      |   2 +-
 .../tests/integration/ssl/SSLProviderTest.java  |  84 +++++++++++++++
 .../integration/ssl/SSLProviderTwoWayTest.java  | 101 +++++++++++++++++
 .../tests/integration/ssl/SSLTestBase.java      | 108 +++++++++++++++++++
 4 files changed, 294 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[12/33] activemq-artemis git commit: ARTEMIS-1870:Missing documentation for new parameter jdbc-journal-sync-period added for JDBC Persistence

Posted by cl...@apache.org.
ARTEMIS-1870:Missing documentation for new parameter jdbc-journal-sync-period added for JDBC Persistence


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

Branch: refs/heads/2.6.x
Commit: 32a92b52e17a10c16e3980885056593fc1b3ca81
Parents: 7a917dc
Author: saurabhrai <ra...@hotmail.com>
Authored: Wed May 16 17:25:53 2018 +0530
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 19:47:01 2018 -0400

----------------------------------------------------------------------
 docs/user-manual/en/persistence.md | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/32a92b52/docs/user-manual/en/persistence.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/persistence.md b/docs/user-manual/en/persistence.md
index 76bb77c..00159e4 100644
--- a/docs/user-manual/en/persistence.md
+++ b/docs/user-manual/en/persistence.md
@@ -468,6 +468,10 @@ To configure Apache ActiveMQ Artemis to use a database for persisting messages a
     The time in milliseconds a JDBC lock is considered valid without keeping it alive. The default value
     is 20000 milliseconds (ie 20 seconds).
 
+-   `jdbc-journal-sync-period`
+
+    The time in milliseconds the journal will be synced with JDBC. The default value is 5 milliseconds.
+
 Note that some DBMS (e.g. Oracle, 30 chars) have restrictions on the size of table names, this should be taken into consideration when configuring table names for the Artemis database store, pay particular attention to the page store table name, which can be appended with a unique ID of up to 20 characters.  (for Oracle this would mean configuring a page-store-table-name of max size of 10 chars).
 
 ## Zero Persistence


[06/33] activemq-artemis git commit: This closes #2090

Posted by cl...@apache.org.
This closes #2090


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

Branch: refs/heads/2.6.x
Commit: ef03ce4ee9704a611370fc13096358af8504b6dd
Parents: 9eed307 f24d97b
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 21 18:07:54 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 18:07:54 2018 -0400

----------------------------------------------------------------------
 .../protocol/openwire/OpenWireConnection.java   |  2 +
 .../core/protocol/openwire/amq/AMQConsumer.java | 51 ++++++++++++++++++-
 .../core/protocol/openwire/amq/AMQSession.java  |  3 +-
 .../openwire/amq/RedeliveryPolicyTest.java      | 52 ++++++++++++++++++++
 4 files changed, 106 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[04/33] activemq-artemis git commit: ARTEMIS-1868 Openwire doesn't add delivery count in client ack mode

Posted by cl...@apache.org.
ARTEMIS-1868 Openwire doesn't add delivery count in client ack mode

If a client ack mode consumer receives a message and closes without
acking it, the redelivery of the message won't set the redelivery
flag (JMSRedelivered) because it doesn't increment the delivery count
when message is cancelled back to queue.


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

Branch: refs/heads/2.6.x
Commit: 47b31b53d608f762b9c38e924c5a9f8b92f384b5
Parents: 9eed307
Author: Howard Gao <ho...@gmail.com>
Authored: Wed May 16 11:14:48 2018 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 18:00:08 2018 -0400

----------------------------------------------------------------------
 .../protocol/openwire/OpenWireConnection.java   |  1 +
 .../core/protocol/openwire/amq/AMQConsumer.java |  4 +-
 .../core/protocol/openwire/amq/AMQSession.java  | 14 ++++++
 .../openwire/amq/RedeliveryPolicyTest.java      | 52 ++++++++++++++++++++
 4 files changed, 70 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/47b31b53/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 6a10de7..f666785 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -1294,6 +1294,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
                   referenceIterator.remove();
                   ref.incrementDeliveryCount();
                   consumer.backToDelivering(ref);
+                  session.addRolledback(ref.getMessageID());
                }
             }
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/47b31b53/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
index e0b02ae..0b7eff5 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
@@ -353,7 +353,7 @@ public class AMQConsumer {
    }
 
    public boolean updateDeliveryCountAfterCancel(MessageReference ref) {
-      long seqId = ref.getMessage().getMessageID();
+      long seqId = ref.getMessageID();
       long lastDelSeqId = info.getLastDeliveredSequenceId();
 
       //in activemq5, closing a durable subscription won't close the consumer
@@ -373,6 +373,8 @@ public class AMQConsumer {
          // tx cases are handled by
          // org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection.CommandProcessor.processRollbackTransaction()
          ref.incrementDeliveryCount();
+      } else if (lastDelSeqId == RemoveInfo.LAST_DELIVERED_UNSET && !session.isRolledBack(seqId)) {
+         ref.incrementDeliveryCount();
       }
 
       return true;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/47b31b53/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
index c3b1a20..34e2c0f 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
@@ -20,6 +20,7 @@ import static org.apache.activemq.artemis.core.protocol.openwire.util.OpenWireUt
 
 import java.io.IOException;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -52,6 +53,7 @@ import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
 import org.apache.activemq.artemis.utils.CompositeAddress;
 import org.apache.activemq.artemis.utils.IDGenerator;
 import org.apache.activemq.artemis.utils.SimpleIDGenerator;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ConnectionInfo;
 import org.apache.activemq.command.ConsumerInfo;
@@ -95,6 +97,8 @@ public class AMQSession implements SessionCallback {
 
    private final SimpleString clientId;
 
+   private final Set<Long> rollbackedIds = new ConcurrentHashSet<>();
+
    public AMQSession(ConnectionInfo connInfo,
                      SessionInfo sessInfo,
                      ActiveMQServer server,
@@ -308,6 +312,8 @@ public class AMQSession implements SessionCallback {
                           ServerConsumer consumer,
                           int deliveryCount) {
       AMQConsumer theConsumer = (AMQConsumer) consumer.getProtocolData();
+      //clear up possible rolledback ids.
+      rollbackedIds.remove(message.getMessageID());
       // TODO: use encoders and proper conversions here
       return theConsumer.handleDeliver(reference, message.toCore(), deliveryCount);
    }
@@ -542,4 +548,12 @@ public class AMQSession implements SessionCallback {
    public boolean isInternal() {
       return sessInfo.getSessionId().getValue() == -1;
    }
+
+   public void addRolledback(long messageID) {
+      this.rollbackedIds.add(messageID);
+   }
+
+   public boolean isRolledBack(long mid) {
+      return rollbackedIds.remove(mid);
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/47b31b53/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
index 7ee0eb9..3e50cc7 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/RedeliveryPolicyTest.java
@@ -21,9 +21,11 @@ import javax.jms.Destination;
 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 org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.RedeliveryPolicy;
 import org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest;
 import org.apache.activemq.broker.region.policy.RedeliveryPolicyMap;
@@ -633,4 +635,54 @@ public class RedeliveryPolicyTest extends BasicOpenWireTest {
       session.commit();
    }
 
+   @Test
+   public void testClientRedlivery() throws Exception {
+
+      try {
+
+         Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+         this.makeSureCoreQueueExist("TEST");
+
+         Queue queue = session.createQueue("TEST");
+
+         MessageProducer producer = session.createProducer(queue);
+
+         producer.send(session.createTextMessage("test"));
+
+      } finally {
+         connection.close();
+      }
+
+      for (int i = 0; i < 10; ++i) {
+
+         connection = (ActiveMQConnection) factory.createConnection();
+
+         connection.start();
+
+         try {
+
+            Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+            Queue queue = session.createQueue("TEST");
+
+            MessageConsumer consumer = session.createConsumer(queue);
+
+            Message message = consumer.receive(1000);
+
+            assertNotNull("Message null on iteration " + i, message);
+
+            System.out.println("received message: " + i);
+            System.out.println("is redelivered: " + message.getJMSRedelivered());
+            if (i > 0) {
+               assertTrue(message.getJMSRedelivered());
+            }
+
+         } finally {
+            connection.close();
+         }
+      }
+
+   }
+
 }


[03/33] activemq-artemis git commit: This closes #2095

Posted by cl...@apache.org.
This closes #2095


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

Branch: refs/heads/2.6.x
Commit: 9eed307ceed1f42321b111ef6874e809e2920cca
Parents: 07197b8 4b04b53
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 21 17:59:20 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 17:59:20 2018 -0400

----------------------------------------------------------------------
 .../activemq/artemis/core/postoffice/impl/PostOfficeImpl.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[24/33] activemq-artemis git commit: ARTEMIS-1872 Fixing address security checks

Posted by cl...@apache.org.
ARTEMIS-1872 Fixing address security checks 

Ensure CREATE_ADDRESS is honored and behavior is consistent across protocols.  

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

Branch: refs/heads/2.6.x
Commit: 659d23cb28ce4299be5826ed1b6113458c6d0a1a
Parents: 0746ea8
Author: Michael André Pearce <mi...@me.com>
Authored: Thu May 24 04:47:35 2018 +0100
Committer: Michael André Pearce <mi...@me.com>
Committed: Thu May 24 05:23:41 2018 +0100

----------------------------------------------------------------------
 .../amqp/broker/AMQPSessionCallback.java        |  2 +-
 .../core/server/impl/ServerSessionImpl.java     |  8 ++++-
 .../server/SecureConfigurationTest.java         | 34 ++++++++++++++------
 .../src/test/resources/multicast_topic.xml      |  2 +-
 4 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/659d23cb/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 df9b61e..aac3f2a 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
@@ -298,7 +298,7 @@ public class AMQPSessionCallback implements SessionCallback {
       }
 
       // if auto-create we will return whatever type was used before
-      if (!queueQueryResult.isAutoCreated() && queueQueryResult.getRoutingType() != routingType) {
+      if (queueQueryResult.isExists() && !queueQueryResult.isAutoCreated() && queueQueryResult.getRoutingType() != routingType) {
          throw new IllegalStateException("Incorrect Routing Type for queue, expecting: " + routingType);
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/659d23cb/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index 0c6838d..3057041 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -583,9 +583,15 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
          securityCheck(addressInfo.getName(), name, CheckType.CREATE_NON_DURABLE_QUEUE, this);
       }
 
+      AddressSettings as = server.getAddressSettingsRepository().getMatch(art.getName().toString());
+
+      if (as.isAutoCreateAddresses() && server.getAddressInfo(art.getName()) == null) {
+         securityCheck(addressInfo.getName(), name, CheckType.CREATE_ADDRESS, this);
+      }
+
       server.checkQueueCreationLimit(getUsername());
 
-      Queue queue = server.createQueue(art, unPrefixedName, filterString, SimpleString.toSimpleString(getUsername()), durable, temporary, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, lastValue, server.getAddressSettingsRepository().getMatch(art.getName().toString()).isAutoCreateAddresses());
+      Queue queue = server.createQueue(art, unPrefixedName, filterString, SimpleString.toSimpleString(getUsername()), durable, temporary, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, lastValue, as.isAutoCreateAddresses());
 
       if (temporary) {
          // Temporary queue in core simply means the queue will be deleted if

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/659d23cb/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
index 3a15ea9..16447e3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.activemq.artemis.tests.integration.server;
 
-import java.lang.IllegalStateException;
 import java.util.Arrays;
 import java.util.Collection;
 import javax.jms.Connection;
@@ -45,7 +44,6 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -56,7 +54,7 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
    @Parameterized.Parameters(name = "{index}: protocol={0}")
    public static Collection<Object[]> parameters() {
       return Arrays.asList(new Object[][] {
-              {"CORE"}, {"AMQP"}, {"OPENWIRE"}
+            {"CORE"}, {"AMQP"}, {"OPENWIRE"}
       });
    }
 
@@ -168,9 +166,14 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
 
    @Test
    public void testTemporaryQueue() throws Exception {
-      ConnectionFactory connectionFactory = getConnectionFactory("c", "c");
+      ConnectionFactory connectionFactory = getConnectionFactory("a", "a");
       String message = "blah";
 
+      //Expect to be able to create subscriber on pre-defined/existing queue.
+      String messageRecieved = sendAndReceiveText(connectionFactory, "clientId", message, s -> s.createTemporaryQueue(), (d, s) -> s.createConsumer(d));
+      Assert.assertEquals(message, messageRecieved);
+
+      connectionFactory = getConnectionFactory("c", "c");
       try {
          sendAndReceiveText(connectionFactory, "clientId", message, s -> s.createTemporaryQueue(), (d, s) -> s.createConsumer(d));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to create a temporary queue");
@@ -183,9 +186,14 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
 
    @Test
    public void testTemporaryTopic() throws Exception {
-      ConnectionFactory connectionFactory = getConnectionFactory("c", "c");
+      ConnectionFactory connectionFactory = getConnectionFactory("a", "a");
       String message = "blah";
 
+      //Expect to be able to create subscriber on pre-defined/existing queue.
+      String messageRecieved = sendAndReceiveText(connectionFactory, "clientId", message, s -> s.createTemporaryTopic(), (d, s) -> s.createConsumer(d));
+      Assert.assertEquals(message, messageRecieved);
+
+      connectionFactory = getConnectionFactory("c", "c");
       try {
          sendAndReceiveText(connectionFactory, "clientId", message, s -> s.createTemporaryTopic(), (d, s) -> s.createConsumer(d));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to create a temporary queue");
@@ -198,8 +206,6 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
 
    @Test
    public void testSecureQueue() throws Exception {
-      // Core & OpenWire are not creating the queue as the test expects.. just querying
-      Assume.assumeTrue(protocol.equals("AMQP"));
       ConnectionFactory connectionFactory = getConnectionFactory("b", "b");
       String message = "blah";
 
@@ -207,12 +213,22 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
       String messageRecieved = sendAndReceiveTextUsingQueue(connectionFactory, "clientId", message, "secured_queue", (q, s) -> s.createConsumer(q));
       Assert.assertEquals(message, messageRecieved);
 
+      connectionFactory = getConnectionFactory("a", "a");
+      messageRecieved = sendAndReceiveTextUsingQueue(connectionFactory, "clientId", message, "new-queue-1", (q, s) -> s.createConsumer(q));
+      Assert.assertEquals(message, messageRecieved);
+
+      connectionFactory = getConnectionFactory("b", "b");
       try {
-         sendAndReceiveTextUsingQueue(connectionFactory, "clientId", message, "non-existent-queue", (q, s) -> s.createConsumer(q));
-         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+         sendAndReceiveTextUsingQueue(connectionFactory, "clientId", message, "new-queue-2", (q, s) -> s.createConsumer(q));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create address, or queue");
       } catch (JMSSecurityException j) {
          //Expected exception
       }
+
+      connectionFactory = getConnectionFactory("a", "a");
+      messageRecieved = sendAndReceiveTextUsingQueue(connectionFactory, "clientId", message, "new-queue-2", (q, s) -> s.createConsumer(q));
+      Assert.assertEquals(message, messageRecieved);
+
    }
 
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/659d23cb/tests/integration-tests/src/test/resources/multicast_topic.xml
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/resources/multicast_topic.xml b/tests/integration-tests/src/test/resources/multicast_topic.xml
index 3f546e7..a4891d0 100644
--- a/tests/integration-tests/src/test/resources/multicast_topic.xml
+++ b/tests/integration-tests/src/test/resources/multicast_topic.xml
@@ -91,6 +91,7 @@ under the License.
 
       <security-settings>
          <security-setting match="#">
+            <permission type="createAddress" roles="a" />
             <permission type="createNonDurableQueue" roles="a,b"/>
             <permission type="deleteNonDurableQueue" roles="a,b"/>
             <permission type="createDurableQueue" roles="a,b"/>
@@ -139,7 +140,6 @@ under the License.
       <address-settings>
          <!--default for catch all-->
          <address-setting match="#">
-            <auto-create-queues>false</auto-create-queues>
             <dead-letter-address>DLQ</dead-letter-address>
             <expiry-address>ExpiryQueue</expiry-address>
             <redelivery-delay>0</redelivery-delay>


[26/33] activemq-artemis git commit: ARTEMIS-1882 verify PKCS12 keystores work

Posted by cl...@apache.org.
ARTEMIS-1882 verify PKCS12 keystores 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/3602713a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3602713a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3602713a

Branch: refs/heads/2.6.x
Commit: 3602713a7e8b3488410174c513480742e0427c4e
Parents: e6d2607
Author: Justin Bertram <jb...@apache.org>
Authored: Wed May 23 13:12:44 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 11:58:43 2018 -0400

----------------------------------------------------------------------
 .../ssl/CoreClientOverOneWaySSLTest.java        |  24 ++++++++++++++++---
 .../ssl/CoreClientOverTwoWaySSLTest.java        |  24 +++++++++++++++----
 .../src/test/resources/client-side-keystore.p12 | Bin 0 -> 2589 bytes
 .../test/resources/client-side-truststore.p12   | Bin 0 -> 1194 bytes
 .../resources/other-client-side-truststore.p12  | Bin 0 -> 1202 bytes
 .../resources/other-server-side-keystore.p12    | Bin 0 -> 2605 bytes
 .../src/test/resources/server-side-keystore.p12 | Bin 0 -> 2589 bytes
 .../test/resources/server-side-truststore.p12   | Bin 0 -> 1194 bytes
 .../resources/verified-client-side-keystore.p12 | Bin 0 -> 2565 bytes
 .../verified-client-side-truststore.p12         | Bin 0 -> 1162 bytes
 .../resources/verified-server-side-keystore.p12 | Bin 0 -> 2565 bytes
 .../verified-server-side-truststore.p12         | Bin 0 -> 1162 bytes
 12 files changed, 40 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java
index aeb7524..6217dbd 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java
@@ -58,13 +58,18 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase {
 
    @Parameterized.Parameters(name = "storeType={0}")
    public static Collection getParameters() {
-      return Arrays.asList(new Object[][]{{"JCEKS"}, {"JKS"}});
+      return Arrays.asList(new Object[][]{{"JCEKS"}, {"JKS"}, {"PKCS12"}});
    }
 
    public CoreClientOverOneWaySSLTest(String storeType) {
       this.storeType = storeType;
-      SERVER_SIDE_KEYSTORE = "server-side-keystore." + storeType.toLowerCase();
-      CLIENT_SIDE_TRUSTSTORE = "client-side-truststore." + storeType.toLowerCase();
+      String suffix = storeType.toLowerCase();
+      // keytool expects PKCS12 stores to use the extension "p12"
+      if (storeType.equals("PKCS12")) {
+         suffix = "p12";
+      }
+      SERVER_SIDE_KEYSTORE = "server-side-keystore." + suffix;
+      CLIENT_SIDE_TRUSTSTORE = "client-side-truststore." + suffix;
    }
 
    public static final SimpleString QUEUE = new SimpleString("QueueOverSSL");
@@ -97,6 +102,19 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase {
     * keytool -genkey -keystore verified-server-side-keystore.jceks -storetype JCEKS -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ"
     * keytool -export -keystore verified-server-side-keystore.jceks -file activemq-jceks.cer -storetype jceks -storepass secureexample
     * keytool -import -keystore verified-client-side-truststore.jceks -storetype JCEKS -file activemq-jceks.cer -storepass secureexample -keypass secureexample -noprompt
+    *
+    * Commands to create the PKCS12 artifacts:
+    * keytool -genkey -keystore server-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=ActiveMQ Artemis Server, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA
+    * keytool -export -keystore server-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample
+    * keytool -import -keystore client-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt
+    *
+    * keytool -genkey -keystore other-server-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=Other ActiveMQ Artemis Server, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA
+    * keytool -export -keystore other-server-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample
+    * keytool -import -keystore other-client-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt
+    *
+    * keytool -genkey -keystore verified-server-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA
+    * keytool -export -keystore verified-server-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample
+    * keytool -import -keystore verified-client-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt
     */
    private String storeType;
    private String SERVER_SIDE_KEYSTORE;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java
index 609174e..9c814e9 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java
@@ -58,15 +58,20 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase {
 
    @Parameterized.Parameters(name = "storeType={0}")
    public static Collection getParameters() {
-      return Arrays.asList(new Object[][]{{"JCEKS"}, {"JKS"}});
+      return Arrays.asList(new Object[][]{{"JCEKS"}, {"JKS"}, {"PKCS12"}});
    }
 
    public CoreClientOverTwoWaySSLTest(String storeType) {
       this.storeType = storeType;
-      SERVER_SIDE_KEYSTORE = "server-side-keystore." + storeType.toLowerCase();
-      SERVER_SIDE_TRUSTSTORE = "server-side-truststore." + storeType.toLowerCase();
-      CLIENT_SIDE_TRUSTSTORE = "client-side-truststore." + storeType.toLowerCase();
-      CLIENT_SIDE_KEYSTORE = "client-side-keystore." + storeType.toLowerCase();
+      String suffix = storeType.toLowerCase();
+      // keytool expects PKCS12 stores to use the extension "p12"
+      if (storeType.equals("PKCS12")) {
+         suffix = "p12";
+      }
+      SERVER_SIDE_KEYSTORE = "server-side-keystore." + suffix;
+      SERVER_SIDE_TRUSTSTORE = "server-side-truststore." + suffix;
+      CLIENT_SIDE_TRUSTSTORE = "client-side-truststore." + suffix;
+      CLIENT_SIDE_KEYSTORE = "client-side-keystore." + suffix;
    }
 
    public static final SimpleString QUEUE = new SimpleString("QueueOverSSL");
@@ -91,6 +96,15 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase {
     * keytool -genkey -keystore verified-client-side-keystore.jceks -storetype JCEKS -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA
     * keytool -export -keystore verified-client-side-keystore.jceks -file activemq-jceks.cer -storetype jceks -storepass secureexample
     * keytool -import -keystore verified-server-side-truststore.jceks -storetype JCEKS -file activemq-jceks.cer -storepass secureexample -keypass secureexample -noprompt
+    *
+    * Commands to create the PKCS12 artifacts:
+    * keytool -genkey -keystore client-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=ActiveMQ Artemis Client, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA
+    * keytool -export -keystore client-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample
+    * keytool -import -keystore server-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt
+    *
+    * keytool -genkey -keystore verified-client-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA
+    * keytool -export -keystore verified-client-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample
+    * keytool -import -keystore verified-server-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt
     */
 
    private String storeType;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/client-side-keystore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/client-side-keystore.p12 b/tests/unit-tests/src/test/resources/client-side-keystore.p12
new file mode 100644
index 0000000..f36af7c
Binary files /dev/null and b/tests/unit-tests/src/test/resources/client-side-keystore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/client-side-truststore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/client-side-truststore.p12 b/tests/unit-tests/src/test/resources/client-side-truststore.p12
new file mode 100644
index 0000000..de15aa4
Binary files /dev/null and b/tests/unit-tests/src/test/resources/client-side-truststore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/other-client-side-truststore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/other-client-side-truststore.p12 b/tests/unit-tests/src/test/resources/other-client-side-truststore.p12
new file mode 100644
index 0000000..4f06c03
Binary files /dev/null and b/tests/unit-tests/src/test/resources/other-client-side-truststore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/other-server-side-keystore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/other-server-side-keystore.p12 b/tests/unit-tests/src/test/resources/other-server-side-keystore.p12
new file mode 100644
index 0000000..40384bf
Binary files /dev/null and b/tests/unit-tests/src/test/resources/other-server-side-keystore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/server-side-keystore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/server-side-keystore.p12 b/tests/unit-tests/src/test/resources/server-side-keystore.p12
new file mode 100644
index 0000000..f9f4dab
Binary files /dev/null and b/tests/unit-tests/src/test/resources/server-side-keystore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/server-side-truststore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/server-side-truststore.p12 b/tests/unit-tests/src/test/resources/server-side-truststore.p12
new file mode 100644
index 0000000..f8daaa3
Binary files /dev/null and b/tests/unit-tests/src/test/resources/server-side-truststore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/verified-client-side-keystore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/verified-client-side-keystore.p12 b/tests/unit-tests/src/test/resources/verified-client-side-keystore.p12
new file mode 100644
index 0000000..3cee34a
Binary files /dev/null and b/tests/unit-tests/src/test/resources/verified-client-side-keystore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/verified-client-side-truststore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/verified-client-side-truststore.p12 b/tests/unit-tests/src/test/resources/verified-client-side-truststore.p12
new file mode 100644
index 0000000..d95f854
Binary files /dev/null and b/tests/unit-tests/src/test/resources/verified-client-side-truststore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/verified-server-side-keystore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/verified-server-side-keystore.p12 b/tests/unit-tests/src/test/resources/verified-server-side-keystore.p12
new file mode 100644
index 0000000..fcf3969
Binary files /dev/null and b/tests/unit-tests/src/test/resources/verified-server-side-keystore.p12 differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3602713a/tests/unit-tests/src/test/resources/verified-server-side-truststore.p12
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/resources/verified-server-side-truststore.p12 b/tests/unit-tests/src/test/resources/verified-server-side-truststore.p12
new file mode 100644
index 0000000..619adb2
Binary files /dev/null and b/tests/unit-tests/src/test/resources/verified-server-side-truststore.p12 differ


[14/33] activemq-artemis git commit: This closes #2096 ARTEMIS-1876 InVMNodeManager shouldn't be used if no JDBC HA is configured

Posted by cl...@apache.org.
This closes #2096 ARTEMIS-1876 InVMNodeManager shouldn't be used if no JDBC HA is configured


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

Branch: refs/heads/2.6.x
Commit: 4cd7b1c65c123a34adc7e22b89f90c92c40a0b62
Parents: 90273c9 f886c0b
Author: andytaylor <an...@gmail.com>
Authored: Tue May 22 11:17:37 2018 +0100
Committer: andytaylor <an...@gmail.com>
Committed: Tue May 22 11:17:37 2018 +0100

----------------------------------------------------------------------
 .../activemq/artemis/core/server/impl/ActiveMQServerImpl.java    | 4 ++--
 .../artemis/core/config/impl/HAPolicyConfigurationTest.java      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[30/33] activemq-artemis git commit: [ARTEMIS-1885] max-consumers attribute in queue definition does not work for AMQP client.

Posted by cl...@apache.org.
[ARTEMIS-1885] max-consumers attribute in queue definition does not work for AMQP client.

Tests being added as part of another commit

This closes #2106


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

Branch: refs/heads/2.6.x
Commit: 390a07e391e3b015914569c08012d3ffb55b17cf
Parents: ca589f3
Author: Shailendra Kumar Singh <sh...@gmail.com>
Authored: Thu May 24 17:24:44 2018 +0530
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 14:36:23 2018 -0400

----------------------------------------------------------------------
 .../apache/activemq/artemis/core/server/impl/QueueImpl.java    | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/390a07e3/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index dc77aad..94b7640 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -266,8 +266,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
 
    private final AddressInfo addressInfo;
 
-   private final AtomicInteger noConsumers = new AtomicInteger(0);
-
    private volatile RoutingType routingType;
 
    private final QueueFactory factory;
@@ -881,7 +879,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
       try {
          synchronized (this) {
 
-            if (maxConsumers != MAX_CONSUMERS_UNLIMITED && noConsumers.get() >= maxConsumers) {
+            if (maxConsumers != MAX_CONSUMERS_UNLIMITED && consumersCount.get() >= maxConsumers) {
                throw ActiveMQMessageBundle.BUNDLE.maxConsumerLimitReachedForQueue(address, name);
             }
 
@@ -903,7 +901,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
                refCountForConsumers.increment();
             }
 
-            noConsumers.incrementAndGet();
          }
       } finally {
          leaveCritical(CRITICAL_CONSUMER);
@@ -964,7 +961,6 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
                refCountForConsumers.decrement();
             }
 
-            noConsumers.decrementAndGet();
          }
       } finally {
          leaveCritical(CRITICAL_CONSUMER);


[19/33] activemq-artemis git commit: ARTEMIS-1872 Improving Security Checks on AMQP Protocol

Posted by cl...@apache.org.
ARTEMIS-1872 Improving Security Checks on AMQP Protocol

Also improving test coverage on SecureConfigurationTest
This commit will fix JMSConnectionWithSecurityTest.


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

Branch: refs/heads/2.6.x
Commit: 3a5971ec81984a091123c21fd1b9ac6e777fc7cf
Parents: 88b2399
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed May 23 14:52:07 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 23 15:01:41 2018 -0400

----------------------------------------------------------------------
 .../amqp/broker/AMQPSessionCallback.java        |  2 +-
 .../proton/ProtonServerReceiverContext.java     |  3 +
 .../server/SecureConfigurationTest.java         | 83 +++++++++++---------
 .../src/test/resources/multicast_topic.xml      | 12 +--
 4 files changed, 55 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a5971ec/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 1301f0b..df9b61e 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
@@ -248,7 +248,7 @@ public class AMQPSessionCallback implements SessionCallback {
       try {
          serverSession.createQueue(address, queueName, routingType, filter, true, false);
       } catch (ActiveMQSecurityException se) {
-         throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage());
+         throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingTempDestination(se.getMessage());
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a5971ec/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
index 0036004..aad89a8 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
@@ -29,6 +29,7 @@ import org.apache.activemq.artemis.protocol.amqp.broker.AMQPSessionCallback;
 import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPException;
 import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPInternalErrorException;
 import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPNotFoundException;
+import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPSecurityException;
 import org.apache.activemq.artemis.protocol.amqp.logger.ActiveMQAMQPProtocolMessageBundle;
 import org.apache.activemq.artemis.protocol.amqp.sasl.PlainSASLResult;
 import org.apache.activemq.artemis.protocol.amqp.sasl.SASLResult;
@@ -108,6 +109,8 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements
 
             try {
                sessionSPI.createTemporaryQueue(address, defRoutingType);
+            } catch (ActiveMQAMQPSecurityException e) {
+               throw e;
             } catch (ActiveMQSecurityException e) {
                throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingTempDestination(e.getMessage());
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a5971ec/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
index fd0a12e..615ffcc 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
@@ -25,10 +25,13 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
 import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
+import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.qpid.jms.JmsConnectionFactory;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Assume;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -58,24 +61,30 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
    @Parameterized.Parameter(0)
    public String protocol;
 
-   @Test
-   public void testSecureSharedDurableSubscriber() throws Exception {
-      //This is because OpenWire does not support JMS 2.0
-      Assume.assumeFalse(protocol.equals("OPENWIRE"));
+   ActiveMQServer server;
+
+   @Before
+   public void startSever() throws Exception {
+      server = getActiveMQServer("multicast_topic.xml");
+      server.start();
+   }
 
-      ActiveMQServer server = getActiveMQServer("multicast_topic.xml");
+   @After
+   public void stopServer() throws Exception {
       try {
-         server.start();
-         internal_testSecureSharedDurableSubscriber(getConnectionFactory("b", "b"));
-      } finally {
-         try {
+         if (server != null) {
             server.stop();
-         } catch (Exception e) {
          }
+      } catch (Throwable e) {
+         e.printStackTrace();
       }
    }
 
-   private void internal_testSecureSharedDurableSubscriber(ConnectionFactory connectionFactory) throws JMSException {
+   @Test
+   public void testSecureSharedDurableSubscriber() throws Exception {
+      //This is because OpenWire does not support JMS 2.0
+      Assume.assumeFalse(protocol.equals("OPENWIRE"));
+      ConnectionFactory connectionFactory = getConnectionFactory("b", "b");
       String message = "blah";
 
       //Expect to be able to create subscriber on pre-defined/existing queue.
@@ -101,20 +110,7 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
    public void testSecureSharedSubscriber() throws Exception {
       //This is because OpenWire does not support JMS 2.0
       Assume.assumeFalse(protocol.equals("OPENWIRE"));
-
-      ActiveMQServer server = getActiveMQServer("multicast_topic.xml");
-      try {
-         server.start();
-         internal_testSecureSharedSubscriber(getConnectionFactory("b", "b"));
-      } finally {
-         try {
-            server.stop();
-         } catch (Exception e) {
-         }
-      }
-   }
-
-   private void internal_testSecureSharedSubscriber(ConnectionFactory connectionFactory) throws JMSException {
+      ConnectionFactory connectionFactory = getConnectionFactory("b", "b");
       String message = "blah";
 
       //Expect to be able to create subscriber on pre-defined/existing queue.
@@ -138,19 +134,7 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
 
    @Test
    public void testSecureDurableSubscriber() throws Exception {
-      ActiveMQServer server = getActiveMQServer("multicast_topic.xml");
-      try {
-         server.start();
-         internal_testSecureDurableSubscriber(getConnectionFactory("b", "b"));
-      } finally {
-         try {
-            server.stop();
-         } catch (Exception e) {
-         }
-      }
-   }
-
-   private void internal_testSecureDurableSubscriber(ConnectionFactory connectionFactory) throws JMSException {
+      ConnectionFactory connectionFactory = getConnectionFactory("b", "b");
       String message = "blah";
 
       //Expect to be able to create subscriber on pre-defined/existing queue.
@@ -177,8 +161,31 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
       } catch (JMSSecurityException j) {
          //Expected exception
       }
+
+      Connection connection = null;
+
+      try {
+         connection = connectionFactory.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         try {
+            session.createTemporaryQueue();
+            Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to create a temporary queue");
+         } catch (JMSSecurityException jmsse) {
+            IntegrationTestLogger.LOGGER.info("Client should have thrown a JMSSecurityException but only threw JMSException");
+         } catch (JMSException e) {
+            e.printStackTrace();
+            Assert.fail("thrown a JMSEXception instead of a JMSSEcurityException");
+         }
+
+         // Should not be fatal
+         assertNotNull(connection.createSession(false, Session.AUTO_ACKNOWLEDGE));
+      } finally {
+         connection.close();
+      }
    }
 
+
    private ConnectionFactory getConnectionFactory(String user, String password) {
       switch (protocol) {
          case "CORE": return getActiveMQConnectionFactory(user, password);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3a5971ec/tests/integration-tests/src/test/resources/multicast_topic.xml
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/resources/multicast_topic.xml b/tests/integration-tests/src/test/resources/multicast_topic.xml
index cf5430e..2535ad3 100644
--- a/tests/integration-tests/src/test/resources/multicast_topic.xml
+++ b/tests/integration-tests/src/test/resources/multicast_topic.xml
@@ -85,13 +85,13 @@ under the License.
 
       <security-settings>
          <security-setting match="#">
-            <permission type="createNonDurableQueue" roles="a,b"/>
-            <permission type="deleteNonDurableQueue" roles="a,b"/>
-            <permission type="createDurableQueue" roles="a,b"/>
-            <permission type="deleteDurableQueue" roles="a,b"/>
+            <permission type="createNonDurableQueue" roles="a"/>
+            <permission type="deleteNonDurableQueue" roles="a"/>
+            <permission type="createDurableQueue" roles="a"/>
+            <permission type="deleteDurableQueue" roles="a"/>
             <permission type="browse" roles="a"/>
-            <permission type="send" roles="a,b"/>
-            <permission type="consume" roles="a,b" />
+            <permission type="send" roles="a"/>
+            <permission type="consume" roles="a" />
             <!-- we need this otherwise ./artemis data imp wouldn't work -->
             <permission type="manage" roles="a"/>
          </security-setting>


[11/33] activemq-artemis git commit: This closes #2091

Posted by cl...@apache.org.
This closes #2091


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

Branch: refs/heads/2.6.x
Commit: 90273c92cc29e7ee67dd61d82879ce0107a279c4
Parents: 7a917dc 32a92b5
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 21 19:47:01 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 19:47:01 2018 -0400

----------------------------------------------------------------------
 docs/user-manual/en/persistence.md | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------



[17/33] activemq-artemis git commit: ARTEMIS-1872 Check for queue exists before creating shared queue

Posted by cl...@apache.org.
ARTEMIS-1872 Check for queue exists before creating shared queue

1. Add tests case to verify issue and fix, tests also tests for same behavior using CORE, OPENWIRE and AMQP JMS Clients.
2. Update Core Client to check for queue before creating, sharedQueue as per createQueue logic.
3. Update ServerSessionPacketHandler to handle packets from old clients to perform to implement the same fix server side for older clients.
4. Correct AMQP protocol so correct error code is returned on security exception so that amqp jms can correctly throw JMSsecurityException
5. Correct AMQP protocol to check for queue exists before create
6. Correct OpenWire protocol to check for address exists before create


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

Branch: refs/heads/2.6.x
Commit: a9d9731f0a644ff5bf6fb65583f1fabc832d9ae5
Parents: 78016cb
Author: Michael André Pearce <mi...@me.com>
Authored: Fri May 18 22:09:32 2018 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 23 13:11:25 2018 -0400

----------------------------------------------------------------------
 .../core/protocol/core/impl/PacketImpl.java     |   2 +
 .../artemis/jms/client/ActiveMQSession.java     |  23 +-
 .../amqp/broker/AMQPSessionCallback.java        |  27 +-
 .../amqp/proton/ProtonServerSenderContext.java  |   6 +-
 .../protocol/openwire/OpenWireConnection.java   |   6 +-
 .../core/ServerSessionPacketHandler.java        |  11 +-
 .../server/SecureConfigurationTest.java         | 260 +++++++++++++++++++
 .../src/test/resources/multicast_topic.xml      | 146 +++++++++++
 8 files changed, 459 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9d9731f/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 684ca5c..c275e21 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
@@ -31,6 +31,8 @@ public class PacketImpl implements Packet {
 
    // 2.0.0
    public static final int ADDRESSING_CHANGE_VERSION = 129;
+   public static final int SHARED_QUEUE_SECURITY_FIX_CHANGE_VERSION = 130;
+
 
    public static final SimpleString OLD_QUEUE_PREFIX = new SimpleString("jms.queue.");
    public static final SimpleString OLD_TOPIC_PREFIX = new SimpleString("jms.topic.");

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9d9731f/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 5f29211..3149ff0 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
@@ -46,6 +46,7 @@ import javax.transaction.xa.XAResource;
 import java.io.Serializable;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
@@ -630,16 +631,20 @@ public class ActiveMQSession implements QueueSession, TopicSession {
 
          queueName = ActiveMQDestination.createQueueNameForSubscription(durability == ConsumerDurability.DURABLE, connection.getClientID(), subscriptionName);
 
-         try {
-            if (durability == ConsumerDurability.DURABLE) {
-               createSharedQueue(dest, RoutingType.MULTICAST, queueName, coreFilterString, true, response.getDefaultMaxConsumers(), response.isDefaultPurgeOnNoConsumers(), response.isDefaultExclusive(), response.isDefaultLastValueQueue());
-            } else {
-               createSharedQueue(dest, RoutingType.MULTICAST, queueName, coreFilterString, false, response.getDefaultMaxConsumers(), response.isDefaultPurgeOnNoConsumers(), response.isDefaultExclusive(), response.isDefaultLastValueQueue());
+         QueueQuery subResponse = session.queueQuery(queueName);
+
+         if (!(subResponse.isExists() && Objects.equals(subResponse.getAddress(), dest.getSimpleAddress()) && Objects.equals(subResponse.getFilterString(), coreFilterString))) {
+            try {
+               if (durability == ConsumerDurability.DURABLE) {
+                  createSharedQueue(dest, RoutingType.MULTICAST, queueName, coreFilterString, true, response.getDefaultMaxConsumers(), response.isDefaultPurgeOnNoConsumers(), response.isDefaultExclusive(), response.isDefaultLastValueQueue());
+               } else {
+                  createSharedQueue(dest, RoutingType.MULTICAST, queueName, coreFilterString, false, response.getDefaultMaxConsumers(), response.isDefaultPurgeOnNoConsumers(), response.isDefaultExclusive(), response.isDefaultLastValueQueue());
+               }
+            } catch (ActiveMQQueueExistsException ignored) {
+               // We ignore this because querying and then creating the queue wouldn't be idempotent
+               // we could also add a parameter to ignore existence what would require a bigger work around to avoid
+               // compatibility.
             }
-         } catch (ActiveMQQueueExistsException ignored) {
-            // We ignore this because querying and then creating the queue wouldn't be idempotent
-            // we could also add a parameter to ignore existence what would require a bigger work around to avoid
-            // compatibility.
          }
 
          consumer = session.createConsumer(queueName, null, false);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9d9731f/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 105d58a..1301f0b 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
@@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.activemq.artemis.api.core.ActiveMQAddressExistsException;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
+import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
 import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
@@ -237,35 +238,51 @@ public class AMQPSessionCallback implements SessionCallback {
    }
 
    public void createTemporaryQueue(SimpleString queueName, RoutingType routingType) throws Exception {
-      serverSession.createQueue(queueName, queueName, routingType, null, true, false);
+      createTemporaryQueue(queueName, queueName, routingType, null);
    }
 
    public void createTemporaryQueue(SimpleString address,
                                     SimpleString queueName,
                                     RoutingType routingType,
                                     SimpleString filter) throws Exception {
-      serverSession.createQueue(address, queueName, routingType, filter, true, false);
+      try {
+         serverSession.createQueue(address, queueName, routingType, filter, true, false);
+      } catch (ActiveMQSecurityException se) {
+         throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage());
+      }
    }
 
    public void createUnsharedDurableQueue(SimpleString address,
                                           RoutingType routingType,
                                           SimpleString queueName,
                                           SimpleString filter) throws Exception {
-      serverSession.createQueue(address, queueName, routingType, filter, false, true, 1, false, false);
+      try {
+         serverSession.createQueue(address, queueName, routingType, filter, false, true, 1, false, false);
+      } catch (ActiveMQSecurityException se) {
+         throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage());
+      }
    }
 
    public void createSharedDurableQueue(SimpleString address,
                                         RoutingType routingType,
                                         SimpleString queueName,
                                         SimpleString filter) throws Exception {
-      serverSession.createQueue(address, queueName, routingType, filter, false, true, -1, false, false);
+      try {
+         serverSession.createQueue(address, queueName, routingType, filter, false, true, -1, false, false);
+      } catch (ActiveMQSecurityException se) {
+         throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage());
+      }
    }
 
    public void createSharedVolatileQueue(SimpleString address,
                                          RoutingType routingType,
                                          SimpleString queueName,
                                          SimpleString filter) throws Exception {
-      serverSession.createQueue(address, queueName, routingType, filter, false, false, -1, true, true);
+      try {
+         serverSession.createQueue(address, queueName, routingType, filter, false, false, -1, true, true);
+      } catch (ActiveMQSecurityException se) {
+         throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage());
+      }
    }
 
    public QueueQueryResult queueQuery(SimpleString queueName, RoutingType routingType, boolean autoCreate) throws Exception {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9d9731f/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
index 9b4704f..ddd9b39 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
@@ -23,7 +23,6 @@ import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
-import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
 import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
 import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.RoutingType;
@@ -370,10 +369,9 @@ public class ProtonServerSenderContext extends ProtonInitializable implements Pr
                isVolatile = true;
                if (shared && sender.getName() != null) {
                   queue = createQueueName(connection.isUseCoreSubscriptionNaming(), getClientId(), sender.getName(), shared, global, isVolatile);
-                  try {
+                  QueueQueryResult result = sessionSPI.queueQuery(queue, routingTypeToUse, false);
+                  if (!(result.isExists() && Objects.equals(result.getAddress(), addressToUse) && Objects.equals(result.getFilterString(), simpleStringSelector))) {
                      sessionSPI.createSharedVolatileQueue(addressToUse, RoutingType.MULTICAST, queue, simpleStringSelector);
-                  } catch (ActiveMQQueueExistsException e) {
-                     //this is ok, just means its shared
                   }
                } else {
                   queue = SimpleString.toSimpleString(java.util.UUID.randomUUID().toString());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9d9731f/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 21b2d46..225aac4 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -812,8 +812,10 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
             }
          } else if (dest.isTopic() && (addressSettings.isAutoCreateAddresses() || dest.isTemporary())) {
             try {
-               internalSession.createAddress(addressInfo, !dest.isTemporary());
-               created = true;
+               if (internalSession.getAddress(addressInfo.getName()) == null) {
+                  internalSession.createAddress(addressInfo, !dest.isTemporary());
+                  created = true;
+               }
             } catch (ActiveMQAddressExistsException exists) {
                // The address may have been created by another thread in the mean time.  Catch and do nothing.
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9d9731f/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 edfd566..36273f8 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
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.protocol.core;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 import java.util.List;
+import java.util.Objects;
 
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
@@ -362,7 +363,10 @@ public class ServerSessionPacketHandler implements ChannelHandler {
                case CREATE_SHARED_QUEUE: {
                   CreateSharedQueueMessage request = (CreateSharedQueueMessage) packet;
                   requiresResponse = request.isRequiresResponse();
-                  session.createSharedQueue(request.getAddress(), request.getQueueName(), request.isDurable(), request.getFilterString());
+                  QueueQueryResult result = session.executeQueueQuery(request.getQueueName());
+                  if (!(result.isExists() && Objects.equals(result.getAddress(), request.getAddress()) && Objects.equals(result.getFilterString(), request.getFilterString()))) {
+                     session.createSharedQueue(request.getAddress(), request.getQueueName(), request.isDurable(), request.getFilterString());
+                  }
                   if (requiresResponse) {
                      response = new NullResponseMessage();
                   }
@@ -371,7 +375,10 @@ public class ServerSessionPacketHandler implements ChannelHandler {
                case CREATE_SHARED_QUEUE_V2: {
                   CreateSharedQueueMessage_V2 request = (CreateSharedQueueMessage_V2) packet;
                   requiresResponse = request.isRequiresResponse();
-                  session.createSharedQueue(request.getAddress(), request.getQueueName(), request.getRoutingType(), request.getFilterString(), request.isDurable(), request.getMaxConsumers(), request.isPurgeOnNoConsumers(), request.isExclusive(), request.isLastValue());
+                  QueueQueryResult result = session.executeQueueQuery(request.getQueueName());
+                  if (!(result.isExists() && Objects.equals(result.getAddress(), request.getAddress()) && Objects.equals(result.getFilterString(), request.getFilterString()))) {
+                     session.createSharedQueue(request.getAddress(), request.getQueueName(), request.getRoutingType(), request.getFilterString(), request.isDurable(), request.getMaxConsumers(), request.isPurgeOnNoConsumers(), request.isExclusive(), request.isLastValue());
+                  }
                   if (requiresResponse) {
                      response = new NullResponseMessage();
                   }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9d9731f/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
new file mode 100644
index 0000000..fd0a12e
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
@@ -0,0 +1,260 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.server;
+
+import org.apache.activemq.artemis.core.config.FileDeploymentManager;
+import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.qpid.jms.JmsConnectionFactory;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.JMSSecurityException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import java.util.Arrays;
+import java.util.Collection;
+
+@RunWith(Parameterized.class)
+public class SecureConfigurationTest extends ActiveMQTestBase {
+
+   @Parameterized.Parameters(name = "{index}: protocol={0}")
+   public static Collection<Object[]> parameters() {
+      return Arrays.asList(new Object[][] {
+         {"CORE"}, {"AMQP"}, {"OPENWIRE"}
+      });
+   }
+
+   /* NOT private @see https://github.com/junit-team/junit4/wiki/parameterized-tests */
+   @Parameterized.Parameter(0)
+   public String protocol;
+
+   @Test
+   public void testSecureSharedDurableSubscriber() throws Exception {
+      //This is because OpenWire does not support JMS 2.0
+      Assume.assumeFalse(protocol.equals("OPENWIRE"));
+
+      ActiveMQServer server = getActiveMQServer("multicast_topic.xml");
+      try {
+         server.start();
+         internal_testSecureSharedDurableSubscriber(getConnectionFactory("b", "b"));
+      } finally {
+         try {
+            server.stop();
+         } catch (Exception e) {
+         }
+      }
+   }
+
+   private void internal_testSecureSharedDurableSubscriber(ConnectionFactory connectionFactory) throws JMSException {
+      String message = "blah";
+
+      //Expect to be able to create subscriber on pre-defined/existing queue.
+      String messageRecieved = sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/queue"));
+      Assert.assertEquals(message, messageRecieved);
+
+      try {
+         sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/non-existant-queue"));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+      } catch (JMSSecurityException j) {
+         //Expected exception
+      }
+
+      try {
+         sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/queue", "age < 10"));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+      } catch (JMSSecurityException j) {
+         //Expected exception
+      }
+   }
+
+   @Test
+   public void testSecureSharedSubscriber() throws Exception {
+      //This is because OpenWire does not support JMS 2.0
+      Assume.assumeFalse(protocol.equals("OPENWIRE"));
+
+      ActiveMQServer server = getActiveMQServer("multicast_topic.xml");
+      try {
+         server.start();
+         internal_testSecureSharedSubscriber(getConnectionFactory("b", "b"));
+      } finally {
+         try {
+            server.stop();
+         } catch (Exception e) {
+         }
+      }
+   }
+
+   private void internal_testSecureSharedSubscriber(ConnectionFactory connectionFactory) throws JMSException {
+      String message = "blah";
+
+      //Expect to be able to create subscriber on pre-defined/existing queue.
+      String messageRecieved = sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/queue"));
+      Assert.assertEquals(message, messageRecieved);
+
+      try {
+         sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/non-existant-queue"));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+      } catch (JMSSecurityException j) {
+         //Expected exception
+      }
+
+      try {
+         sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/queue", "age < 10"));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+      } catch (JMSSecurityException j) {
+         //Expected exception
+      }
+   }
+
+   @Test
+   public void testSecureDurableSubscriber() throws Exception {
+      ActiveMQServer server = getActiveMQServer("multicast_topic.xml");
+      try {
+         server.start();
+         internal_testSecureDurableSubscriber(getConnectionFactory("b", "b"));
+      } finally {
+         try {
+            server.stop();
+         } catch (Exception e) {
+         }
+      }
+   }
+
+   private void internal_testSecureDurableSubscriber(ConnectionFactory connectionFactory) throws JMSException {
+      String message = "blah";
+
+      //Expect to be able to create subscriber on pre-defined/existing queue.
+      String messageRecieved = sendAndReceiveText(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue"));
+      Assert.assertEquals(message, messageRecieved);
+
+      try {
+         sendAndReceiveText(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/non-existant-queue"));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+      } catch (JMSSecurityException j) {
+         //Expected exception
+      }
+
+      try {
+         sendAndReceiveText(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue", "age < 10", false));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+      } catch (JMSSecurityException j) {
+         //Expected exception
+      }
+
+      try {
+         sendAndReceiveText(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue", "age < 10", true));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+      } catch (JMSSecurityException j) {
+         //Expected exception
+      }
+   }
+
+   private ConnectionFactory getConnectionFactory(String user, String password) {
+      switch (protocol) {
+         case "CORE": return getActiveMQConnectionFactory(user, password);
+         case "AMQP" : return getAMQPConnectionFactory(user, password);
+         case "OPENWIRE": return getOpenWireConnectionFactory(user, password);
+         default: throw new IllegalStateException("Unsupported Protocol");
+      }
+   }
+
+   private ActiveMQConnectionFactory getActiveMQConnectionFactory(String user, String password) {
+      ActiveMQConnectionFactory activeMQConnection = new ActiveMQConnectionFactory("tcp://localhost:61616");
+      activeMQConnection.setUser(user);
+      activeMQConnection.setPassword(password);
+      return activeMQConnection;
+   }
+
+   private JmsConnectionFactory getAMQPConnectionFactory(String user, String password) {
+      JmsConnectionFactory jmsConnectionFactory = new JmsConnectionFactory("amqp://localhost:61616");
+      jmsConnectionFactory.setUsername(user);
+      jmsConnectionFactory.setPassword(password);
+      return jmsConnectionFactory;
+   }
+
+   private org.apache.activemq.ActiveMQConnectionFactory getOpenWireConnectionFactory(String user, String password) {
+      org.apache.activemq.ActiveMQConnectionFactory activeMQConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory("tcp://localhost:61616");
+      activeMQConnectionFactory.setUserName(user);
+      activeMQConnectionFactory.setPassword(password);
+      return activeMQConnectionFactory;
+   }
+
+   private String sendAndReceiveText(ConnectionFactory connectionFactory, String clientId, String message, String topicName, ConsumerSupplier consumerSupplier) throws JMSException {
+      String messageRecieved;
+      try (Connection connection = connectionFactory.createConnection()) {
+         if (clientId != null && !clientId.isEmpty()) {
+            connection.setClientID(clientId);
+         }
+         connection.start();
+         try (Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) {
+            Topic topic = session.createTopic(topicName);
+            MessageConsumer messageConsumer = consumerSupplier.create(topic, session);
+            messageConsumer.receive(1000);
+
+            TextMessage messageToSend = session.createTextMessage(message);
+            session.createProducer(topic).send(messageToSend);
+
+            TextMessage received = (TextMessage) messageConsumer.receive(1000);
+            messageRecieved = received != null ? received.getText() : null;
+         }
+      }
+      return messageRecieved;
+   }
+
+   protected ActiveMQServer getActiveMQServer(String brokerConfig) throws Exception {
+      FileConfiguration fc = new FileConfiguration();
+      FileJMSConfiguration fileConfiguration = new FileJMSConfiguration();
+      FileDeploymentManager deploymentManager = new FileDeploymentManager(brokerConfig);
+      deploymentManager.addDeployable(fc);
+      deploymentManager.addDeployable(fileConfiguration);
+      deploymentManager.readConfiguration();
+
+
+      SecurityConfiguration securityConfiguration = new SecurityConfiguration();
+      securityConfiguration.addUser("a", "a");
+      securityConfiguration.addRole("a", "a");
+
+      securityConfiguration.addUser("b", "b");
+      securityConfiguration.addRole("b", "b");
+
+
+      ActiveMQJAASSecurityManager sm = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfiguration);
+
+      return addServer(new ActiveMQServerImpl(fc, sm));
+   }
+
+   private interface ConsumerSupplier {
+      MessageConsumer create(Topic topic, Session session) throws JMSException;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a9d9731f/tests/integration-tests/src/test/resources/multicast_topic.xml
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/resources/multicast_topic.xml b/tests/integration-tests/src/test/resources/multicast_topic.xml
new file mode 100644
index 0000000..cf5430e
--- /dev/null
+++ b/tests/integration-tests/src/test/resources/multicast_topic.xml
@@ -0,0 +1,146 @@
+<?xml version='1.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.
+-->
+
+<configuration xmlns="urn:activemq"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
+
+
+   <core xmlns="urn:activemq:core">
+
+      <name>0.0.0.0</name>
+
+      <configuration-file-refresh-period>100</configuration-file-refresh-period>
+
+      <persistence-enabled>false</persistence-enabled>
+
+      <security-enabled>true</security-enabled>
+
+      <!-- this could be ASYNCIO or NIO
+       -->
+      <journal-type>NIO</journal-type>
+
+      <paging-directory>./data/paging</paging-directory>
+
+      <bindings-directory>./data/bindings</bindings-directory>
+
+      <journal-directory>./data/journal</journal-directory>
+
+      <large-messages-directory>./data/large-messages</large-messages-directory>
+
+      <journal-min-files>2</journal-min-files>
+
+      <journal-pool-files>-1</journal-pool-files>
+
+      <amqp-use-core-subscription-naming>true</amqp-use-core-subscription-naming>
+
+      <!--
+       This value was determined through a calculation.
+       Your system could perform 25 writes per millisecond
+       on the current journal configuration.
+       That translates as a sync write every 40000 nanoseconds
+      -->
+      <journal-buffer-timeout>40000</journal-buffer-timeout>
+
+      <addresses>
+         <address name="secured_topic_shared_durable">
+            <multicast>
+               <queue name="secured_topic_shared_durable/queue" />
+            </multicast>
+         </address>
+
+         <address name="secured_topic_shared">
+            <multicast>
+               <queue name="nonDurable.secured_topic_shared/queue" purge-on-no-consumers="true" />
+            </multicast>
+         </address>
+
+         <address name="secured_topic_durable">
+            <multicast>
+               <queue name="clientId.secured_topic_durable/queue" />
+            </multicast>
+         </address>
+      </addresses>
+
+      <acceptors>
+         <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
+      </acceptors>
+
+      <security-settings>
+         <security-setting match="#">
+            <permission type="createNonDurableQueue" roles="a,b"/>
+            <permission type="deleteNonDurableQueue" roles="a,b"/>
+            <permission type="createDurableQueue" roles="a,b"/>
+            <permission type="deleteDurableQueue" roles="a,b"/>
+            <permission type="browse" roles="a"/>
+            <permission type="send" roles="a,b"/>
+            <permission type="consume" roles="a,b" />
+            <!-- we need this otherwise ./artemis data imp wouldn't work -->
+            <permission type="manage" roles="a"/>
+         </security-setting>
+         <security-setting match="secured_topic_shared_durable">
+            <permission type="createNonDurableQueue" roles="a"/>
+            <permission type="deleteNonDurableQueue" roles="a"/>
+            <permission type="createDurableQueue" roles="a"/>
+            <permission type="deleteDurableQueue" roles="a"/>
+            <permission type="browse" roles="a"/>
+            <permission type="send" roles="a,b"/>
+            <permission type="consume" roles="a,b" />
+            <!-- we need this otherwise ./artemis data imp wouldn't work -->
+            <permission type="manage" roles="a"/>
+         </security-setting>
+         <security-setting match="secured_topic_shared">
+            <permission type="createNonDurableQueue" roles="a"/>
+            <permission type="deleteNonDurableQueue" roles="a"/>
+            <permission type="createDurableQueue" roles="a"/>
+            <permission type="deleteDurableQueue" roles="a"/>
+            <permission type="browse" roles="a"/>
+            <permission type="send" roles="a,b"/>
+            <permission type="consume" roles="a,b" />
+            <!-- we need this otherwise ./artemis data imp wouldn't work -->
+            <permission type="manage" roles="a"/>
+         </security-setting>
+         <security-setting match="secured_topic_durable">
+            <permission type="createNonDurableQueue" roles="a"/>
+            <permission type="deleteNonDurableQueue" roles="a"/>
+            <permission type="createDurableQueue" roles="a"/>
+            <permission type="deleteDurableQueue" roles="a"/>
+            <permission type="browse" roles="a"/>
+            <permission type="send" roles="a,b"/>
+            <permission type="consume" roles="a,b" />
+            <!-- we need this otherwise ./artemis data imp wouldn't work -->
+            <permission type="manage" roles="a"/>
+         </security-setting>
+      </security-settings>
+
+      <address-settings>
+         <!--default for catch all-->
+         <address-setting match="#">
+            <auto-create-queues>false</auto-create-queues>
+            <dead-letter-address>DLQ</dead-letter-address>
+            <expiry-address>ExpiryQueue</expiry-address>
+            <redelivery-delay>0</redelivery-delay>
+            <max-size-bytes>10Mb</max-size-bytes>
+            <message-counter-history-day-limit>10</message-counter-history-day-limit>
+            <address-full-policy>BLOCK</address-full-policy>
+         </address-setting>
+      </address-settings>
+   </core>
+</configuration>


[10/33] activemq-artemis git commit: ARTEMIS-1874 fix NPE setting object property

Posted by cl...@apache.org.
ARTEMIS-1874 fix NPE setting object property


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

Branch: refs/heads/2.6.x
Commit: 4d492bea0ee5fb00dcceca9366375cb87d32fe94
Parents: 6e6a76d
Author: Justin Bertram <jb...@apache.org>
Authored: Mon May 21 09:55:15 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 18:10:00 2018 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/jms/client/ActiveMQMessage.java | 2 +-
 .../artemis/tests/integration/jms/client/MessageTest.java       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4d492bea/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 6e28c0e..18f8000 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
@@ -965,7 +965,7 @@ public class ActiveMQMessage implements javax.jms.Message {
       boolean result = false;
 
       if (jmsPropertyName.equals(name)) {
-         message.putStringProperty(corePropertyName, value.toString());
+         message.putStringProperty(corePropertyName, value == null ? null : value.toString());
 
          result = true;
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4d492bea/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java
index 29063f2..5641bbf 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MessageTest.java
@@ -26,6 +26,7 @@ import javax.jms.Session;
 import javax.jms.StreamMessage;
 
 import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.reader.MessageUtil;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.JMSTestBase;
 import org.junit.Assert;
@@ -193,6 +194,10 @@ public class MessageTest extends JMSTestBase {
 
       msg.setObjectProperty(MessageTest.propName1, null);
 
+      msg.setObjectProperty(MessageUtil.JMSXGROUPID, null);
+
+      msg.setObjectProperty(MessageUtil.JMSXUSERID, null);
+
       msg.setStringProperty(MessageTest.propName2, null);
 
       msg.getStringProperty(MessageTest.propName1);


[02/33] activemq-artemis git commit: ARTEMIS-1875 Add message address if not set during redistribution

Posted by cl...@apache.org.
ARTEMIS-1875 Add message address if not set during redistribution


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

Branch: refs/heads/2.6.x
Commit: 4b04b53bc9b34e622329e890e4b4613cbc385498
Parents: 07197b8
Author: Martyn Taylor <mt...@redhat.com>
Authored: Mon May 21 18:21:26 2018 +0100
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Mon May 21 18:23:42 2018 +0100

----------------------------------------------------------------------
 .../activemq/artemis/core/postoffice/impl/PostOfficeImpl.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4b04b53b/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 f1f7a38..b722532 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
@@ -970,7 +970,6 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
    public Pair<RoutingContext, Message> redistribute(final Message message,
                                                      final Queue originatingQueue,
                                                      final Transaction tx) throws Exception {
-
       Bindings bindings = addressManager.getBindingsForRoutingAddress(originatingQueue.getAddress());
 
       if (bindings != null && bindings.allowRedistribute()) {
@@ -978,6 +977,10 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
          // arrived the target node
          // as described on https://issues.jboss.org/browse/JBPAPP-6130
          Message copyRedistribute = message.copy(storageManager.generateID());
+         if (copyRedistribute.getAddress() == null) {
+            copyRedistribute.setAddress(originatingQueue.getAddress());
+         }
+
          if (tx != null) {
             tx.addOperation(new TransactionOperationAbstract() {
                @Override


[08/33] activemq-artemis git commit: ARTEMIS-1853 Adding Netty OpenSSL provider test

Posted by cl...@apache.org.
ARTEMIS-1853 Adding Netty OpenSSL provider test

Added some netty openssl tests
Fix a NPE issue


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

Branch: refs/heads/2.6.x
Commit: 8b458b568268e4364bae94d25535d9373a8a49f8
Parents: ef03ce4
Author: Howard Gao <ho...@gmail.com>
Authored: Fri May 18 06:50:37 2018 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 18:09:29 2018 -0400

----------------------------------------------------------------------
 .../core/remoting/impl/ssl/SSLSupport.java      |   2 +-
 .../tests/integration/ssl/SSLProviderTest.java  |  84 +++++++++++++++
 .../integration/ssl/SSLProviderTwoWayTest.java  | 101 +++++++++++++++++
 .../tests/integration/ssl/SSLTestBase.java      | 108 +++++++++++++++++++
 4 files changed, 294 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8b458b56/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
index 85c2c50..905e19e 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java
@@ -125,7 +125,7 @@ public class SSLSupport {
                                                final boolean trustAll  ) throws Exception {
       KeyStore keyStore = SSLSupport.loadKeystore(keystoreProvider, keystorePath, keystorePassword);
       KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
-      keyManagerFactory.init(keyStore, keystorePassword.toCharArray());
+      keyManagerFactory.init(keyStore, keystorePassword == null ? null : keystorePassword.toCharArray());
       return SslContextBuilder.forClient().sslProvider(SslProvider.valueOf(sslProvider)).keyManager(keyManagerFactory).trustManager(SSLSupport.loadTrustManagerFactory(trustStoreProvider, trustStorePath, trustStorePassword, trustAll, null)).build();
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8b458b56/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTest.java
new file mode 100644
index 0000000..3fa976f
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.ssl;
+
+import org.apache.activemq.artemis.api.core.RoutingType;
+import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
+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.ClientProducer;
+import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor;
+import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+@RunWith(Parameterized.class)
+public class SSLProviderTest extends SSLTestBase {
+
+   public SSLProviderTest(String sslProvider, String clientSslProvider) {
+      super(sslProvider, clientSslProvider);
+   }
+
+   @Test
+   public void testProviderConfig() {
+      NettyAcceptor acceptor = (NettyAcceptor) server.getRemotingService().getAcceptor(getNettyAcceptorName());
+      assertNotNull(acceptor);
+      String sslProviderInUse = (String) acceptor.getConfiguration().get(TransportConstants.SSL_PROVIDER);
+      assertEquals(sslProvider, sslProviderInUse);
+   }
+
+   @Test
+   public void testProviderLoading() throws Exception {
+      if (!isOpenSSLSupported()) {
+         System.out.println("*** Skip test on un-supported platform.");
+         return;
+      }
+
+      final String text = "Hello SSL!";
+      StringBuilder uri = new StringBuilder("tcp://" + tc.getParams().get(TransportConstants.HOST_PROP_NAME).toString()
+              + ":" + tc.getParams().get(TransportConstants.PORT_PROP_NAME).toString());
+
+      uri.append("?").append(TransportConstants.SSL_ENABLED_PROP_NAME).append("=true");
+      uri.append("&").append(TransportConstants.SSL_PROVIDER).append("=").append(clientSslProvider);
+      uri.append("&").append(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME).append("=JKS");
+      uri.append("&").append(TransportConstants.TRUSTSTORE_PATH_PROP_NAME).append("=").append(CLIENT_SIDE_TRUSTSTORE);
+      uri.append("&").append(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME).append("=").append(PASSWORD);
+
+      System.out.println("uri: " + uri.toString());
+      ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocator(uri.toString()));
+      ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
+      ClientSession session = addClientSession(sf.createSession(false, true, true));
+      session.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE);
+      ClientProducer producer = addClientProducer(session.createProducer(QUEUE));
+
+      ClientMessage message = createTextMessage(session, text);
+      producer.send(message);
+
+      ClientConsumer consumer = addClientConsumer(session.createConsumer(QUEUE));
+      session.start();
+
+      ClientMessage m = consumer.receive(1000);
+      Assert.assertNotNull(m);
+      Assert.assertEquals(text, m.getBodyBuffer().readString());
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8b458b56/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTwoWayTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTwoWayTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTwoWayTest.java
new file mode 100644
index 0000000..cc93d47
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTwoWayTest.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.ssl;
+
+import org.apache.activemq.artemis.api.core.RoutingType;
+import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
+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.ClientProducer;
+import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor;
+import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Map;
+
+@RunWith(Parameterized.class)
+public class SSLProviderTwoWayTest extends SSLTestBase {
+
+   public SSLProviderTwoWayTest(String sslProvider, String clientSslProvider) {
+      super(sslProvider, clientSslProvider);
+   }
+
+   @Override
+   protected void configureSSLParameters(Map<String, Object> params) {
+      super.configureSSLParameters(params);
+
+      params.put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, SERVER_SIDE_TRUSTSTORE);
+      params.put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
+      params.put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, "JKS");
+      params.put(TransportConstants.NEED_CLIENT_AUTH_PROP_NAME, true);
+   }
+
+   @Test
+   public void testProviderConfig() {
+      NettyAcceptor acceptor = (NettyAcceptor) server.getRemotingService().getAcceptor(getNettyAcceptorName());
+      assertNotNull(acceptor);
+      String sslProviderInUse = (String) acceptor.getConfiguration().get(TransportConstants.SSL_PROVIDER);
+      assertEquals(sslProvider, sslProviderInUse);
+      assertTrue((Boolean) acceptor.getConfiguration().get(TransportConstants.NEED_CLIENT_AUTH_PROP_NAME));
+   }
+
+   @Test
+   public void testProviderLoading2Way() throws Exception {
+      if (!isOpenSSLSupported()) {
+         System.out.println("*** Skip test on un-supported platform.");
+         return;
+      }
+
+      final String text = "Hello SSL!";
+      StringBuilder uri = new StringBuilder("tcp://" + tc.getParams().get(TransportConstants.HOST_PROP_NAME).toString()
+              + ":" + tc.getParams().get(TransportConstants.PORT_PROP_NAME).toString());
+
+      uri.append("?").append(TransportConstants.SSL_ENABLED_PROP_NAME).append("=true");
+      uri.append("&").append(TransportConstants.SSL_PROVIDER).append("=").append(clientSslProvider);
+      uri.append("&").append(TransportConstants.KEYSTORE_PROVIDER_PROP_NAME).append("=").append("JKS");
+      uri.append("&").append(TransportConstants.KEYSTORE_PATH_PROP_NAME).append("=").append(CLIENT_SIDE_KEYSTORE);
+      uri.append("&").append(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME).append("=").append(PASSWORD);
+      uri.append("&").append(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME).append("=JKS");
+      uri.append("&").append(TransportConstants.TRUSTSTORE_PATH_PROP_NAME).append("=").append(CLIENT_SIDE_TRUSTSTORE);
+      uri.append("&").append(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME).append("=").append(PASSWORD);
+
+      System.out.println("uri: " + uri.toString());
+      ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocator(uri.toString()));
+      ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator));
+      ClientSession session = addClientSession(sf.createSession(false, true, true));
+      session.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE);
+      ClientProducer producer = addClientProducer(session.createProducer(QUEUE));
+
+      ClientMessage message = createTextMessage(session, text);
+      producer.send(message);
+
+      ClientConsumer consumer = addClientConsumer(session.createConsumer(QUEUE));
+      session.start();
+
+      ClientMessage m = consumer.receive(1000);
+      Assert.assertNotNull(m);
+      Assert.assertEquals(text, m.getBodyBuffer().readString());
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8b458b56/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLTestBase.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLTestBase.java
new file mode 100644
index 0000000..92281e5
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLTestBase.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.ssl;
+
+import io.netty.handler.ssl.OpenSsl;
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
+import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.ActiveMQServers;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.junit.Before;
+import org.junit.runners.Parameterized;
+
+import java.lang.management.ManagementFactory;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public abstract class SSLTestBase extends ActiveMQTestBase {
+
+   @Parameterized.Parameters(name = "sslProvider={0},clientProvider={1}")
+   public static Collection getParameters() {
+      return Arrays.asList(new Object[][]{{TransportConstants.OPENSSL_PROVIDER, TransportConstants.DEFAULT_SSL_PROVIDER},
+                                          {TransportConstants.OPENSSL_PROVIDER, TransportConstants.OPENSSL_PROVIDER},
+                                          {TransportConstants.DEFAULT_SSL_PROVIDER, TransportConstants.DEFAULT_SSL_PROVIDER},
+                                          {TransportConstants.DEFAULT_SSL_PROVIDER, TransportConstants.OPENSSL_PROVIDER}});
+   }
+
+   protected static final String QUEUE = "ssl.test.queue";
+
+   protected final String PASSWORD = "secureexample";
+   protected String SERVER_SIDE_KEYSTORE = "openssl-server-side-keystore.jks";
+   protected String SERVER_SIDE_TRUSTSTORE = "openssl-server-side-truststore.jks";
+   protected String CLIENT_SIDE_TRUSTSTORE = "openssl-client-side-truststore.jks";
+   protected String CLIENT_SIDE_KEYSTORE = "openssl-client-side-keystore.jks";
+
+   protected ActiveMQServer server;
+
+   protected TransportConfiguration tc;
+
+   protected String sslProvider;
+   protected String clientSslProvider;
+
+   public SSLTestBase(String sslProvider, String clientSslProvider) {
+      this.sslProvider = sslProvider;
+      this.clientSslProvider = clientSslProvider;
+   }
+
+   @Override
+   @Before
+   public void setUp() throws Exception {
+      super.setUp();
+      Map<String, Object> params = new HashMap<>();
+      configureSSLParameters(params);
+      ConfigurationImpl config = createBasicConfig();
+      config.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params, getNettyAcceptorName()));
+      config.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY));
+
+      server = addServer(ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), null, false));
+
+      server.start();
+      waitForServerToStart(server);
+      tc = new TransportConfiguration(NETTY_CONNECTOR_FACTORY);
+      tc.getParams().put(TransportConstants.HOST_PROP_NAME, params.get(TransportConstants.HOST_PROP_NAME));
+      tc.getParams().put(TransportConstants.PORT_PROP_NAME, params.get(TransportConstants.PORT_PROP_NAME));
+      tc.getParams().put(TransportConstants.SSL_PROVIDER, clientSslProvider);
+   }
+
+   protected void configureSSLParameters(Map<String, Object> params) {
+      System.out.println("*** Configure server SSL using provider: " + sslProvider);
+      params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
+      params.put(TransportConstants.SSL_PROVIDER, sslProvider);
+      params.put(TransportConstants.KEYSTORE_PROVIDER_PROP_NAME, "JKS");
+      params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, SERVER_SIDE_KEYSTORE);
+      params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, PASSWORD);
+      params.put(TransportConstants.HOST_PROP_NAME, "localhost");
+      params.put(TransportConstants.PORT_PROP_NAME, "61617");
+   }
+
+   public String getNettyAcceptorName() {
+      return "SSLTestAcceptor";
+   }
+
+
+   protected boolean isOpenSSLSupported() {
+      if (sslProvider.equals(TransportConstants.OPENSSL_PROVIDER) || clientSslProvider.equals(TransportConstants.OPENSSL_PROVIDER)) {
+         return OpenSsl.isAvailable();
+      }
+      return true;
+   }
+
+}


[28/33] activemq-artemis git commit: This closes #2102

Posted by cl...@apache.org.
This closes #2102


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

Branch: refs/heads/2.6.x
Commit: c915ed1d927f93a65830d4f52f81838d98a9777b
Parents: e6d2607 cb7b5cb
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu May 24 12:00:30 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 12:00:30 2018 -0400

----------------------------------------------------------------------
 .../main/resources/servers/artemisServer.groovy |   2 +-
 .../ssl/CoreClientOverOneWaySSLTest.java        |  24 ++++++++++++++++---
 .../ssl/CoreClientOverTwoWaySSLTest.java        |  24 +++++++++++++++----
 .../src/test/resources/client-side-keystore.p12 | Bin 0 -> 2589 bytes
 .../test/resources/client-side-truststore.p12   | Bin 0 -> 1194 bytes
 .../resources/other-client-side-truststore.p12  | Bin 0 -> 1202 bytes
 .../resources/other-server-side-keystore.p12    | Bin 0 -> 2605 bytes
 .../src/test/resources/server-side-keystore.p12 | Bin 0 -> 2589 bytes
 .../test/resources/server-side-truststore.p12   | Bin 0 -> 1194 bytes
 .../resources/verified-client-side-keystore.p12 | Bin 0 -> 2565 bytes
 .../verified-client-side-truststore.p12         | Bin 0 -> 1162 bytes
 .../resources/verified-server-side-keystore.p12 | Bin 0 -> 2565 bytes
 .../verified-server-side-truststore.p12         | Bin 0 -> 1162 bytes
 13 files changed, 41 insertions(+), 9 deletions(-)
----------------------------------------------------------------------



[09/33] activemq-artemis git commit: This closes #2094

Posted by cl...@apache.org.
This closes #2094


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

Branch: refs/heads/2.6.x
Commit: 7a917dc7d2efcf384e8aeb2f84f533cf9e4aaf77
Parents: 6e6a76d 4d492be
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 21 18:10:00 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 18:10:00 2018 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/jms/client/ActiveMQMessage.java | 2 +-
 .../artemis/tests/integration/jms/client/MessageTest.java       | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[23/33] activemq-artemis git commit: ARTEMIS-1872 Fixing Security test

Posted by cl...@apache.org.
ARTEMIS-1872 Fixing Security test


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

Branch: refs/heads/2.6.x
Commit: 0746ea8acabc1c70fca553c4ac5967212ed311ca
Parents: e28a8a5
Author: Michael André Pearce <mi...@me.com>
Authored: Wed May 23 21:01:22 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 23 22:49:45 2018 -0400

----------------------------------------------------------------------
 .../artemis/jms/client/ActiveMQSession.java     |  21 ++-
 .../server/SecureConfigurationTest.java         | 159 +++++++++++++------
 .../src/test/resources/multicast_topic.xml      |  18 ++-
 3 files changed, 134 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0746ea8a/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 3149ff0..065c7a3 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
@@ -387,7 +387,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
             queue = queueCache.get(queueName);
          }
          if (queue == null) {
-            queue = internalCreateQueue(queueName, false);
+            queue = internalCreateQueue(queueName);
          }
          if (cacheDestination) {
             queueCache.put(queueName, queue);
@@ -397,8 +397,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
          throw JMSExceptionHelper.convertFromActiveMQException(e);
       }
    }
-
-   protected Queue internalCreateQueue(String queueName, final boolean retry) throws ActiveMQException, JMSException {
+   protected Queue internalCreateQueue(String queueName) throws ActiveMQException, JMSException {
       ActiveMQQueue queue = lookupQueue(queueName, false);
 
       if (queue == null) {
@@ -406,15 +405,25 @@ public class ActiveMQSession implements QueueSession, TopicSession {
       }
 
       if (queue == null) {
-         if (!retry) {
-            return internalCreateQueue("jms.queue." + queueName, true);
-         }
+         queue = internalCreateQueueCompatibility("jms.queue." + queueName);
+      }
+      if (queue == null) {
          throw new JMSException("There is no queue with name " + queueName);
       } else {
          return queue;
       }
    }
 
+   protected ActiveMQQueue internalCreateQueueCompatibility(String queueName) throws ActiveMQException, JMSException {
+      ActiveMQQueue queue = lookupQueue(queueName, false);
+
+      if (queue == null) {
+         queue = lookupQueue(queueName, true);
+      }
+
+      return queue;
+   }
+
    @Override
    public Topic createTopic(final String topicName) throws JMSException {
       // As per spec. section 4.11

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0746ea8a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
index 615ffcc..3a15ea9 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/SecureConfigurationTest.java
@@ -16,6 +16,20 @@
  */
 package org.apache.activemq.artemis.tests.integration.server;
 
+import java.lang.IllegalStateException;
+import java.util.Arrays;
+import java.util.Collection;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.JMSRuntimeException;
+import javax.jms.JMSSecurityException;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
 import org.apache.activemq.artemis.core.config.FileDeploymentManager;
 import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
 import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
@@ -25,35 +39,24 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
 import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
-import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.qpid.jms.JmsConnectionFactory;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.JMSSecurityException;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import java.util.Arrays;
-import java.util.Collection;
-
 @RunWith(Parameterized.class)
 public class SecureConfigurationTest extends ActiveMQTestBase {
 
    @Parameterized.Parameters(name = "{index}: protocol={0}")
    public static Collection<Object[]> parameters() {
       return Arrays.asList(new Object[][] {
-         {"CORE"}, {"AMQP"}, {"OPENWIRE"}
+              {"CORE"}, {"AMQP"}, {"OPENWIRE"}
       });
    }
 
@@ -88,18 +91,18 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
       String message = "blah";
 
       //Expect to be able to create subscriber on pre-defined/existing queue.
-      String messageRecieved = sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/queue"));
+      String messageRecieved = sendAndReceiveTextUsingTopic(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/queue"));
       Assert.assertEquals(message, messageRecieved);
 
       try {
-         sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/non-existant-queue"));
+         sendAndReceiveTextUsingTopic(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/non-existant-queue"));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
       } catch (JMSSecurityException j) {
          //Expected exception
       }
 
       try {
-         sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/queue", "age < 10"));
+         sendAndReceiveTextUsingTopic(connectionFactory, null, message, "secured_topic_shared_durable", (t, s) -> s.createSharedDurableConsumer(t, "secured_topic_shared_durable/queue", "age < 10"));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
       } catch (JMSSecurityException j) {
          //Expected exception
@@ -114,18 +117,18 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
       String message = "blah";
 
       //Expect to be able to create subscriber on pre-defined/existing queue.
-      String messageRecieved = sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/queue"));
+      String messageRecieved = sendAndReceiveTextUsingTopic(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/queue"));
       Assert.assertEquals(message, messageRecieved);
 
       try {
-         sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/non-existant-queue"));
+         sendAndReceiveTextUsingTopic(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/non-existant-queue"));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
       } catch (JMSSecurityException j) {
          //Expected exception
       }
 
       try {
-         sendAndReceiveText(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/queue", "age < 10"));
+         sendAndReceiveTextUsingTopic(connectionFactory, null, message, "secured_topic_shared", (t, s) -> s.createSharedConsumer(t, "secured_topic_shared/queue", "age < 10"));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
       } catch (JMSSecurityException j) {
          //Expected exception
@@ -138,60 +141,91 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
       String message = "blah";
 
       //Expect to be able to create subscriber on pre-defined/existing queue.
-      String messageRecieved = sendAndReceiveText(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue"));
+      String messageRecieved = sendAndReceiveTextUsingTopic(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue"));
       Assert.assertEquals(message, messageRecieved);
 
       try {
-         sendAndReceiveText(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/non-existant-queue"));
+         sendAndReceiveTextUsingTopic(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/non-existant-queue"));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
       } catch (JMSSecurityException j) {
          //Expected exception
       }
 
       try {
-         sendAndReceiveText(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue", "age < 10", false));
+         sendAndReceiveTextUsingTopic(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue", "age < 10", false));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
       } catch (JMSSecurityException j) {
          //Expected exception
       }
 
       try {
-         sendAndReceiveText(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue", "age < 10", true));
+         sendAndReceiveTextUsingTopic(connectionFactory, "clientId", message, "secured_topic_durable", (t, s) -> s.createDurableSubscriber(t, "secured_topic_durable/queue", "age < 10", true));
          Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
       } catch (JMSSecurityException j) {
          //Expected exception
       }
+   }
 
-      Connection connection = null;
+   @Test
+   public void testTemporaryQueue() throws Exception {
+      ConnectionFactory connectionFactory = getConnectionFactory("c", "c");
+      String message = "blah";
 
       try {
-         connection = connectionFactory.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-         try {
-            session.createTemporaryQueue();
-            Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to create a temporary queue");
-         } catch (JMSSecurityException jmsse) {
-            IntegrationTestLogger.LOGGER.info("Client should have thrown a JMSSecurityException but only threw JMSException");
-         } catch (JMSException e) {
-            e.printStackTrace();
-            Assert.fail("thrown a JMSEXception instead of a JMSSEcurityException");
-         }
+         sendAndReceiveText(connectionFactory, "clientId", message, s -> s.createTemporaryQueue(), (d, s) -> s.createConsumer(d));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to create a temporary queue");
+      } catch (JMSSecurityException jmsse) {
+      } catch (JMSException e) {
+         e.printStackTrace();
+         Assert.fail("thrown a JMSEXception instead of a JMSSEcurityException");
+      }
+   }
 
-         // Should not be fatal
-         assertNotNull(connection.createSession(false, Session.AUTO_ACKNOWLEDGE));
-      } finally {
-         connection.close();
+   @Test
+   public void testTemporaryTopic() throws Exception {
+      ConnectionFactory connectionFactory = getConnectionFactory("c", "c");
+      String message = "blah";
+
+      try {
+         sendAndReceiveText(connectionFactory, "clientId", message, s -> s.createTemporaryTopic(), (d, s) -> s.createConsumer(d));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to create a temporary queue");
+      } catch (JMSSecurityException jmsse) {
+      } catch (JMSException e) {
+         e.printStackTrace();
+         Assert.fail("thrown a JMSEXception instead of a JMSSEcurityException");
+      }
+   }
+
+   @Test
+   public void testSecureQueue() throws Exception {
+      // Core & OpenWire are not creating the queue as the test expects.. just querying
+      Assume.assumeTrue(protocol.equals("AMQP"));
+      ConnectionFactory connectionFactory = getConnectionFactory("b", "b");
+      String message = "blah";
+
+      //Expect to be able to create subscriber on pre-defined/existing queue.
+      String messageRecieved = sendAndReceiveTextUsingQueue(connectionFactory, "clientId", message, "secured_queue", (q, s) -> s.createConsumer(q));
+      Assert.assertEquals(message, messageRecieved);
+
+      try {
+         sendAndReceiveTextUsingQueue(connectionFactory, "clientId", message, "non-existent-queue", (q, s) -> s.createConsumer(q));
+         Assert.fail("Security exception expected, but did not occur, excepetion expected as not permissioned to dynamically create queue");
+      } catch (JMSSecurityException j) {
+         //Expected exception
       }
    }
 
 
    private ConnectionFactory getConnectionFactory(String user, String password) {
       switch (protocol) {
-         case "CORE": return getActiveMQConnectionFactory(user, password);
-         case "AMQP" : return getAMQPConnectionFactory(user, password);
-         case "OPENWIRE": return getOpenWireConnectionFactory(user, password);
-         default: throw new IllegalStateException("Unsupported Protocol");
+         case "CORE":
+            return getActiveMQConnectionFactory(user, password);
+         case "AMQP":
+            return getAMQPConnectionFactory(user, password);
+         case "OPENWIRE":
+            return getOpenWireConnectionFactory(user, password);
+         default:
+            throw new IllegalStateException("Unsupported Protocol");
       }
    }
 
@@ -216,24 +250,40 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
       return activeMQConnectionFactory;
    }
 
-   private String sendAndReceiveText(ConnectionFactory connectionFactory, String clientId, String message, String topicName, ConsumerSupplier consumerSupplier) throws JMSException {
+   private String sendAndReceiveTextUsingTopic(ConnectionFactory connectionFactory, String clientId, String message, String topicName, ConsumerSupplier<Topic> consumerSupplier) throws JMSException {
+      return sendAndReceiveText(connectionFactory, clientId, message, s -> s.createTopic(topicName), consumerSupplier);
+   }
+
+   private String sendAndReceiveTextUsingQueue(ConnectionFactory connectionFactory, String clientId, String message, String queueName, ConsumerSupplier<Queue> consumerSupplier) throws JMSException {
+      return sendAndReceiveText(connectionFactory, clientId, message, s -> s.createQueue(queueName), consumerSupplier);
+   }
+
+   private <D extends Destination> String sendAndReceiveText(ConnectionFactory connectionFactory, String clientId, String message, DestinationSupplier<D> destinationSupplier, ConsumerSupplier<D> consumerSupplier) throws JMSException {
       String messageRecieved;
-      try (Connection connection = connectionFactory.createConnection()) {
+      Connection connection = null;
+      try {
+         connection = connectionFactory.createConnection();
          if (clientId != null && !clientId.isEmpty()) {
             connection.setClientID(clientId);
          }
          connection.start();
          try (Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) {
-            Topic topic = session.createTopic(topicName);
-            MessageConsumer messageConsumer = consumerSupplier.create(topic, session);
+            D destination = destinationSupplier.create(session);
+            MessageConsumer messageConsumer = consumerSupplier.create(destination, session);
             messageConsumer.receive(1000);
 
             TextMessage messageToSend = session.createTextMessage(message);
-            session.createProducer(topic).send(messageToSend);
+            session.createProducer(destination).send(messageToSend);
 
             TextMessage received = (TextMessage) messageConsumer.receive(1000);
             messageRecieved = received != null ? received.getText() : null;
          }
+      } catch (JMSException | JMSRuntimeException e) {
+         // Exception Should not be fatal
+         assertNotNull(connection.createSession(false, Session.AUTO_ACKNOWLEDGE));
+         throw e;
+      } finally {
+         connection.close();
       }
       return messageRecieved;
    }
@@ -246,7 +296,6 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
       deploymentManager.addDeployable(fileConfiguration);
       deploymentManager.readConfiguration();
 
-
       SecurityConfiguration securityConfiguration = new SecurityConfiguration();
       securityConfiguration.addUser("a", "a");
       securityConfiguration.addRole("a", "a");
@@ -254,14 +303,20 @@ public class SecureConfigurationTest extends ActiveMQTestBase {
       securityConfiguration.addUser("b", "b");
       securityConfiguration.addRole("b", "b");
 
+      securityConfiguration.addUser("c", "c");
+      securityConfiguration.addRole("c", "c");
 
       ActiveMQJAASSecurityManager sm = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfiguration);
 
       return addServer(new ActiveMQServerImpl(fc, sm));
    }
 
-   private interface ConsumerSupplier {
-      MessageConsumer create(Topic topic, Session session) throws JMSException;
+   private interface ConsumerSupplier<D extends Destination> {
+      MessageConsumer create(D destination, Session session) throws JMSException;
+   }
+
+   private interface DestinationSupplier<D extends Destination> {
+      D create(Session session) throws JMSException;
    }
 
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0746ea8a/tests/integration-tests/src/test/resources/multicast_topic.xml
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/resources/multicast_topic.xml b/tests/integration-tests/src/test/resources/multicast_topic.xml
index 2535ad3..3f546e7 100644
--- a/tests/integration-tests/src/test/resources/multicast_topic.xml
+++ b/tests/integration-tests/src/test/resources/multicast_topic.xml
@@ -77,6 +77,12 @@ under the License.
                <queue name="clientId.secured_topic_durable/queue" />
             </multicast>
          </address>
+
+         <address name="secured_queue">
+            <anycast>
+               <queue name="secured_queue" />
+            </anycast>
+         </address>
       </addresses>
 
       <acceptors>
@@ -85,13 +91,13 @@ under the License.
 
       <security-settings>
          <security-setting match="#">
-            <permission type="createNonDurableQueue" roles="a"/>
-            <permission type="deleteNonDurableQueue" roles="a"/>
-            <permission type="createDurableQueue" roles="a"/>
-            <permission type="deleteDurableQueue" roles="a"/>
+            <permission type="createNonDurableQueue" roles="a,b"/>
+            <permission type="deleteNonDurableQueue" roles="a,b"/>
+            <permission type="createDurableQueue" roles="a,b"/>
+            <permission type="deleteDurableQueue" roles="a,b"/>
             <permission type="browse" roles="a"/>
-            <permission type="send" roles="a"/>
-            <permission type="consume" roles="a" />
+            <permission type="send" roles="a,b"/>
+            <permission type="consume" roles="a,b" />
             <!-- we need this otherwise ./artemis data imp wouldn't work -->
             <permission type="manage" roles="a"/>
          </security-setting>


[31/33] activemq-artemis git commit: ARTEMIS-1887 Setting default-max-consumers in address-setting not working

Posted by cl...@apache.org.
ARTEMIS-1887 Setting default-max-consumers in address-setting not working

When setting "default-max-consumers" in addressing setting in broker.xml
It has no effect on the "max-consumers" property on matching address queues.

Tests added as part of a previous commit

This closes #2107


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

Branch: refs/heads/2.6.x
Commit: fd3baf1ea29b55f9713bc302c313d02d76c30fab
Parents: 390a07e
Author: saurabhrai <ra...@hotmail.com>
Authored: Thu May 24 17:49:24 2018 +0530
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 14:36:23 2018 -0400

----------------------------------------------------------------------
 .../artemis/core/config/CoreQueueConfiguration.java   | 14 ++++++++++++++
 .../core/deployers/impl/FileConfigurationParser.java  |  4 +++-
 .../artemis/core/server/impl/ActiveMQServerImpl.java  |  7 +++++--
 3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd3baf1e/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java
index 236fac6..f301b90 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java
@@ -45,6 +45,8 @@ public class CoreQueueConfiguration implements Serializable {
 
    private RoutingType routingType = ActiveMQDefaultConfiguration.getDefaultRoutingType();
 
+   private boolean maxConsumerConfigured = false;
+
    public CoreQueueConfiguration() {
    }
 
@@ -76,6 +78,15 @@ public class CoreQueueConfiguration implements Serializable {
       return lastValue;
    }
 
+   public boolean isMaxConsumerConfigured() {
+      return maxConsumerConfigured;
+   }
+
+   public CoreQueueConfiguration setMaxConsumerConfigured(boolean maxConsumerConfigured) {
+      this.maxConsumerConfigured = maxConsumerConfigured;
+      return this;
+   }
+
    /**
     * @param address the address to set
     */
@@ -171,6 +182,7 @@ public class CoreQueueConfiguration implements Serializable {
       result = prime * result + ((purgeOnNoConsumers == null) ? 0 : purgeOnNoConsumers.hashCode());
       result = prime * result + ((exclusive == null) ? 0 : exclusive.hashCode());
       result = prime * result + ((lastValue == null) ? 0 : lastValue.hashCode());
+      result = prime * result + (maxConsumerConfigured ? 1331 : 1337);
       return result;
    }
 
@@ -190,6 +202,8 @@ public class CoreQueueConfiguration implements Serializable {
          return false;
       if (durable != other.durable)
          return false;
+      if (maxConsumerConfigured != other.maxConsumerConfigured)
+         return false;
       if (filterString == null) {
          if (other.filterString != null)
             return false;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd3baf1e/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
index 0444ba8..17f3b67 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
@@ -1093,6 +1093,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
       String address = null;
       String filterString = null;
       boolean durable = true;
+      boolean maxConumserConfigured = false;
       int maxConsumers = ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers();
       boolean purgeOnNoConsumers = ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers();
       String user = null;
@@ -1105,6 +1106,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
          if (item.getNodeName().equals("max-consumers")) {
             maxConsumers = Integer.parseInt(item.getNodeValue());
             Validators.MAX_QUEUE_CONSUMERS.validate(name, maxConsumers);
+            maxConumserConfigured = true;
          } else if (item.getNodeName().equals("purge-on-no-consumers")) {
             purgeOnNoConsumers = Boolean.parseBoolean(item.getNodeValue());
          } else if (item.getNodeName().equals("exclusive")) {
@@ -1130,7 +1132,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
       }
 
       return new CoreQueueConfiguration().setAddress(address).setName(name).setFilterString(filterString).setDurable(durable).setMaxConsumers(maxConsumers).setPurgeOnNoConsumers(purgeOnNoConsumers).setUser(user)
-                                         .setExclusive(exclusive).setLastValue(lastValue);
+                                         .setExclusive(exclusive).setLastValue(lastValue).setMaxConsumerConfigured(maxConumserConfigured);
    }
 
    protected CoreAddressConfiguration parseAddressConfiguration(final Node node) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd3baf1e/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 cb58a1a..ebe0401 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
@@ -2541,15 +2541,18 @@ public class ActiveMQServerImpl implements ActiveMQServer {
          ActiveMQServerLogger.LOGGER.deployQueue(config.getName(), config.getAddress());
          AddressSettings as = addressSettingsRepository.getMatch(config.getAddress());
          // determine if there is an address::queue match; update it if so
+         int maxConsumerAddressSetting = as.getDefaultMaxConsumers();
+         int maxConsumerQueueConfig = config.getMaxConsumers();
+         int maxConsumer = (config.isMaxConsumerConfigured()) ? maxConsumerQueueConfig : maxConsumerAddressSetting;
          if (locateQueue(queueName) != null && locateQueue(queueName).getAddress().toString().equals(config.getAddress())) {
-            updateQueue(config.getName(), config.getRoutingType(), config.getMaxConsumers(), config.getPurgeOnNoConsumers(),
+            updateQueue(config.getName(), config.getRoutingType(), maxConsumer, config.getPurgeOnNoConsumers(),
                         config.isExclusive() == null ? as.isDefaultExclusiveQueue() : config.isExclusive());
          } else {
             // if the address::queue doesn't exist then create it
             try {
                createQueue(SimpleString.toSimpleString(config.getAddress()), config.getRoutingType(),
                            queueName, SimpleString.toSimpleString(config.getFilterString()), SimpleString.toSimpleString(config.getUser()),
-                           config.isDurable(),false,false,false,false,config.getMaxConsumers(),config.getPurgeOnNoConsumers(),
+                           config.isDurable(),false,false,false,false,maxConsumer,config.getPurgeOnNoConsumers(),
                            config.isExclusive() == null ? as.isDefaultExclusiveQueue() : config.isExclusive(),
                            config.isLastValue() == null ? as.isDefaultLastValueQueue() : config.isLastValue(), true);
             } catch (ActiveMQQueueExistsException e) {


[20/33] activemq-artemis git commit: This closes #2103

Posted by cl...@apache.org.
This closes #2103


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

Branch: refs/heads/2.6.x
Commit: d6d685134a4030894eb7a28a8993ef436bc139f9
Parents: 88b2399 3a5971e
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed May 23 15:44:42 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 23 15:44:42 2018 -0400

----------------------------------------------------------------------
 .../amqp/broker/AMQPSessionCallback.java        |  2 +-
 .../proton/ProtonServerReceiverContext.java     |  3 +
 .../server/SecureConfigurationTest.java         | 83 +++++++++++---------
 .../src/test/resources/multicast_topic.xml      | 12 +--
 4 files changed, 55 insertions(+), 45 deletions(-)
----------------------------------------------------------------------



[33/33] activemq-artemis git commit: This closes #2108

Posted by cl...@apache.org.
This closes #2108


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

Branch: refs/heads/2.6.x
Commit: 5e5ae404174d61735cf5283b59da59460c36d629
Parents: fd3baf1 cd2f544
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu May 24 14:37:36 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 14:37:36 2018 -0400

----------------------------------------------------------------------
 .../integration/openwire/OpenWireTestBase.java  |  2 +-
 .../integration/security/SecurityTest.java      | 32 ++++++++++----------
 .../integration/server/ResourceLimitTest.java   |  2 +-
 .../integration/ssl/DualAuthenticationTest.java |  2 +-
 4 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------



[15/33] activemq-artemis git commit: ARTEMIS-1873 STOMP heartbeater left alive on cxn destroy

Posted by cl...@apache.org.
ARTEMIS-1873 STOMP heartbeater left alive on cxn destroy


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

Branch: refs/heads/2.6.x
Commit: 8d64f741a17846e814e9795ab101572e4acbb9a7
Parents: 4cd7b1c
Author: Justin Bertram <jb...@apache.org>
Authored: Tue May 22 15:43:09 2018 -0500
Committer: Justin Bertram <jb...@apache.org>
Committed: Tue May 22 17:07:31 2018 -0500

----------------------------------------------------------------------
 .../core/protocol/stomp/StompConnection.java    | 22 ++++---
 .../integration/stomp/v11/StompV11Test.java     | 61 ++++++++++++++++++++
 2 files changed, 71 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8d64f741/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
index fbd0107..171d7be 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
@@ -335,15 +335,11 @@ public final class StompConnection implements RemotingConnection {
          if (destroyed) {
             return;
          }
-      }
 
-      destroyed = true;
+         destroyed = true;
+      }
 
       internalClose();
-
-      synchronized (sendLock) {
-         callClosingListeners();
-      }
    }
 
    public Acceptor getAcceptorUsed() {
@@ -351,9 +347,17 @@ public final class StompConnection implements RemotingConnection {
    }
 
    private void internalClose() {
+      if (frameHandler != null) {
+         frameHandler.disconnect();
+      }
+
       transportConnection.close();
 
       manager.cleanup(this);
+
+      synchronized (sendLock) {
+         callClosingListeners();
+      }
    }
 
    @Override
@@ -372,15 +376,9 @@ public final class StompConnection implements RemotingConnection {
 
       ActiveMQServerLogger.LOGGER.connectionFailureDetected(me.getMessage(), me.getType());
 
-      if (frameHandler != null) {
-         frameHandler.disconnect();
-      }
-
       // Then call the listeners
       callFailureListeners(me);
 
-      callClosingListeners();
-
       internalClose();
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8d64f741/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java
index 99ad1fb..6a3fae6 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java
@@ -28,6 +28,7 @@ import java.nio.channels.ClosedChannelException;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -37,6 +38,7 @@ import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
 import org.apache.activemq.artemis.core.protocol.stomp.StompConnection;
 import org.apache.activemq.artemis.core.protocol.stomp.v11.StompFrameHandlerV11;
+import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.integration.stomp.StompTestBase;
 import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
@@ -2181,6 +2183,65 @@ public class StompV11Test extends StompTestBase {
       Assert.assertFalse(stompFrameHandler.getHeartBeater().isStarted());
    }
 
+   @Test
+   public void testHeartBeat4() throws Exception {
+      connection.close();
+      ClientStompFrame frame = conn.createFrame("CONNECT");
+      frame.addHeader("host", "127.0.0.1");
+      frame.addHeader("login", this.defUser);
+      frame.addHeader("passcode", this.defPass);
+      frame.addHeader("heart-beat", "500,500");
+      frame.addHeader("accept-version", "1.1,1.2");
+
+      ClientStompFrame reply = conn.sendFrame(frame);
+
+      System.out.println("Reply: " + reply.toString());
+
+      assertEquals("CONNECTED", reply.getCommand());
+
+      // Obtain a reference to the server StompConnection object
+      RemotingConnection remotingConnection = null;
+      StompConnection stompConnection = null;
+      Iterator<RemotingConnection> iterator = server.getActiveMQServer().getRemotingService().getConnections().iterator();
+      while (iterator.hasNext()) {
+         remotingConnection = iterator.next();
+         if (remotingConnection instanceof StompConnection) {
+            stompConnection = (StompConnection)remotingConnection;
+         }
+      }
+
+      StompFrameHandlerV11 stompFrameHandler = (StompFrameHandlerV11) stompConnection.getStompVersionHandler();
+
+      System.out.println("========== start pinger!");
+
+      conn.startPinger(100);
+
+      ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
+      subFrame.addHeader("destination", getTopicPrefix() + getTopicName());
+      subFrame.addHeader("id", "0");
+
+      ClientStompFrame f = conn.sendFrame(subFrame);
+      f = conn.sendFrame(subFrame);
+
+      // Send subscription with a duplicate ID, triggering a server error and closing of the session.
+      f = conn.sendFrame(subFrame);
+
+      f = conn.receiveFrame(1000);
+      System.out.println("Received " + f.toString());
+      Assert.assertTrue(f.getCommand().equals("ERROR"));
+
+      conn.stopPinger();
+
+      // give it some time to detect and close connections
+      Thread.sleep(2000);
+
+      Wait.waitFor(() -> {
+         return server.getActiveMQServer().getRemotingService().getConnections().size() == 0;
+      });
+
+      Assert.assertFalse("HeartBeater is still running!!", stompFrameHandler.getHeartBeater().isStarted());
+   }
+
 
    protected void assertSubscribeWithClientAckThenConsumeWithAutoAck(boolean sendDisconnect) throws Exception {
       conn.connect(defUser, defPass);


[18/33] activemq-artemis git commit: This closes #2093

Posted by cl...@apache.org.
This closes #2093


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

Branch: refs/heads/2.6.x
Commit: 88b23994c31c10245a38729909044f992b6a529f
Parents: 78016cb a9d9731
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed May 23 13:11:36 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 23 13:11:36 2018 -0400

----------------------------------------------------------------------
 .../core/protocol/core/impl/PacketImpl.java     |   2 +
 .../artemis/jms/client/ActiveMQSession.java     |  23 +-
 .../amqp/broker/AMQPSessionCallback.java        |  27 +-
 .../amqp/proton/ProtonServerSenderContext.java  |   6 +-
 .../protocol/openwire/OpenWireConnection.java   |   6 +-
 .../core/ServerSessionPacketHandler.java        |  11 +-
 .../server/SecureConfigurationTest.java         | 260 +++++++++++++++++++
 .../src/test/resources/multicast_topic.xml      | 146 +++++++++++
 8 files changed, 459 insertions(+), 22 deletions(-)
----------------------------------------------------------------------



[27/33] activemq-artemis git commit: NO-JIRA Fix compatibility tests

Posted by cl...@apache.org.
NO-JIRA Fix compatibility 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/cb7b5cba
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/cb7b5cba
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/cb7b5cba

Branch: refs/heads/2.6.x
Commit: cb7b5cba04d4fa458a44dd319c3684045cd04c98
Parents: 3602713
Author: Justin Bertram <jb...@apache.org>
Authored: Wed May 23 15:29:39 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 12:00:12 2018 -0400

----------------------------------------------------------------------
 .../src/main/resources/servers/artemisServer.groovy                | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cb7b5cba/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy
----------------------------------------------------------------------
diff --git a/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy b/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy
index 6661447..fbae168 100644
--- a/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy
+++ b/tests/compatibility-tests/src/main/resources/servers/artemisServer.groovy
@@ -44,7 +44,7 @@ try {
     if (!type.startsWith("ARTEMIS-1")) {
         configuration.addAddressesSetting("#", new AddressSettings().setAutoCreateAddresses(true));
         if (globalMaxSize != null) {
-            configuration.getAddressesSettings().get("#").setPageSizeBytes(globalMaxSize).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)
+            configuration.getAddressesSettings().get("#").setPageSizeBytes(Long.parseLong(globalMaxSize)).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)
             configuration.setGlobalMaxSize(Long.parseLong(globalMaxSize));
         }
     }


[25/33] activemq-artemis git commit: This closes #2105

Posted by cl...@apache.org.
This closes #2105


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

Branch: refs/heads/2.6.x
Commit: e6d2607494a1860321233d4257cd1ba804838151
Parents: 0746ea8 659d23c
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu May 24 09:16:42 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 09:16:42 2018 -0400

----------------------------------------------------------------------
 .../amqp/broker/AMQPSessionCallback.java        |  2 +-
 .../core/server/impl/ServerSessionImpl.java     |  8 ++++-
 .../server/SecureConfigurationTest.java         | 34 ++++++++++++++------
 .../src/test/resources/multicast_topic.xml      |  2 +-
 4 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[29/33] activemq-artemis git commit: ARTEMIS-1887 and ARTEMIS-1885 Adding tests on maxConsumer

Posted by cl...@apache.org.
ARTEMIS-1887 and ARTEMIS-1885 Adding tests on maxConsumer

This is a test for PRs #2106 and #2107


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

Branch: refs/heads/2.6.x
Commit: ca589f316bad37638742d64d34e40c7aef587cfc
Parents: c915ed1
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu May 24 12:47:42 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 14:36:22 2018 -0400

----------------------------------------------------------------------
 tests/smoke-tests/pom.xml                       |  20 +-
 .../resources/servers/maxConsumers/broker.xml   | 206 +++++++++++++++++++
 .../smoke/maxConsumers/MaxConsumersTest.java    |  66 ++++++
 3 files changed, 289 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca589f31/tests/smoke-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/smoke-tests/pom.xml b/tests/smoke-tests/pom.xml
index 41c7569..2c3e008 100644
--- a/tests/smoke-tests/pom.xml
+++ b/tests/smoke-tests/pom.xml
@@ -14,7 +14,8 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
       <groupId>org.apache.activemq.tests</groupId>
@@ -185,14 +186,27 @@
                      <goal>create</goal>
                   </goals>
                   <configuration>
-                     <!-- this makes it easier in certain envs -->
-                     <configuration>${basedir}/target/classes/servers/mqtt</configuration>
                      <allowAnonymous>true</allowAnonymous>
                      <user>admin</user>
                      <password>admin</password>
                      <instance>${basedir}/target/standard</instance>
                   </configuration>
                </execution>
+               <execution>
+                  <phase>test-compile</phase>
+                  <id>create-maxConsumers</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <!-- this makes it easier in certain envs -->
+                     <configuration>${basedir}/target/classes/servers/maxConsumers</configuration>
+                     <allowAnonymous>true</allowAnonymous>
+                     <user>admin</user>
+                     <password>admin</password>
+                     <instance>${basedir}/target/maxConsumers</instance>
+                  </configuration>
+               </execution>
 
             </executions>
             <dependencies>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca589f31/tests/smoke-tests/src/main/resources/servers/maxConsumers/broker.xml
----------------------------------------------------------------------
diff --git a/tests/smoke-tests/src/main/resources/servers/maxConsumers/broker.xml b/tests/smoke-tests/src/main/resources/servers/maxConsumers/broker.xml
new file mode 100644
index 0000000..ffb043a
--- /dev/null
+++ b/tests/smoke-tests/src/main/resources/servers/maxConsumers/broker.xml
@@ -0,0 +1,206 @@
+<?xml version='1.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.
+-->
+
+<configuration xmlns="urn:activemq"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
+
+   <core xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="urn:activemq:core ">
+
+      <name>0.0.0.0</name>
+
+      <persistence-enabled>true</persistence-enabled>
+
+      <!-- this could be ASYNCIO or NIO
+       -->
+      <journal-type>NIO</journal-type>
+
+      <paging-directory>./data/paging</paging-directory>
+
+      <bindings-directory>./data/bindings</bindings-directory>
+
+      <journal-directory>./data/journal</journal-directory>
+
+      <large-messages-directory>./data/large-messages</large-messages-directory>
+
+      <journal-datasync>true</journal-datasync>
+
+      <journal-min-files>2</journal-min-files>
+
+      <journal-pool-files>-1</journal-pool-files>
+
+      <message-expiry-scan-period>1000</message-expiry-scan-period>
+
+      <!--
+        You can verify the network health of a particular NIC by specifying the <network-check-NIC> element.
+ 	<network-check-NIC>theNicName</network-check-NIC>
+        -->
+
+      <!--
+        Use this to use an HTTP server to validate the network
+         <network-check-URL-list>http://www.apache.org</network-check-URL-list> -->
+
+      <!-- <network-check-period>10000</network-check-period> -->
+      <!-- <network-check-timeout>1000</network-check-timeout> -->
+
+      <!-- this is a comma separated list, no spaces, just DNS or IPs
+           it should accept IPV6
+
+           Warning: Make sure you understand your network topology as this is meant to validate if your network is valid.
+                    Using IPs that could eventually disappear or be partially visible may defeat the purpose.
+                    You can use a list of multiple IPs, and if any successful ping will make the server OK to continue running -->
+      <!-- <network-check-list>10.0.0.1</network-check-list> -->
+
+      <!-- use this to customize the ping used for ipv4 addresses -->
+      <!-- <network-check-ping-command>ping -c 1 -t %d %s</network-check-ping-command> -->
+
+      <!-- use this to customize the ping used for ipv6 addresses -->
+      <!-- <network-check-ping6-command>ping6 -c 1 %2$s</network-check-ping6-command> -->
+
+
+
+
+      <!-- how often we are looking for how many bytes are being used on the disk in ms -->
+      <disk-scan-period>5000</disk-scan-period>
+
+      <!-- once the disk hits this limit the system will block, or close the connection in certain protocols
+           that won't support flow control. -->
+      <max-disk-usage>90</max-disk-usage>
+
+      <!-- the system will enter into page mode once you hit this limit.
+           This is an estimate in bytes of how much the messages are using in memory
+
+            The system will use half of the available memory (-Xmx) by default for the global-max-size.
+            You may specify a different value here if you need to customize it to your needs.
+
+            <global-max-size>100Mb</global-max-size>
+
+      -->
+
+      <acceptors>
+
+         <!-- useEpoll means: it will use Netty epoll if you are on a system (Linux) that supports it -->
+         <!-- useKQueue means: it will use Netty kqueue if you are on a system (MacOS) that supports it -->
+         <!-- amqpCredits: The number of credits sent to AMQP producers -->
+         <!-- amqpLowCredits: The server will send the # credits specified at amqpCredits at this low mark -->
+
+         <!-- Acceptor for every supported protocol -->
+         <acceptor name="artemis">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;useKQueue;amqpCredits=1000;amqpLowCredits=300</acceptor>
+
+         <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
+         <acceptor name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;useKQueue=true;amqpCredits=1000;amqpLowCredits=300</acceptor>
+
+         <!-- STOMP Acceptor. -->
+         <acceptor name="stomp">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true;useKQueue=true</acceptor>
+
+         <!-- HornetQ Compatibility Acceptor.  Enables HornetQ Core and STOMP for legacy HornetQ clients. -->
+         <acceptor name="hornetq">tcp://0.0.0.0:5445?protocols=HORNETQ,STOMP;useEpoll=true;useKQueue=true</acceptor>
+
+         <!-- MQTT Acceptor -->
+         <acceptor name="mqtt">tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true;useKQueue=true</acceptor>
+
+      </acceptors>
+
+
+      <security-settings>
+         <security-setting match="#">
+            <permission type="createNonDurableQueue" roles="guest"/>
+            <permission type="deleteNonDurableQueue" roles="guest"/>
+            <permission type="createDurableQueue" roles="guest"/>
+            <permission type="deleteDurableQueue" roles="guest"/>
+            <permission type="createAddress" roles="guest"/>
+            <permission type="deleteAddress" roles="guest"/>
+            <permission type="consume" roles="guest"/>
+            <permission type="browse" roles="guest"/>
+            <permission type="send" roles="guest"/>
+            <!-- we need this otherwise ./artemis data imp wouldn't work -->
+            <permission type="manage" roles="guest"/>
+         </security-setting>
+      </security-settings>
+
+      <address-settings>
+         <!-- if you define auto-create on certain queues, management has to be auto-create -->
+         <address-setting match="activemq.management#">
+            <dead-letter-address>DLQ</dead-letter-address>
+            <expiry-address>ExpiryQueue</expiry-address>
+            <redelivery-delay>0</redelivery-delay>
+            <!-- with -1 only the global-max-size is in use for limiting -->
+            <max-size-bytes>-1</max-size-bytes>
+            <message-counter-history-day-limit>10</message-counter-history-day-limit>
+            <address-full-policy>PAGE</address-full-policy>
+            <auto-create-queues>true</auto-create-queues>
+            <auto-create-addresses>true</auto-create-addresses>
+            <auto-create-jms-queues>true</auto-create-jms-queues>
+            <auto-create-jms-topics>true</auto-create-jms-topics>
+         </address-setting>
+         <!--default for catch all-->
+         <address-setting match="#">
+            <dead-letter-address>DLQ</dead-letter-address>
+            <expiry-address>ExpiryQueue</expiry-address>
+            <redelivery-delay>0</redelivery-delay>
+            <!-- with -1 only the global-max-size is in use for limiting -->
+            <max-size-bytes>-1</max-size-bytes>
+            <message-counter-history-day-limit>10</message-counter-history-day-limit>
+            <address-full-policy>PAGE</address-full-policy>
+            <auto-create-queues>true</auto-create-queues>
+            <auto-create-addresses>true</auto-create-addresses>
+            <auto-create-jms-queues>true</auto-create-jms-queues>
+            <auto-create-jms-topics>true</auto-create-jms-topics>
+         </address-setting>
+         <address-setting match="myQueue">
+            <dead-letter-address>DLQ</dead-letter-address>
+            <expiry-address>ExpiryQueue</expiry-address>
+            <redelivery-delay>0</redelivery-delay>
+            <!-- with -1 only the global-max-size is in use for limiting -->
+            <max-size-bytes>-1</max-size-bytes>
+            <default-max-consumers>1</default-max-consumers>
+            <message-counter-history-day-limit>10</message-counter-history-day-limit>
+            <address-full-policy>PAGE</address-full-policy>
+            <auto-create-queues>true</auto-create-queues>
+            <auto-create-addresses>true</auto-create-addresses>
+            <auto-create-jms-queues>true</auto-create-jms-queues>
+            <auto-create-jms-topics>true</auto-create-jms-topics>
+         </address-setting>
+      </address-settings>
+
+      <addresses>
+         <address name="DLQ">
+            <anycast>
+               <queue name="DLQ" />
+            </anycast>
+         </address>
+         <address name="ExpiryQueue">
+            <anycast>
+               <queue name="ExpiryQueue" />
+            </anycast>
+         </address>
+         <address name="myQueue">
+            <anycast>
+               <!-- this should be maxed from the default -->
+               <queue name="myQueue">
+               </queue>
+            </anycast>
+         </address>
+
+      </addresses>
+
+   </core>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca589f31/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/maxConsumers/MaxConsumersTest.java
----------------------------------------------------------------------
diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/maxConsumers/MaxConsumersTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/maxConsumers/MaxConsumersTest.java
new file mode 100644
index 0000000..05a5f1f
--- /dev/null
+++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/maxConsumers/MaxConsumersTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.smoke.maxConsumers;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.Session;
+
+import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase;
+import org.apache.qpid.jms.JmsConnectionFactory;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class MaxConsumersTest extends SmokeTestBase {
+
+   public static final String SERVER_NAME_0 = "maxConsumers";
+
+   @Before
+   public void before() throws Exception {
+      cleanupData(SERVER_NAME_0);
+      disableCheckThread();
+      startServer(SERVER_NAME_0, 0, 30000);
+   }
+
+   @Test
+   public void testMax() throws Exception {
+      for (int i = 0; i < 5; i++) {
+         ConnectionFactory factory = new JmsConnectionFactory("amqp://localhost:61616");
+         Connection connection = factory.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Queue queue = session.createQueue("myQueue");
+
+         MessageConsumer consumer = session.createConsumer(queue);
+         try {
+            MessageConsumer consumer2 = session.createConsumer(queue);
+            Assert.fail("Exception was expected here");
+         } catch (JMSException expectedMax) {
+         }
+
+         consumer.close();
+         connection.close();
+      }
+
+   }
+
+}


[22/33] activemq-artemis git commit: This closes #2101

Posted by cl...@apache.org.
This closes #2101


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

Branch: refs/heads/2.6.x
Commit: e28a8a5635831693f55a4994b513bf20e4401f14
Parents: d6d6851 7c53855
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed May 23 15:47:49 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 23 15:47:49 2018 -0400

----------------------------------------------------------------------
 artemis-core-client/pom.xml                     |   5 +
 artemis-distribution/src/main/assembly/dep.xml  |   1 +
 artemis-jms-client-all/pom.xml                  |   4 -
 .../features/standard/netty-openssl/pom.xml     | 124 +++++++++++++++++++
 .../features/standard/netty-openssl/readme.md   |  17 +++
 .../artemis/jms/example/OpenSSLExample.java     |  85 +++++++++++++
 .../activemq/server0/activemq.example.keystore  | Bin 0 -> 707 bytes
 .../server0/activemq.example.truststore         | Bin 0 -> 572 bytes
 .../main/resources/activemq/server0/broker.xml  |  60 +++++++++
 .../src/main/resources/jndi.properties          |  20 +++
 pom.xml                                         |   7 ++
 tests/integration-tests/pom.xml                 |   6 -
 12 files changed, 319 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[05/33] activemq-artemis git commit: ARTEMIS-1868 Openwire doesn't add delivery count in client ack mode

Posted by cl...@apache.org.
ARTEMIS-1868 Openwire doesn't add delivery count in client ack mode

If a client ack mode consumer receives a message and closes without
acking it, the redelivery of the message won't set the redelivery
flag (JMSRedelivered) because it doesn't increment the delivery count
when message is cancelled back to queue.
(Perf improvement)


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

Branch: refs/heads/2.6.x
Commit: f24d97bfd11b44c4ac7e672a1ec089ea9db9422a
Parents: 47b31b5
Author: Francesco Nigro <ni...@gmail.com>
Authored: Wed May 16 11:33:24 2018 +0200
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 21 18:02:40 2018 -0400

----------------------------------------------------------------------
 .../protocol/openwire/OpenWireConnection.java   |  3 +-
 .../core/protocol/openwire/amq/AMQConsumer.java | 51 +++++++++++++++++++-
 .../core/protocol/openwire/amq/AMQSession.java  | 15 +-----
 3 files changed, 52 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f24d97bf/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index f666785..21b2d46 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -1294,7 +1294,8 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
                   referenceIterator.remove();
                   ref.incrementDeliveryCount();
                   consumer.backToDelivering(ref);
-                  session.addRolledback(ref.getMessageID());
+                  final AMQConsumer amqConsumer = (AMQConsumer) consumer.getProtocolData();
+                  amqConsumer.addRolledback(ref);
                }
             }
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f24d97bf/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
index 0b7eff5..7e9881b 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
@@ -17,8 +17,11 @@
 package org.apache.activemq.artemis.core.protocol.openwire.amq;
 
 import java.io.IOException;
+import java.util.Comparator;
 import java.util.List;
+import java.util.Set;
 import java.util.UUID;
+import java.util.concurrent.ConcurrentSkipListSet;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
@@ -68,6 +71,7 @@ public class AMQConsumer {
    //internal means we don't expose
    //it's address/queue to management service
    private boolean internalAddress = false;
+   private volatile Set<MessageReference> rolledbackMessageRefs;
 
    public AMQConsumer(AMQSession amqSession,
                       org.apache.activemq.command.ActiveMQDestination d,
@@ -85,6 +89,30 @@ public class AMQConsumer {
          messagePullHandler = new MessagePullHandler();
       }
       this.internalAddress = internalAddress;
+      this.rolledbackMessageRefs = null;
+   }
+
+   private Set<MessageReference> guardedInitializationOfRolledBackMessageRefs() {
+      synchronized (this) {
+         Set<MessageReference> rollbackedMessageRefs = this.rolledbackMessageRefs;
+         if (rollbackedMessageRefs == null) {
+            rollbackedMessageRefs = new ConcurrentSkipListSet<>(Comparator.comparingLong(MessageReference::getMessageID));
+            this.rolledbackMessageRefs = rollbackedMessageRefs;
+         }
+         return rollbackedMessageRefs;
+      }
+   }
+
+   private Set<MessageReference> getRolledbackMessageRefsOrCreate() {
+      Set<MessageReference> rolledbackMessageRefs = this.rolledbackMessageRefs;
+      if (rolledbackMessageRefs == null) {
+         rolledbackMessageRefs = guardedInitializationOfRolledBackMessageRefs();
+      }
+      return rolledbackMessageRefs;
+   }
+
+   private Set<MessageReference> getRolledbackMessageRefs() {
+      return this.rolledbackMessageRefs;
    }
 
    public void init(SlowConsumerDetectionListener slowConsumerDetectionListener, long nativeId) throws Exception {
@@ -353,7 +381,6 @@ public class AMQConsumer {
    }
 
    public boolean updateDeliveryCountAfterCancel(MessageReference ref) {
-      long seqId = ref.getMessageID();
       long lastDelSeqId = info.getLastDeliveredSequenceId();
 
       //in activemq5, closing a durable subscription won't close the consumer
@@ -373,7 +400,7 @@ public class AMQConsumer {
          // tx cases are handled by
          // org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection.CommandProcessor.processRollbackTransaction()
          ref.incrementDeliveryCount();
-      } else if (lastDelSeqId == RemoveInfo.LAST_DELIVERED_UNSET && !session.isRolledBack(seqId)) {
+      } else if (lastDelSeqId == RemoveInfo.LAST_DELIVERED_UNSET && !isRolledBack(ref)) {
          ref.incrementDeliveryCount();
       }
 
@@ -432,4 +459,24 @@ public class AMQConsumer {
          }
       }
    }
+
+   public boolean removeRolledback(MessageReference messageReference) {
+      final Set<MessageReference> rolledbackMessageRefs = getRolledbackMessageRefs();
+      if (rolledbackMessageRefs == null) {
+         return false;
+      }
+      return rolledbackMessageRefs.remove(messageReference);
+   }
+
+   public void addRolledback(MessageReference messageReference) {
+      getRolledbackMessageRefsOrCreate().add(messageReference);
+   }
+
+   private boolean isRolledBack(MessageReference messageReference) {
+      final Set<MessageReference> rollbackedMessageRefs = getRolledbackMessageRefs();
+      if (rollbackedMessageRefs == null) {
+         return false;
+      }
+      return rollbackedMessageRefs.contains(messageReference);
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f24d97bf/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
index 34e2c0f..0250f1c 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
@@ -20,7 +20,6 @@ import static org.apache.activemq.artemis.core.protocol.openwire.util.OpenWireUt
 
 import java.io.IOException;
 import java.util.List;
-import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -53,7 +52,6 @@ import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
 import org.apache.activemq.artemis.utils.CompositeAddress;
 import org.apache.activemq.artemis.utils.IDGenerator;
 import org.apache.activemq.artemis.utils.SimpleIDGenerator;
-import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ConnectionInfo;
 import org.apache.activemq.command.ConsumerInfo;
@@ -97,8 +95,6 @@ public class AMQSession implements SessionCallback {
 
    private final SimpleString clientId;
 
-   private final Set<Long> rollbackedIds = new ConcurrentHashSet<>();
-
    public AMQSession(ConnectionInfo connInfo,
                      SessionInfo sessInfo,
                      ActiveMQServer server,
@@ -313,8 +309,7 @@ public class AMQSession implements SessionCallback {
                           int deliveryCount) {
       AMQConsumer theConsumer = (AMQConsumer) consumer.getProtocolData();
       //clear up possible rolledback ids.
-      rollbackedIds.remove(message.getMessageID());
-      // TODO: use encoders and proper conversions here
+      theConsumer.removeRolledback(reference);
       return theConsumer.handleDeliver(reference, message.toCore(), deliveryCount);
    }
 
@@ -548,12 +543,4 @@ public class AMQSession implements SessionCallback {
    public boolean isInternal() {
       return sessInfo.getSessionId().getValue() == -1;
    }
-
-   public void addRolledback(long messageID) {
-      this.rollbackedIds.add(messageID);
-   }
-
-   public boolean isRolledBack(long mid) {
-      return rollbackedIds.remove(mid);
-   }
 }


[21/33] activemq-artemis git commit: ARTEMIS-1853 Adding Netty OpenSSL provider example

Posted by cl...@apache.org.
ARTEMIS-1853 Adding Netty OpenSSL provider example

Added an example to demonstrate how to configure and use openssl
Moved/Added netty-tcnative dependency to artemis-distribution
Changed artemis-jms-client-all pom to exclude io.netty from relocation
so that the native openssl can be loaded


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

Branch: refs/heads/2.6.x
Commit: 7c53855c11e15a856e4df7cb4cb494eb636ca203
Parents: d6d6851
Author: Howard Gao <ho...@gmail.com>
Authored: Wed May 23 22:34:01 2018 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 23 15:47:10 2018 -0400

----------------------------------------------------------------------
 artemis-core-client/pom.xml                     |   5 +
 artemis-distribution/src/main/assembly/dep.xml  |   1 +
 artemis-jms-client-all/pom.xml                  |   4 -
 .../features/standard/netty-openssl/pom.xml     | 124 +++++++++++++++++++
 .../features/standard/netty-openssl/readme.md   |  17 +++
 .../artemis/jms/example/OpenSSLExample.java     |  85 +++++++++++++
 .../activemq/server0/activemq.example.keystore  | Bin 0 -> 707 bytes
 .../server0/activemq.example.truststore         | Bin 0 -> 572 bytes
 .../main/resources/activemq/server0/broker.xml  |  60 +++++++++
 .../src/main/resources/jndi.properties          |  20 +++
 pom.xml                                         |   7 ++
 tests/integration-tests/pom.xml                 |   6 -
 12 files changed, 319 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/artemis-core-client/pom.xml
----------------------------------------------------------------------
diff --git a/artemis-core-client/pom.xml b/artemis-core-client/pom.xml
index 47b72e2..092b8c3 100644
--- a/artemis-core-client/pom.xml
+++ b/artemis-core-client/pom.xml
@@ -118,6 +118,11 @@
          <groupId>io.netty</groupId>
          <artifactId>netty-common</artifactId>
       </dependency>
+      <dependency>
+         <groupId>io.netty</groupId>
+         <artifactId>netty-tcnative-boringssl-static</artifactId>
+      </dependency>
+
    </dependencies>
 
    <profiles>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/artemis-distribution/src/main/assembly/dep.xml
----------------------------------------------------------------------
diff --git a/artemis-distribution/src/main/assembly/dep.xml b/artemis-distribution/src/main/assembly/dep.xml
index 0987425..2f6999a 100644
--- a/artemis-distribution/src/main/assembly/dep.xml
+++ b/artemis-distribution/src/main/assembly/dep.xml
@@ -81,6 +81,7 @@
             <include>org.jboss.logging:jboss-logging</include>
             <include>org.jboss.slf4j:slf4j-jboss-logmanager</include>
             <include>io.netty:netty-all</include>
+            <include>io.netty:netty-tcnative-boringssl-static</include>
             <include>org.apache.qpid:proton-j</include>
             <include>org.apache.activemq:activemq-client</include>
             <include>org.slf4j:slf4j-api</include>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/artemis-jms-client-all/pom.xml
----------------------------------------------------------------------
diff --git a/artemis-jms-client-all/pom.xml b/artemis-jms-client-all/pom.xml
index 653ed31..0c6fa45 100644
--- a/artemis-jms-client-all/pom.xml
+++ b/artemis-jms-client-all/pom.xml
@@ -117,10 +117,6 @@
                            <shadedPattern>org.apache.activemq.artemis.shaded.org.apache.commons</shadedPattern>
                         </relocation>
                         <relocation>
-                           <pattern>io.netty</pattern>
-                           <shadedPattern>org.apache.activemq.artemis.shaded.io.netty</shadedPattern>
-                        </relocation>
-                        <relocation>
                            <pattern>org.jboss</pattern>
                            <shadedPattern>org.apache.activemq.artemis.shaded.org.jboss</shadedPattern>
                         </relocation>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/examples/features/standard/netty-openssl/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/netty-openssl/pom.xml b/examples/features/standard/netty-openssl/pom.xml
new file mode 100644
index 0000000..5f61a20
--- /dev/null
+++ b/examples/features/standard/netty-openssl/pom.xml
@@ -0,0 +1,124 @@
+<?xml version='1.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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.apache.activemq.examples.broker</groupId>
+      <artifactId>jms-examples</artifactId>
+      <version>2.7.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>netty-openssl</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis JMS Netty OpenSSL Example</name>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-client-all</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <spawn>true</spawn>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.OpenSSLExample</clientClass>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <args>
+                        <param>stop</param>
+                     </args>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.broker</groupId>
+                  <artifactId>netty-openssl</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-clean-plugin</artifactId>
+         </plugin>
+      </plugins>
+   </build>
+   <profiles>
+      <profile>
+         <id>release</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>com.vladsch.flexmark</groupId>
+                  <artifactId>markdown-page-generator-plugin</artifactId>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/examples/features/standard/netty-openssl/readme.md
----------------------------------------------------------------------
diff --git a/examples/features/standard/netty-openssl/readme.md b/examples/features/standard/netty-openssl/readme.md
new file mode 100644
index 0000000..2ccb693
--- /dev/null
+++ b/examples/features/standard/netty-openssl/readme.md
@@ -0,0 +1,17 @@
+# JMS OpenSSL Example
+
+To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the broker manually.
+
+This example shows you how to configure Netty OpenSSL with ActiveMQ Artemis to send and receive message.
+
+Using SSL can make your messaging applications interact with ActiveMQ Artemis securely. An application can be secured transparently without extra coding effort.
+Beside using JDK's implementation, Artemis also supports using native OpenSSL provided by Netty.
+To secure your messaging application with Netty's OpenSSL, you need to configure connector and acceptor as follows:
+
+    <acceptor name="netty-ssl-acceptor">tcp://localhost:5500?sslEnabled=true;sslProvider=OPENSSL;keyStorePath=activemq.example.keystore;keyStorePassword=secureexample</acceptor>
+
+In the configuration, the `activemq.example.keystore` is the key store file holding the server's certificate. The `activemq.example.truststore` is the file holding the certificates which the client trusts (i.e. the server's certificate exported from activemq.example.keystore). They are generated via the following commands:
+
+* `keytool -genkey -keystore activemq.example.keystore -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg EC -sigalg SHA256withECDSA
+* `keytool -export -keystore activemq.example.keystore -file activemq-jks.cer -storepass secureexample
+* `keytool -import -keystore activemq.example.truststore -file activemq-jks.cer -storepass secureexample -keypass secureexample -noprompt

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/examples/features/standard/netty-openssl/src/main/java/org/apache/activemq/artemis/jms/example/OpenSSLExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/netty-openssl/src/main/java/org/apache/activemq/artemis/jms/example/OpenSSLExample.java b/examples/features/standard/netty-openssl/src/main/java/org/apache/activemq/artemis/jms/example/OpenSSLExample.java
new file mode 100644
index 0000000..0aaa1ba
--- /dev/null
+++ b/examples/features/standard/netty-openssl/src/main/java/org/apache/activemq/artemis/jms/example/OpenSSLExample.java
@@ -0,0 +1,85 @@
+/*
+ * 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.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * A simple JMS Queue example that uses netty's OpenSSL secure transport.
+ */
+public class OpenSSLExample {
+
+   public static void main(final String[] args) throws Exception {
+      Connection connection = null;
+      InitialContext initialContext = null;
+      try {
+         // Step 1. Create an initial context to perform the JNDI lookup.
+         initialContext = new InitialContext();
+
+         // Step 2. Perfom a lookup on the queue
+         Queue queue = (Queue) initialContext.lookup("queue/exampleQueue");
+
+         // Step 3. Perform a lookup on the Connection Factory
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
+
+         // Step 4.Create a JMS Connection
+         connection = cf.createConnection();
+
+         // Step 5. Create a JMS Session
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         // Step 6. Create a JMS Message Producer
+         MessageProducer producer = session.createProducer(queue);
+
+         // Step 7. Create a Text Message
+         TextMessage message = session.createTextMessage("This is a text message");
+
+         System.out.println("Sent message: " + message.getText());
+
+         // Step 8. Send the Message
+         producer.send(message);
+
+         // Step 9. Create a JMS Message Consumer
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+
+         // Step 10. Start the Connection
+         connection.start();
+
+         // Step 11. Receive the message
+         TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);
+
+         System.out.println("Received message: " + messageReceived.getText());
+
+         initialContext.close();
+      } finally {
+         // Step 12. Be sure to close our JMS resources!
+         if (initialContext != null) {
+            initialContext.close();
+         }
+         if (connection != null) {
+            connection.close();
+         }
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/activemq.example.keystore
----------------------------------------------------------------------
diff --git a/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/activemq.example.keystore b/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/activemq.example.keystore
new file mode 100644
index 0000000..0a26208
Binary files /dev/null and b/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/activemq.example.keystore differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/activemq.example.truststore
----------------------------------------------------------------------
diff --git a/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/activemq.example.truststore b/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/activemq.example.truststore
new file mode 100644
index 0000000..3ef44dc
Binary files /dev/null and b/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/activemq.example.truststore differ

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/broker.xml
new file mode 100644
index 0000000..87d0147
--- /dev/null
+++ b/examples/features/standard/netty-openssl/src/main/resources/activemq/server0/broker.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+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.
+-->
+<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
+   <core xmlns="urn:activemq:core">
+
+      <bindings-directory>./data/messaging/bindings</bindings-directory>
+
+      <journal-directory>./data/messaging/journal</journal-directory>
+
+      <large-messages-directory>./data/messaging/largemessages</large-messages-directory>
+
+      <paging-directory>./data/messaging/paging</paging-directory>
+
+      <!-- Acceptors -->
+      <acceptors>
+         <!-- keystores will be found automatically if they are on the classpath -->
+         <acceptor name="netty-ssl-acceptor">tcp://localhost:5500?sslEnabled=true;sslProvider=OPENSSL;keyStorePath=activemq.example.keystore;keyStorePassword=secureexample</acceptor>
+         <acceptor name="netty-tcp">tcp://localhost:61616</acceptor>
+      </acceptors>
+
+      <!-- Other config -->
+
+      <security-settings>
+         <!--security for example queue-->
+         <security-setting match="exampleQueue">
+            <permission roles="guest" type="createDurableQueue"/>
+            <permission roles="guest" type="deleteDurableQueue"/>
+            <permission roles="guest" type="createNonDurableQueue"/>
+            <permission roles="guest" type="deleteNonDurableQueue"/>
+            <permission roles="guest" type="consume"/>
+            <permission roles="guest" type="send"/>
+         </security-setting>
+      </security-settings>
+
+      <addresses>
+         <address name="exampleQueue">
+            <anycast>
+               <queue name="exampleQueue"/>
+            </anycast>
+         </address>
+      </addresses>
+   </core>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/examples/features/standard/netty-openssl/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/features/standard/netty-openssl/src/main/resources/jndi.properties b/examples/features/standard/netty-openssl/src/main/resources/jndi.properties
new file mode 100644
index 0000000..2358666
--- /dev/null
+++ b/examples/features/standard/netty-openssl/src/main/resources/jndi.properties
@@ -0,0 +1,20 @@
+# 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.
+
+java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
+connectionFactory.ConnectionFactory=tcp://localhost:5500?sslEnabled=true&sslProvider=OPENSSL&trustStorePath=activemq/server0/activemq.example.truststore&trustStorePassword=secureexample
+queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7249c2d..8c50610 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,6 +92,7 @@
       <maven.assembly.plugin.version>2.4</maven.assembly.plugin.version>
       <mockito.version>2.8.47</mockito.version>
       <netty.version>4.1.24.Final</netty.version>
+      <netty.tcnative.version>2.0.7.Final</netty.tcnative.version>
       <proton.version>0.27.1</proton.version>
       <resteasy.version>3.0.19.Final</resteasy.version>
       <slf4j.version>1.7.21</slf4j.version>
@@ -541,6 +542,12 @@
             <!-- License: Apache 2.0 -->
          </dependency>
          <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-tcnative-boringssl-static</artifactId>
+            <version>${netty.tcnative.version}</version>
+            <!-- License: Apache 2.0 -->
+         </dependency>
+         <dependency>
             <groupId>org.apache.qpid</groupId>
             <artifactId>proton-j</artifactId>
             <version>${proton.version}</version>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7c53855c/tests/integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml
index ad27864..d1c2b33 100644
--- a/tests/integration-tests/pom.xml
+++ b/tests/integration-tests/pom.xml
@@ -397,12 +397,6 @@
          <artifactId>jgroups</artifactId>
       </dependency>
 
-      <!-- openSSL test -->
-      <dependency>
-         <groupId>io.netty</groupId>
-         <artifactId>netty-tcnative-boringssl-static</artifactId>
-         <version>2.0.7.Final</version>
-      </dependency>
    </dependencies>
 
    <build>


[13/33] activemq-artemis git commit: ARTEMIS-1876 InVMNodeManager shouldn't be used if no JDBC HA is configured

Posted by cl...@apache.org.
ARTEMIS-1876 InVMNodeManager shouldn't be used if no JDBC HA is configured

When database persistence and no shared store option is being used,
Artemis is choosing to use InVMNodeManager, that is not providing
the same behaviour of FileLockNodeManager.


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

Branch: refs/heads/2.6.x
Commit: f886c0bdb451c947143fba6cf07cbf8ce7f3ff4d
Parents: 90273c9
Author: Francesco Nigro <ni...@gmail.com>
Authored: Tue May 22 09:35:48 2018 +0200
Committer: Francesco Nigro <ni...@gmail.com>
Committed: Tue May 22 09:35:48 2018 +0200

----------------------------------------------------------------------
 .../activemq/artemis/core/server/impl/ActiveMQServerImpl.java    | 4 ++--
 .../artemis/core/config/impl/HAPolicyConfigurationTest.java      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f886c0bd/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 cb31b00..cb58a1a 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
@@ -449,10 +449,10 @@ public class ActiveMQServerImpl implements ActiveMQServer {
             manager = JdbcNodeManager.with(dbConf, scheduledPool, executorFactory, shutdownOnCriticalIO);
          } else if (haType == null || haType == HAPolicyConfiguration.TYPE.LIVE_ONLY) {
             if (logger.isDebugEnabled()) {
-               logger.debug("Detected no Shared Store HA options on JDBC store: will use InVMNodeManager");
+               logger.debug("Detected no Shared Store HA options on JDBC store");
             }
             //LIVE_ONLY should be the default HA option when HA isn't configured
-            manager = new InVMNodeManager(replicatingBackup);
+            manager = new FileLockNodeManager(directory, replicatingBackup, configuration.getJournalLockAcquisitionTimeout());
          } else {
             throw new IllegalArgumentException("JDBC persistence allows only Shared Store HA options");
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f886c0bd/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java
index 4d9bf75..2a23613 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/HAPolicyConfigurationTest.java
@@ -33,7 +33,7 @@ import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy
 import org.apache.activemq.artemis.core.server.impl.Activation;
 import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.artemis.core.server.impl.ColocatedActivation;
-import org.apache.activemq.artemis.core.server.impl.InVMNodeManager;
+import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager;
 import org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation;
 import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation;
 import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation;
@@ -54,7 +54,7 @@ public class HAPolicyConfigurationTest extends ActiveMQTestBase {
       assertEquals(HAPolicyConfiguration.TYPE.LIVE_ONLY, server.getConfiguration().getHAPolicyConfiguration().getType());
       try {
          server.start();
-         assertThat(server.getNodeManager(), instanceOf(InVMNodeManager.class));
+         assertThat(server.getNodeManager(), instanceOf(FileLockNodeManager.class));
       } finally {
          server.stop();
       }


[16/33] activemq-artemis git commit: This closes #2098

Posted by cl...@apache.org.
This closes #2098


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

Branch: refs/heads/2.6.x
Commit: 78016cbe693043f638221990d504c254525782c0
Parents: 4cd7b1c 8d64f74
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue May 22 18:40:29 2018 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue May 22 18:40:29 2018 -0400

----------------------------------------------------------------------
 .../core/protocol/stomp/StompConnection.java    | 22 ++++---
 .../integration/stomp/v11/StompV11Test.java     | 61 ++++++++++++++++++++
 2 files changed, 71 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[32/33] activemq-artemis git commit: ARTEMIS-1872 fix security tests

Posted by cl...@apache.org.
ARTEMIS-1872 fix security tests

After the new authn change for creating addresses a bunch of tests need
to be updated to include the proper permissions.


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

Branch: refs/heads/2.6.x
Commit: cd2f544b7ec991c317929b7e4500621f77624347
Parents: fd3baf1
Author: Justin Bertram <jb...@apache.org>
Authored: Thu May 24 11:34:34 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu May 24 14:37:35 2018 -0400

----------------------------------------------------------------------
 .../integration/openwire/OpenWireTestBase.java  |  2 +-
 .../integration/security/SecurityTest.java      | 32 ++++++++++----------
 .../integration/server/ResourceLimitTest.java   |  2 +-
 .../integration/ssl/DualAuthenticationTest.java |  2 +-
 4 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cd2f544b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java
index 2a07aa9..831887f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java
@@ -94,7 +94,7 @@ public class OpenWireTestBase extends ActiveMQTestBase {
          securityManager.getConfiguration().addRole("openwireDestinationManager", "manager");
          securityManager.getConfiguration().addUser("openwireDestinationManager", "DeStInAtIoN");
 
-         Role destRole = new Role("manager", false, false, false, false, true, true, false, false, false, false);
+         Role destRole = new Role("manager", false, false, false, false, true, true, false, false, true, false);
 
          Set<Role> roles = new HashSet<>();
          roles.add(senderRole);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cd2f544b/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 21b4d08..3bc924a 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
@@ -1006,7 +1006,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, false, false, false, false, false, false, false);
+      Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -1050,7 +1050,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, true);
+      Role role = new Role("arole", false, false, true, true, false, false, false, false, true, true);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -1069,7 +1069,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, false, false, false, false, false, false, false);
+      Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -1096,7 +1096,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, false, false, false, false, false);
+      Role role = new Role("arole", false, false, false, false, true, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -1140,7 +1140,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, true);
+      Role role = new Role("arole", false, false, false, false, true, true, false, false, true, true);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -1159,7 +1159,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, false, false, false, false, false);
+      Role role = new Role("arole", false, false, false, false, true, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -1190,7 +1190,7 @@ public class SecurityTest extends ActiveMQTestBase {
 
       securityManager.getConfiguration().addUser("auser", "pass");
 
-      Role role = new Role("arole", true, true, true, false, false, false, false, false, false, false);
+      Role role = new Role("arole", true, true, true, false, false, false, false, false, true, false);
 
       Set<Role> roles = new HashSet<>();
 
@@ -1249,7 +1249,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, false, false, false, false, false, false, false);
+      Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -1277,7 +1277,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, false, false, false, false, false, false, false);
+      Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(SecurityTest.addressA, roles);
@@ -1304,7 +1304,7 @@ public class SecurityTest extends ActiveMQTestBase {
       securityManager.getConfiguration().addRole("guest", "guest");
       securityManager.getConfiguration().setDefaultUser("guest");
       Role role = new Role("arole", false, true, false, false, false, false, false, false, false, false);
-      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false);
+      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(sendRole);
       roles.add(role);
@@ -1332,7 +1332,7 @@ public class SecurityTest extends ActiveMQTestBase {
       securityManager.getConfiguration().addRole("guest", "guest");
       securityManager.getConfiguration().setDefaultUser("guest");
       Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
-      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false);
+      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(sendRole);
       roles.add(role);
@@ -1367,7 +1367,7 @@ public class SecurityTest extends ActiveMQTestBase {
       securityManager.getConfiguration().addRole("guest", "guest");
       securityManager.getConfiguration().setDefaultUser("guest");
       Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
-      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false);
+      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
       Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false);
       Set<Role> roles = new HashSet<>();
       roles.add(sendRole);
@@ -1416,7 +1416,7 @@ public class SecurityTest extends ActiveMQTestBase {
       securityManager.getConfiguration().addRole("guest", "guest");
       securityManager.getConfiguration().setDefaultUser("guest");
       Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
-      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false);
+      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
       Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false);
       Set<Role> roles = new HashSet<>();
       roles.add(sendRole);
@@ -1473,7 +1473,7 @@ public class SecurityTest extends ActiveMQTestBase {
       securityManager.getConfiguration().setDefaultUser("guest");
       Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
       System.out.println("guest:" + role);
-      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, false, false);
+      Role sendRole = new Role("guest", true, false, true, false, false, false, false, false, true, false);
       System.out.println("guest:" + sendRole);
       Role receiveRole = new Role("receiver", false, true, false, false, false, false, false, false, false, false);
       System.out.println("guest:" + receiveRole);
@@ -1577,7 +1577,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, false, false, false, false, false, false, false);
+      Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(configuration.getManagementAddress().toString(), roles);
@@ -1606,7 +1606,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, false, false, false, false, false, false, false);
+      Role role = new Role("arole", false, false, true, false, false, false, false, false, true, false);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       securityRepository.addMatch(configuration.getManagementAddress().toString(), roles);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cd2f544b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java
index 5294b1e..b178525 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java
@@ -60,7 +60,7 @@ public class ResourceLimitTest extends ActiveMQTestBase {
       ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
       securityManager.getConfiguration().addUser("myUser", "password");
       securityManager.getConfiguration().addRole("myUser", "arole");
-      Role role = new Role("arole", false, false, false, false, true, true, false, true, false, true);
+      Role role = new Role("arole", false, false, false, false, true, true, false, true, true, true);
       Set<Role> roles = new HashSet<>();
       roles.add(role);
       server.getSecurityRepository().addMatch("#", roles);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cd2f544b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java
index 6716e45..6e94504 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java
@@ -128,7 +128,7 @@ public class DualAuthenticationTest extends ActiveMQTestBase {
       server = addServer(ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager, false));
 
       HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
-      Role sendRole = new Role("producers", true, false, true, false, true, false, false, false, false, false);
+      Role sendRole = new Role("producers", true, false, true, false, true, false, false, false, true, false);
       Role receiveRole = new Role("consumers", false, true, false, false, false, false, false, false, false, false);
       Set<Role> roles = new HashSet<>();
       roles.add(sendRole);