activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [5/6] activemq-artemis git commit: ARTEMIS-1532 Enable tests which are unintentionally skipped by Surefire
Date Wed, 20 Dec 2017 21:06:37 GMT
ARTEMIS-1532 Enable tests which are unintentionally skipped by Surefire

These tests used to have a wrong name, so they weren't executed by
Surefire during a `mvn test` run.

After enablement, the following tests are now failing:

* org.apache.activemq.artemis.tests.integration.cluster.ha.HAAutomaticBackupSharedStoreTest
* org.apache.activemq.artemis.tests.integration.ra.OutgoingConnectionNoJTATest
* org.apache.activemq.artemis.tests.unit.core.server.group.impl.SystemPropertyOverrideTest.testSystemPropertyOverride


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

Branch: refs/heads/master
Commit: aa730fdaa72b0530a7e5d901c5bf7016b67a35e7
Parents: f7ea0d7
Author: Jiri Danek <jdanek@redhat.com>
Authored: Sun Dec 3 19:44:58 2017 +0100
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Dec 20 16:06:22 2017 -0500

----------------------------------------------------------------------
 .../config/ConfigUsingDestinationOptions.java   |  73 ---
 .../ConfigUsingDestinationOptionsTest.java      |  76 +++
 .../distribution/ClusteredGroupingTest.java     |   1 +
 .../failover/FailoverTestWithDivert.java        | 148 ------
 .../failover/FailoverWithDivertTest.java        | 148 ++++++
 .../ha/HAAutomaticBackupSharedStore.java        |  80 ----
 .../ha/HAAutomaticBackupSharedStoreTest.java    |  80 ++++
 .../ShutdownOnCriticalIOErrorMoveNext.java      | 141 ------
 .../ShutdownOnCriticalIOErrorMoveNextTest.java  | 141 ++++++
 .../crossprotocol/AMQPToJMSCore.java            | 111 -----
 .../crossprotocol/AMQPToJMSCoreTest.java        | 111 +++++
 .../CloseConnectionFactoryOnGCTest.java         |  64 +++
 .../CloseConnectionFactoryOnGCest.java          |  62 ---
 .../ra/OutgoingConnectionJTATest.java           | 256 ++++++++++
 .../ra/OutgoingConnectionNoJTATest.java         | 271 +++++++++++
 .../ra/OutgoingConnectionTestJTA.java           | 256 ----------
 .../ra/OutgoingConnectionTestNoJTA.java         | 271 -----------
 .../stomp/StompPropertiesInterceptorTest.java   | 108 +++++
 .../stomp/StompTestPropertiesInterceptor.java   | 108 -----
 .../stomp/StompTestWithInterceptors.java        | 166 -------
 .../stomp/StompTestWithLargeMessages.java       | 466 -------------------
 .../stomp/StompTestWithMessageID.java           |  80 ----
 .../stomp/StompTestWithSecurity.java            |  64 ---
 .../stomp/StompWithInterceptorsTest.java        | 166 +++++++
 .../stomp/StompWithLargeMessagesTest.java       | 466 +++++++++++++++++++
 .../stomp/StompWithMessageIDTest.java           |  80 ++++
 .../stomp/StompWithSecurityTest.java            |  64 +++
 .../group/impl/SystemPropertyOverrideTest.java  |   2 +
 28 files changed, 2034 insertions(+), 2026 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigUsingDestinationOptions.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigUsingDestinationOptions.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigUsingDestinationOptions.java
deleted file mode 100644
index 8637c53..0000000
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigUsingDestinationOptions.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.config;
-
-import javax.jms.Connection;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import javax.jms.Session;
-
-import junit.framework.TestCase;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.ActiveMQMessageConsumer;
-import org.apache.activemq.command.ActiveMQQueue;
-
-public class ConfigUsingDestinationOptions extends TestCase {
-
-   public void testValidSelectorConfig() throws JMSException {
-      ActiveMQQueue queue = new ActiveMQQueue("TEST.FOO?consumer.selector=test=1");
-
-      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost");
-      Connection conn = factory.createConnection();
-      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      ActiveMQMessageConsumer cons;
-      // JMS selector should be priority
-      cons = (ActiveMQMessageConsumer) sess.createConsumer(queue, "test=2");
-      assertEquals("test=2", cons.getMessageSelector());
-
-      // Test setting using JMS destinations
-      cons = (ActiveMQMessageConsumer) sess.createConsumer(queue);
-      assertEquals("test=1", cons.getMessageSelector());
-   }
-
-   public void testInvalidSelectorConfig() throws JMSException {
-      ActiveMQQueue queue = new ActiveMQQueue("TEST.FOO?consumer.selector=test||1");
-
-      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost");
-      Connection conn = factory.createConnection();
-      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      ActiveMQMessageConsumer cons;
-      // JMS selector should be priority
-      try {
-         cons = (ActiveMQMessageConsumer) sess.createConsumer(queue, "test||1");
-         fail("Selector should be invalid" + cons);
-      } catch (InvalidSelectorException e) {
-
-      }
-
-      // Test setting using JMS destinations
-      try {
-         cons = (ActiveMQMessageConsumer) sess.createConsumer(queue);
-         fail("Selector should be invalid" + cons);
-      } catch (InvalidSelectorException e) {
-
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigUsingDestinationOptionsTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigUsingDestinationOptionsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigUsingDestinationOptionsTest.java
new file mode 100644
index 0000000..c92685a
--- /dev/null
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/ConfigUsingDestinationOptionsTest.java
@@ -0,0 +1,76 @@
+/**
+ * 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.config;
+
+import javax.jms.Connection;
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
+import javax.jms.Session;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQMessageConsumer;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.junit.Test;
+
+public class ConfigUsingDestinationOptionsTest extends TestCase {
+
+   @Test(timeout = 60000)
+   public void testValidSelectorConfig() throws JMSException {
+      ActiveMQQueue queue = new ActiveMQQueue("TEST.FOO?consumer.selector=test=1");
+
+      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost");
+      Connection conn = factory.createConnection();
+      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      ActiveMQMessageConsumer cons;
+      // JMS selector should be priority
+      cons = (ActiveMQMessageConsumer) sess.createConsumer(queue, "test=2");
+      assertEquals("test=2", cons.getMessageSelector());
+
+      // Test setting using JMS destinations
+      cons = (ActiveMQMessageConsumer) sess.createConsumer(queue);
+      assertEquals("test=1", cons.getMessageSelector());
+   }
+
+   @Test(timeout = 60000)
+   public void testInvalidSelectorConfig() throws JMSException {
+      ActiveMQQueue queue = new ActiveMQQueue("TEST.FOO?consumer.selector=test||1");
+
+      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost");
+      Connection conn = factory.createConnection();
+      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      ActiveMQMessageConsumer cons;
+      // JMS selector should be priority
+      try {
+         cons = (ActiveMQMessageConsumer) sess.createConsumer(queue, "test||1");
+         fail("Selector should be invalid" + cons);
+      } catch (InvalidSelectorException e) {
+
+      }
+
+      // Test setting using JMS destinations
+      try {
+         cons = (ActiveMQMessageConsumer) sess.createConsumer(queue);
+         fail("Selector should be invalid" + cons);
+      } catch (InvalidSelectorException e) {
+
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
index 7bc6312..1c59990 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
@@ -1579,6 +1579,7 @@ public class ClusteredGroupingTest extends ClusterTestBase {
 
    }
 
+   @Test
    public void testGroupingMultipleSending() throws Exception {
       setupServer(0, isFileStorage(), isNetty());
       setupServer(1, isFileStorage(), isNetty());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestWithDivert.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestWithDivert.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestWithDivert.java
deleted file mode 100644
index 76efc22..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestWithDivert.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.tests.integration.cluster.failover;
-
-import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
-import org.apache.activemq.artemis.api.core.RoutingType;
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-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.ServerLocator;
-import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
-import org.apache.activemq.artemis.core.config.Configuration;
-import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
-import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
-import org.apache.activemq.artemis.core.config.DivertConfiguration;
-import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class FailoverTestWithDivert extends FailoverTestBase {
-
-   private static final String DIVERT_ADDRESS = "jms.queue.testQueue";
-   private static final String DIVERT_FORWARD_ADDRESS = "jms.queue.divertedQueue";
-   private ClientSessionFactoryInternal sf;
-
-   @Before
-   @Override
-   public void setUp() throws Exception {
-      super.setUp();
-   }
-
-   @Override
-   protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live) {
-      return getNettyAcceptorTransportConfiguration(live);
-   }
-
-   @Override
-   protected TransportConfiguration getConnectorTransportConfiguration(final boolean live) {
-      return getNettyConnectorTransportConfiguration(live);
-   }
-
-   @Override
-   protected void createConfigs() throws Exception {
-      createReplicatedConfigs();
-
-      liveConfig.setJournalFileSize(10240000);
-      backupConfig.setJournalFileSize(10240000);
-      addQueue(liveConfig, DIVERT_ADDRESS, DIVERT_ADDRESS);
-      addQueue(liveConfig, DIVERT_FORWARD_ADDRESS, DIVERT_FORWARD_ADDRESS);
-      addDivert(liveConfig, DIVERT_ADDRESS, DIVERT_FORWARD_ADDRESS, false);
-      addDivert(backupConfig, DIVERT_ADDRESS, DIVERT_FORWARD_ADDRESS, false);
-   }
-
-   private void addQueue(Configuration serverConfig, String address, String name) {
-
-      List<CoreAddressConfiguration> addrConfigs = serverConfig.getAddressConfigurations();
-      CoreAddressConfiguration addrCfg = new CoreAddressConfiguration();
-      addrCfg.setName(address);
-      addrCfg.addRoutingType(RoutingType.ANYCAST);
-      CoreQueueConfiguration qConfig = new CoreQueueConfiguration();
-      qConfig.setName(name);
-      qConfig.setAddress(address);
-      addrCfg.addQueueConfiguration(qConfig);
-      addrConfigs.add(addrCfg);
-   }
-
-   private void addDivert(Configuration serverConfig, String source, String target, boolean exclusive) {
-      List<DivertConfiguration> divertConfigs = serverConfig.getDivertConfigurations();
-      DivertConfiguration newDivert = new DivertConfiguration();
-      newDivert.setName("myDivert");
-      newDivert.setAddress(source);
-      newDivert.setForwardingAddress(target);
-      newDivert.setExclusive(exclusive);
-      divertConfigs.add(newDivert);
-   }
-
-   @Test
-   public void testUniqueIDsWithDivert() throws Exception {
-      Map<String, Object> params = new HashMap<>();
-      params.put(TransportConstants.HOST_PROP_NAME, "localhost");
-      TransportConfiguration tc = createTransportConfiguration(true, false, params);
-      ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithHA(tc)).setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true).setReconnectAttempts(-1);
-      sf = createSessionFactoryAndWaitForTopology(locator, 2);
-      int minLarge = locator.getMinLargeMessageSize();
-
-      ClientSession session = sf.createSession(false, false);
-      addClientSession(session);
-      session.start();
-
-      final int num = 100;
-      ClientProducer producer = session.createProducer(DIVERT_ADDRESS);
-      for (int i = 0; i < num; i++) {
-         ClientMessage message = createLargeMessage(session, 2 * minLarge);
-         producer.send(message);
-      }
-      session.commit();
-
-      ClientConsumer consumer = session.createConsumer(DIVERT_ADDRESS);
-      for (int i = 0;  i < num; i++) {
-         ClientMessage receivedFromSourceQueue = consumer.receive(5000);
-         assertNotNull(receivedFromSourceQueue);
-         receivedFromSourceQueue.acknowledge();
-      }
-      session.commit();
-
-      crash(session);
-
-      ClientConsumer consumer1 = session.createConsumer(DIVERT_FORWARD_ADDRESS);
-      for (int i = 0; i < num; i++) {
-         ClientMessage receivedFromTargetQueue = consumer1.receive(5000);
-         assertNotNull(receivedFromTargetQueue);
-         receivedFromTargetQueue.acknowledge();
-      }
-      session.commit();
-   }
-
-   private ClientMessage createLargeMessage(ClientSession session, final int largeSize) {
-      ClientMessage message = session.createMessage(true);
-      ActiveMQBuffer bodyBuffer = message.getBodyBuffer();
-      final int propSize = 10240;
-      while (bodyBuffer.writerIndex() < largeSize) {
-         byte[] prop = new byte[propSize];
-         bodyBuffer.writeBytes(prop);
-      }
-      return message;
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverWithDivertTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverWithDivertTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverWithDivertTest.java
new file mode 100644
index 0000000..943bb9d
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverWithDivertTest.java
@@ -0,0 +1,148 @@
+/*
+ * 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.cluster.failover;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.RoutingType;
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+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.ServerLocator;
+import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
+import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
+import org.apache.activemq.artemis.core.config.DivertConfiguration;
+import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class FailoverWithDivertTest extends FailoverTestBase {
+
+   private static final String DIVERT_ADDRESS = "jms.queue.testQueue";
+   private static final String DIVERT_FORWARD_ADDRESS = "jms.queue.divertedQueue";
+   private ClientSessionFactoryInternal sf;
+
+   @Before
+   @Override
+   public void setUp() throws Exception {
+      super.setUp();
+   }
+
+   @Override
+   protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live) {
+      return getNettyAcceptorTransportConfiguration(live);
+   }
+
+   @Override
+   protected TransportConfiguration getConnectorTransportConfiguration(final boolean live) {
+      return getNettyConnectorTransportConfiguration(live);
+   }
+
+   @Override
+   protected void createConfigs() throws Exception {
+      createReplicatedConfigs();
+
+      liveConfig.setJournalFileSize(10240000);
+      backupConfig.setJournalFileSize(10240000);
+      addQueue(liveConfig, DIVERT_ADDRESS, DIVERT_ADDRESS);
+      addQueue(liveConfig, DIVERT_FORWARD_ADDRESS, DIVERT_FORWARD_ADDRESS);
+      addDivert(liveConfig, DIVERT_ADDRESS, DIVERT_FORWARD_ADDRESS, false);
+      addDivert(backupConfig, DIVERT_ADDRESS, DIVERT_FORWARD_ADDRESS, false);
+   }
+
+   private void addQueue(Configuration serverConfig, String address, String name) {
+
+      List<CoreAddressConfiguration> addrConfigs = serverConfig.getAddressConfigurations();
+      CoreAddressConfiguration addrCfg = new CoreAddressConfiguration();
+      addrCfg.setName(address);
+      addrCfg.addRoutingType(RoutingType.ANYCAST);
+      CoreQueueConfiguration qConfig = new CoreQueueConfiguration();
+      qConfig.setName(name);
+      qConfig.setAddress(address);
+      addrCfg.addQueueConfiguration(qConfig);
+      addrConfigs.add(addrCfg);
+   }
+
+   private void addDivert(Configuration serverConfig, String source, String target, boolean exclusive) {
+      List<DivertConfiguration> divertConfigs = serverConfig.getDivertConfigurations();
+      DivertConfiguration newDivert = new DivertConfiguration();
+      newDivert.setName("myDivert");
+      newDivert.setAddress(source);
+      newDivert.setForwardingAddress(target);
+      newDivert.setExclusive(exclusive);
+      divertConfigs.add(newDivert);
+   }
+
+   @Test
+   public void testUniqueIDsWithDivert() throws Exception {
+      Map<String, Object> params = new HashMap<>();
+      params.put(TransportConstants.HOST_PROP_NAME, "localhost");
+      TransportConfiguration tc = createTransportConfiguration(true, false, params);
+      ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithHA(tc)).setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true).setReconnectAttempts(-1);
+      sf = createSessionFactoryAndWaitForTopology(locator, 2);
+      int minLarge = locator.getMinLargeMessageSize();
+
+      ClientSession session = sf.createSession(false, false);
+      addClientSession(session);
+      session.start();
+
+      final int num = 100;
+      ClientProducer producer = session.createProducer(DIVERT_ADDRESS);
+      for (int i = 0; i < num; i++) {
+         ClientMessage message = createLargeMessage(session, 2 * minLarge);
+         producer.send(message);
+      }
+      session.commit();
+
+      ClientConsumer consumer = session.createConsumer(DIVERT_ADDRESS);
+      for (int i = 0;  i < num; i++) {
+         ClientMessage receivedFromSourceQueue = consumer.receive(5000);
+         assertNotNull(receivedFromSourceQueue);
+         receivedFromSourceQueue.acknowledge();
+      }
+      session.commit();
+
+      crash(session);
+
+      ClientConsumer consumer1 = session.createConsumer(DIVERT_FORWARD_ADDRESS);
+      for (int i = 0; i < num; i++) {
+         ClientMessage receivedFromTargetQueue = consumer1.receive(5000);
+         assertNotNull(receivedFromTargetQueue);
+         receivedFromTargetQueue.acknowledge();
+      }
+      session.commit();
+   }
+
+   private ClientMessage createLargeMessage(ClientSession session, final int largeSize) {
+      ClientMessage message = session.createMessage(true);
+      ActiveMQBuffer bodyBuffer = message.getBodyBuffer();
+      final int propSize = 10240;
+      while (bodyBuffer.writerIndex() < largeSize) {
+         byte[] prop = new byte[propSize];
+         bodyBuffer.writeBytes(prop);
+      }
+      return message;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStore.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStore.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStore.java
deleted file mode 100644
index 8e82c2d..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStore.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.tests.integration.cluster.ha;
-
-import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
-import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration;
-import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
-import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
-import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
-import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
-import org.junit.Before;
-import org.junit.Test;
-
-public class HAAutomaticBackupSharedStore extends ClusterTestBase {
-
-   @Before
-   public void setup() throws Exception {
-      super.setUp();
-
-      setupServers();
-
-      setUpHAPolicy(0);
-      setUpHAPolicy(1);
-      setUpHAPolicy(2);
-
-      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
-
-      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
-
-      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
-   }
-
-   @Test
-   public void basicDiscovery() throws Exception {
-      startServers(0, 1, 2, 3, 4, 5);
-
-      createQueue(3, "queues.testaddress", "queue0", null, false);
-      createQueue(4, "queues.testaddress", "queue0", null, false);
-      createQueue(5, "queues.testaddress", "queue0", null, false);
-
-   }
-
-   protected void setupServers() throws Exception {
-      // The lives
-      setupLiveServer(0, isFileStorage(), true, isNetty(), false);
-      setupLiveServer(1, isFileStorage(), true, isNetty(), false);
-      setupLiveServer(2, isFileStorage(), true, isNetty(), false);
-
-   }
-
-   private void setUpHAPolicy(int node) {
-      ActiveMQServer server = getServer(node);
-      ColocatedPolicyConfiguration haPolicyConfiguration = new ColocatedPolicyConfiguration();
-      HAPolicyConfiguration liveConfiguration = new SharedStoreMasterPolicyConfiguration();
-      haPolicyConfiguration.setLiveConfig(liveConfiguration);
-
-      HAPolicyConfiguration backupConfiguration = new SharedStoreSlavePolicyConfiguration();
-      haPolicyConfiguration.setBackupConfig(backupConfiguration);
-      server.getConfiguration().setHAPolicyConfiguration(haPolicyConfiguration);
-   }
-
-   public boolean isNetty() {
-      return true;
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStoreTest.java
new file mode 100644
index 0000000..f52ef75
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStoreTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.cluster.ha;
+
+import org.apache.activemq.artemis.core.config.HAPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
+import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
+import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
+import org.junit.Before;
+import org.junit.Test;
+
+public class HAAutomaticBackupSharedStoreTest extends ClusterTestBase {
+
+   @Before
+   public void setup() throws Exception {
+      super.setUp();
+
+      setupServers();
+
+      setUpHAPolicy(0);
+      setUpHAPolicy(1);
+      setUpHAPolicy(2);
+
+      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
+
+      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
+
+      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
+   }
+
+   @Test
+   public void basicDiscovery() throws Exception {
+      startServers(0, 1, 2, 3, 4, 5);
+
+      createQueue(3, "queues.testaddress", "queue0", null, false);
+      createQueue(4, "queues.testaddress", "queue0", null, false);
+      createQueue(5, "queues.testaddress", "queue0", null, false);
+
+   }
+
+   protected void setupServers() throws Exception {
+      // The lives
+      setupLiveServer(0, isFileStorage(), true, isNetty(), false);
+      setupLiveServer(1, isFileStorage(), true, isNetty(), false);
+      setupLiveServer(2, isFileStorage(), true, isNetty(), false);
+
+   }
+
+   private void setUpHAPolicy(int node) {
+      ActiveMQServer server = getServer(node);
+      ColocatedPolicyConfiguration haPolicyConfiguration = new ColocatedPolicyConfiguration();
+      HAPolicyConfiguration liveConfiguration = new SharedStoreMasterPolicyConfiguration();
+      haPolicyConfiguration.setLiveConfig(liveConfiguration);
+
+      HAPolicyConfiguration backupConfiguration = new SharedStoreSlavePolicyConfiguration();
+      haPolicyConfiguration.setBackupConfig(backupConfiguration);
+      server.getConfiguration().setHAPolicyConfiguration(haPolicyConfiguration);
+   }
+
+   public boolean isNetty() {
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNext.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNext.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNext.java
deleted file mode 100644
index eb42856..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNext.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.activemq.artemis.tests.integration.critical;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import java.io.File;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.activemq.artemis.api.core.Message;
-import org.apache.activemq.artemis.core.config.Configuration;
-import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
-import org.apache.activemq.artemis.core.io.IOCriticalErrorListener;
-import org.apache.activemq.artemis.core.journal.Journal;
-import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
-import org.apache.activemq.artemis.core.persistence.StorageManager;
-import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
-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.spi.core.security.ActiveMQJAASSecurityManager;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
-import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
-import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.artemis.tests.util.Wait;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class ShutdownOnCriticalIOErrorMoveNext extends ActiveMQTestBase {
-
-   @Test
-   public void testSimplyDownAfterError() throws Exception {
-      deleteDirectory(new File("./target/server"));
-      ActiveMQServer server = createServer("./target/server");
-
-      try {
-         server.start();
-
-         ConnectionFactory factory = new ActiveMQConnectionFactory();
-         Connection connection = factory.createConnection();
-
-         Session session = connection.createSession();
-
-         MessageProducer producer = session.createProducer(session.createQueue("queue"));
-
-         try {
-            for (int i = 0; i < 500; i++) {
-               producer.send(session.createTextMessage("text"));
-            }
-         } catch (JMSException expected) {
-         }
-
-         Wait.waitFor(() -> !server.isStarted());
-
-         Assert.assertFalse(server.isStarted());
-
-         System.out.println("Sent messages");
-
-      } finally {
-         server.stop();
-
-      }
-
-   }
-
-   ActiveMQServer createServer(String folder) throws Exception {
-      final AtomicBoolean blocked = new AtomicBoolean(false);
-      Configuration conf = createConfig(folder);
-      ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
-
-      conf.setPersistenceEnabled(true);
-
-      ActiveMQServer server = new ActiveMQServerImpl(conf, securityManager) {
-
-         @Override
-         protected StorageManager createStorageManager() {
-
-            JournalStorageManager storageManager = new JournalStorageManager(conf, getCriticalAnalyzer(), executorFactory, scheduledPool, ioExecutorFactory, shutdownOnCriticalIO) {
-
-               @Override
-               protected Journal createMessageJournal(Configuration config,
-                                                      IOCriticalErrorListener criticalErrorListener,
-                                                      int fileSize) {
-                  return new JournalImpl(ioExecutors, fileSize, config.getJournalMinFiles(), config.getJournalPoolFiles(), config.getJournalCompactMinFiles(), config.getJournalCompactPercentage(), config.getJournalFileOpenTimeout(), journalFF, "activemq-data", "amq", journalFF.getMaxIO(), 0, criticalErrorListener) {
-                     @Override
-                     protected void moveNextFile(boolean scheduleReclaim) throws Exception {
-                        super.moveNextFile(scheduleReclaim);
-                        if (blocked.get()) {
-                           throw new IllegalStateException("forcibly down");
-                        }
-                     }
-                  };
-               }
-
-               @Override
-               public void storeMessage(Message message) throws Exception {
-                  super.storeMessage(message);
-                  blocked.set(true);
-               }
-            };
-
-            this.getCriticalAnalyzer().add(storageManager);
-
-            return storageManager;
-         }
-
-      };
-
-      return server;
-   }
-
-   Configuration createConfig(String folder) throws Exception {
-
-      Configuration configuration = createDefaultConfig(true);
-      configuration.setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory(folder + "/journal").setBindingsDirectory(folder + "/bindings").setPagingDirectory(folder + "/paging").
-         setLargeMessagesDirectory(folder + "/largemessage").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false);
-      configuration.setSecurityEnabled(false);
-      configuration.setPersistenceEnabled(true);
-
-      return configuration;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNextTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNextTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNextTest.java
new file mode 100644
index 0000000..ebf7c0a
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/critical/ShutdownOnCriticalIOErrorMoveNextTest.java
@@ -0,0 +1,141 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.integration.critical;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import java.io.File;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.core.io.IOCriticalErrorListener;
+import org.apache.activemq.artemis.core.journal.Journal;
+import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
+import org.apache.activemq.artemis.core.persistence.StorageManager;
+import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager;
+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.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
+import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.tests.util.Wait;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ShutdownOnCriticalIOErrorMoveNextTest extends ActiveMQTestBase {
+
+   @Test
+   public void testSimplyDownAfterError() throws Exception {
+      deleteDirectory(new File("./target/server"));
+      ActiveMQServer server = createServer("./target/server");
+
+      try {
+         server.start();
+
+         ConnectionFactory factory = new ActiveMQConnectionFactory();
+         Connection connection = factory.createConnection();
+
+         Session session = connection.createSession();
+
+         MessageProducer producer = session.createProducer(session.createQueue("queue"));
+
+         try {
+            for (int i = 0; i < 500; i++) {
+               producer.send(session.createTextMessage("text"));
+            }
+         } catch (JMSException expected) {
+         }
+
+         Wait.waitFor(() -> !server.isStarted());
+
+         Assert.assertFalse(server.isStarted());
+
+         System.out.println("Sent messages");
+
+      } finally {
+         server.stop();
+
+      }
+
+   }
+
+   ActiveMQServer createServer(String folder) throws Exception {
+      final AtomicBoolean blocked = new AtomicBoolean(false);
+      Configuration conf = createConfig(folder);
+      ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
+
+      conf.setPersistenceEnabled(true);
+
+      ActiveMQServer server = new ActiveMQServerImpl(conf, securityManager) {
+
+         @Override
+         protected StorageManager createStorageManager() {
+
+            JournalStorageManager storageManager = new JournalStorageManager(conf, getCriticalAnalyzer(), executorFactory, scheduledPool, ioExecutorFactory, shutdownOnCriticalIO) {
+
+               @Override
+               protected Journal createMessageJournal(Configuration config,
+                                                      IOCriticalErrorListener criticalErrorListener,
+                                                      int fileSize) {
+                  return new JournalImpl(ioExecutors, fileSize, config.getJournalMinFiles(), config.getJournalPoolFiles(), config.getJournalCompactMinFiles(), config.getJournalCompactPercentage(), config.getJournalFileOpenTimeout(), journalFF, "activemq-data", "amq", journalFF.getMaxIO(), 0, criticalErrorListener) {
+                     @Override
+                     protected void moveNextFile(boolean scheduleReclaim) throws Exception {
+                        super.moveNextFile(scheduleReclaim);
+                        if (blocked.get()) {
+                           throw new IllegalStateException("forcibly down");
+                        }
+                     }
+                  };
+               }
+
+               @Override
+               public void storeMessage(Message message) throws Exception {
+                  super.storeMessage(message);
+                  blocked.set(true);
+               }
+            };
+
+            this.getCriticalAnalyzer().add(storageManager);
+
+            return storageManager;
+         }
+
+      };
+
+      return server;
+   }
+
+   Configuration createConfig(String folder) throws Exception {
+
+      Configuration configuration = createDefaultConfig(true);
+      configuration.setSecurityEnabled(false).setJournalMinFiles(2).setJournalFileSize(100 * 1024).setJournalType(getDefaultJournalType()).setJournalDirectory(folder + "/journal").setBindingsDirectory(folder + "/bindings").setPagingDirectory(folder + "/paging").
+         setLargeMessagesDirectory(folder + "/largemessage").setJournalCompactMinFiles(0).setJournalCompactPercentage(0).setClusterPassword(CLUSTER_PASSWORD).setJournalDatasync(false);
+      configuration.setSecurityEnabled(false);
+      configuration.setPersistenceEnabled(true);
+
+      return configuration;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCore.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCore.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCore.java
deleted file mode 100644
index 6335c69..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCore.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.crossprotocol;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import java.net.URI;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.activemq.artemis.api.core.RoutingType;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.artemis.core.config.Configuration;
-import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
-import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.transport.amqp.client.AmqpClient;
-import org.apache.activemq.transport.amqp.client.AmqpConnection;
-import org.apache.activemq.transport.amqp.client.AmqpMessage;
-import org.apache.activemq.transport.amqp.client.AmqpSender;
-import org.apache.activemq.transport.amqp.client.AmqpSession;
-import org.apache.qpid.proton.amqp.UnsignedInteger;
-import org.apache.qpid.proton.amqp.messaging.Header;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AMQPToJMSCore extends ActiveMQTestBase {
-
-   private ActiveMQServer server;
-   protected String queueName = "amqTestQueue1";
-   private SimpleString coreQueue;
-
-   @Override
-   @Before
-   public void setUp() throws Exception {
-      super.setUp();
-      server = createServer(true, true);
-      server.start();
-      server.waitForActivation(10, TimeUnit.SECONDS);
-
-      Configuration serverConfig = server.getConfiguration();
-      serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false)
-                                                                        .setAutoCreateAddresses(false)
-                                                                        .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")));
-      serverConfig.setSecurityEnabled(false);
-      coreQueue = new SimpleString(queueName);
-      server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false);
-   }
-
-   @Override
-   @After
-   public void tearDown() throws Exception {
-      server.stop();
-      super.tearDown();
-   }
-
-   @Test
-   public void testMessageDestination() throws Exception {
-      System.out.println("foo");
-      AmqpClient client = new AmqpClient(new URI("tcp://127.0.0.1:61616"), null, null);
-      AmqpConnection amqpconnection = client.connect();
-      try {
-         AmqpSession session = amqpconnection.createSession();
-         AmqpSender sender = session.createSender(queueName);
-         AmqpMessage message = new AmqpMessage();
-         message.setMessageId("MessageID:" + 0);
-         //         message.setApplicationProperty("_AMQ_ROUTING_TYPE", (byte) 1);
-         message.getWrappedMessage().setHeader(new Header());
-         message.getWrappedMessage().getHeader().setDeliveryCount(new UnsignedInteger(2));
-         sender.send(message);
-      } finally {
-         amqpconnection.close();
-      }
-      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://127.0.0.1:61616");
-      Connection connection = null;
-      try {
-         connection = factory.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createQueue(queueName));
-         connection.start();
-         Message message = consumer.receive(2000);
-         Assert.assertNotNull(message);
-         ActiveMQDestination jmsDestination = (ActiveMQDestination) message.getJMSDestination();
-         Assert.assertEquals(queueName, jmsDestination.getAddress());
-      } finally {
-         if (connection != null) {
-            connection.close();
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCoreTest.java
new file mode 100644
index 0000000..08b6c81
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCoreTest.java
@@ -0,0 +1,111 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.crossprotocol;
+
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import java.net.URI;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.artemis.api.core.RoutingType;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.transport.amqp.client.AmqpClient;
+import org.apache.activemq.transport.amqp.client.AmqpConnection;
+import org.apache.activemq.transport.amqp.client.AmqpMessage;
+import org.apache.activemq.transport.amqp.client.AmqpSender;
+import org.apache.activemq.transport.amqp.client.AmqpSession;
+import org.apache.qpid.proton.amqp.UnsignedInteger;
+import org.apache.qpid.proton.amqp.messaging.Header;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AMQPToJMSCoreTest extends ActiveMQTestBase {
+
+   private ActiveMQServer server;
+   protected String queueName = "amqTestQueue1";
+   private SimpleString coreQueue;
+
+   @Override
+   @Before
+   public void setUp() throws Exception {
+      super.setUp();
+      server = createServer(true, true);
+      server.start();
+      server.waitForActivation(10, TimeUnit.SECONDS);
+
+      Configuration serverConfig = server.getConfiguration();
+      serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false)
+                                                                        .setAutoCreateAddresses(false)
+                                                                        .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")));
+      serverConfig.setSecurityEnabled(false);
+      coreQueue = new SimpleString(queueName);
+      server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false);
+   }
+
+   @Override
+   @After
+   public void tearDown() throws Exception {
+      server.stop();
+      super.tearDown();
+   }
+
+   @Test
+   public void testMessageDestination() throws Exception {
+      System.out.println("foo");
+      AmqpClient client = new AmqpClient(new URI("tcp://127.0.0.1:61616"), null, null);
+      AmqpConnection amqpconnection = client.connect();
+      try {
+         AmqpSession session = amqpconnection.createSession();
+         AmqpSender sender = session.createSender(queueName);
+         AmqpMessage message = new AmqpMessage();
+         message.setMessageId("MessageID:" + 0);
+         //         message.setApplicationProperty("_AMQ_ROUTING_TYPE", (byte) 1);
+         message.getWrappedMessage().setHeader(new Header());
+         message.getWrappedMessage().getHeader().setDeliveryCount(new UnsignedInteger(2));
+         sender.send(message);
+      } finally {
+         amqpconnection.close();
+      }
+      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://127.0.0.1:61616");
+      Connection connection = null;
+      try {
+         connection = factory.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createQueue(queueName));
+         connection.start();
+         Message message = consumer.receive(2000);
+         Assert.assertNotNull(message);
+         ActiveMQDestination jmsDestination = (ActiveMQDestination) message.getJMSDestination();
+         Assert.assertEquals(queueName, jmsDestination.getAddress());
+      } finally {
+         if (connection != null) {
+            connection.close();
+         }
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionFactoryOnGCTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionFactoryOnGCTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionFactoryOnGCTest.java
new file mode 100644
index 0000000..3a445d8
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionFactoryOnGCTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.jms.connection;
+
+import javax.jms.Connection;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.api.jms.JMSFactoryType;
+import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.tests.util.JMSTestBase;
+import org.junit.Test;
+
+/**
+ * A CloseConnectionOnGCTest
+ */
+public class CloseConnectionFactoryOnGCTest extends JMSTestBase {
+
+   @Test(timeout = 60000)
+   public void testCloseCFOnGC() throws Exception {
+
+      final AtomicInteger valueGC = new AtomicInteger(0);
+
+      ServerLocatorImpl.finalizeCallback = new Runnable() {
+         @Override
+         public void run() {
+            valueGC.incrementAndGet();
+         }
+      };
+
+      try {
+         // System.setOut(out);
+         for (int i = 0; i < 100; i++) {
+            ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
+            Connection conn = cf.createConnection();
+            cf = null;
+            conn.close();
+            conn = null;
+         }
+         forceGC();
+      } finally {
+         ServerLocatorImpl.finalizeCallback = null;
+      }
+
+      assertEquals("The code is throwing exceptions", 0, valueGC.get());
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionFactoryOnGCest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionFactoryOnGCest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionFactoryOnGCest.java
deleted file mode 100644
index 0dd966b..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionFactoryOnGCest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.tests.integration.jms.connection;
-
-import javax.jms.Connection;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.artemis.api.jms.JMSFactoryType;
-import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.tests.util.JMSTestBase;
-
-/**
- * A CloseConnectionOnGCTest
- */
-public class CloseConnectionFactoryOnGCest extends JMSTestBase {
-
-   public void testCloseCFOnGC() throws Exception {
-
-      final AtomicInteger valueGC = new AtomicInteger(0);
-
-      ServerLocatorImpl.finalizeCallback = new Runnable() {
-         @Override
-         public void run() {
-            valueGC.incrementAndGet();
-         }
-      };
-
-      try {
-         // System.setOut(out);
-         for (int i = 0; i < 100; i++) {
-            ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration(INVM_CONNECTOR_FACTORY));
-            Connection conn = cf.createConnection();
-            cf = null;
-            conn.close();
-            conn = null;
-         }
-         forceGC();
-      } finally {
-         ServerLocatorImpl.finalizeCallback = null;
-      }
-
-      assertEquals("The code is throwing exceptions", 0, valueGC.get());
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionJTATest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionJTATest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionJTATest.java
new file mode 100644
index 0000000..3a6bb03
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionJTATest.java
@@ -0,0 +1,256 @@
+/*
+ * 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.ra;
+
+import javax.jms.Connection;
+import javax.jms.JMSContext;
+import javax.jms.JMSException;
+import javax.jms.JMSProducer;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import java.util.HashSet;
+import java.util.Set;
+
+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.ClientSession;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory;
+import org.apache.activemq.artemis.core.security.Role;
+import org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactory;
+import org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl;
+import org.apache.activemq.artemis.ra.ActiveMQRAConnectionManager;
+import org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory;
+import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
+import org.apache.activemq.artemis.service.extensions.ServiceUtils;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class OutgoingConnectionJTATest extends ActiveMQRATestBase {
+
+   protected ActiveMQResourceAdapter resourceAdapter;
+   protected ActiveMQRAConnectionFactory qraConnectionFactory;
+   protected ActiveMQRAManagedConnectionFactory mcf;
+   ActiveMQRAConnectionManager qraConnectionManager = new ActiveMQRAConnectionManager();
+
+   @Override
+   public boolean useSecurity() {
+      return true;
+   }
+
+   @Override
+   @Before
+   public void setUp() throws Exception {
+      useDummyTransactionManager();
+      super.setUp();
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("testuser", "testpassword");
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("guest", "guest");
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("testuser", "arole");
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "arole");
+      Role role = new Role("arole", true, true, true, true, true, true, true, true, true, true);
+      Set<Role> roles = new HashSet<>();
+      roles.add(role);
+      server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles);
+
+      resourceAdapter = new ActiveMQResourceAdapter();
+      resourceAdapter.setEntries("[\"java://jmsXA\"]");
+
+      resourceAdapter.setConnectorClassName(InVMConnectorFactory.class.getName());
+      MyBootstrapContext ctx = new MyBootstrapContext();
+      resourceAdapter.start(ctx);
+      mcf = new ActiveMQRAManagedConnectionFactory();
+      mcf.setResourceAdapter(resourceAdapter);
+      qraConnectionFactory = new ActiveMQRAConnectionFactoryImpl(mcf, qraConnectionManager);
+   }
+
+   @Override
+   @After
+   public void tearDown() throws Exception {
+      ((DummyTransactionManager) ServiceUtils.getTransactionManager()).tx = null;
+      if (resourceAdapter != null) {
+         resourceAdapter.stop();
+      }
+
+      qraConnectionManager.stop();
+      super.tearDown();
+   }
+
+   @Test
+   public void testSimpleMessageSendAndReceiveTransacted() throws Exception {
+      setDummyTX();
+      setupDLQ(10);
+      resourceAdapter = newResourceAdapter();
+      MyBootstrapContext ctx = new MyBootstrapContext();
+      resourceAdapter.start(ctx);
+      ActiveMQRAManagedConnectionFactory mcf = new ActiveMQRAManagedConnectionFactory();
+      mcf.setResourceAdapter(resourceAdapter);
+      ActiveMQRAConnectionFactory qraConnectionFactory = new ActiveMQRAConnectionFactoryImpl(mcf, qraConnectionManager);
+      QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
+      Session s = queueConnection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+      MessageProducer mp = s.createProducer(q);
+      MessageConsumer consumer = s.createConsumer(q);
+      Message message = s.createTextMessage("test");
+      mp.send(message);
+      s.commit();
+      queueConnection.start();
+      TextMessage textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+      s.rollback();
+      textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+      s.commit();
+   }
+
+   public void testQueuSessionAckMode(boolean inTx) throws Exception {
+      if (inTx) {
+         setDummyTX();
+      }
+      QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
+
+      Session s = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      if (inTx) {
+         assertEquals(Session.SESSION_TRANSACTED, s.getAcknowledgeMode());
+      } else {
+         assertEquals(Session.AUTO_ACKNOWLEDGE, s.getAcknowledgeMode());
+      }
+      s.close();
+
+      s = queueConnection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
+      if (inTx) {
+         assertEquals(Session.SESSION_TRANSACTED, s.getAcknowledgeMode());
+      } else {
+         assertEquals(Session.DUPS_OK_ACKNOWLEDGE, s.getAcknowledgeMode());
+      }
+      s.close();
+
+      //exception should be thrown if ack mode is SESSION_TRANSACTED or
+      //CLIENT_ACKNOWLEDGE when in a JTA else ackmode should bee ignored
+      try {
+         s = queueConnection.createSession(false, Session.SESSION_TRANSACTED);
+         if (inTx) {
+            assertEquals(s.getAcknowledgeMode(), Session.SESSION_TRANSACTED);
+         } else {
+            fail("didn't get expected exception creating session with SESSION_TRANSACTED mode ");
+         }
+         s.close();
+      } catch (JMSException e) {
+         if (inTx) {
+            fail("shouldn't throw exception " + e);
+         }
+      }
+
+      try {
+         s = queueConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+         if (inTx) {
+            assertEquals(s.getAcknowledgeMode(), Session.SESSION_TRANSACTED);
+         } else {
+            fail("didn't get expected exception creating session with CLIENT_ACKNOWLEDGE mode");
+         }
+      } catch (JMSException e) {
+         if (inTx) {
+            fail("shouldn't throw exception " + e);
+         }
+      }
+
+   }
+
+   @Test
+   public void testSimpleSendNoXAJMSContext() throws Exception {
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+
+      try (ClientSessionFactory sf = locator.createSessionFactory();
+           ClientSession session = sf.createSession();
+           ClientConsumer consVerify = session.createConsumer(MDBQUEUE);
+           JMSContext jmsctx = qraConnectionFactory.createContext();
+      ) {
+         session.start();
+         // These next 4 lines could be written in a single line however it makes difficult for debugging
+         JMSProducer producer = jmsctx.createProducer();
+         producer.setProperty("strvalue", "hello");
+         TextMessage msgsend = jmsctx.createTextMessage("hello");
+         producer.send(q, msgsend);
+
+         ClientMessage msg = consVerify.receive(1000);
+         assertNotNull(msg);
+         assertEquals("hello", msg.getStringProperty("strvalue"));
+      }
+   }
+
+   @Test
+   public void testQueueSessionAckModeJTA() throws Exception {
+      testQueuSessionAckMode(true);
+   }
+
+   @Test
+   public void testSessionAckModeNoJTA() throws Exception {
+      testQueuSessionAckMode(false);
+   }
+
+   @Test
+   public void testSimpleMessageSendAndReceive() throws Exception {
+      QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
+      Session s = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+      MessageProducer mp = s.createProducer(q);
+      MessageConsumer consumer = s.createConsumer(q);
+      Message message = s.createTextMessage("test");
+      mp.send(message);
+      queueConnection.start();
+      TextMessage textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+   }
+
+   @Test
+   public void testSimpleSendNoXAJMS1() throws Exception {
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+      try (ClientSessionFactory sf = locator.createSessionFactory();
+           ClientSession session = sf.createSession();
+           ClientConsumer consVerify = session.createConsumer(MDBQUEUE);
+           Connection conn = qraConnectionFactory.createConnection();
+      ) {
+         Session jmsSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         session.start();
+         MessageProducer producer = jmsSess.createProducer(q);
+         // These next 4 lines could be written in a single line however it makes difficult for debugging
+         TextMessage msgsend = jmsSess.createTextMessage("hello");
+         msgsend.setStringProperty("strvalue", "hello");
+         producer.send(msgsend);
+
+         ClientMessage msg = consVerify.receive(1000);
+         assertNotNull(msg);
+         assertEquals("hello", msg.getStringProperty("strvalue"));
+      }
+   }
+
+   private void setDummyTX() {
+      ((DummyTransactionManager) ServiceUtils.getTransactionManager()).tx = new DummyTransaction();
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionNoJTATest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionNoJTATest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionNoJTATest.java
new file mode 100644
index 0000000..d18bf76
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionNoJTATest.java
@@ -0,0 +1,271 @@
+/*
+ * 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.ra;
+
+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.ClientSession;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory;
+import org.apache.activemq.artemis.core.security.Role;
+import org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactory;
+import org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl;
+import org.apache.activemq.artemis.ra.ActiveMQRAConnectionManager;
+import org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory;
+import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
+import org.apache.activemq.artemis.service.extensions.ServiceUtils;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.jms.Connection;
+import javax.jms.JMSContext;
+import javax.jms.JMSProducer;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import java.util.HashSet;
+import java.util.Set;
+
+public class OutgoingConnectionNoJTATest extends ActiveMQRATestBase {
+
+   protected ActiveMQResourceAdapter resourceAdapter;
+   protected ActiveMQRAConnectionFactory qraConnectionFactory;
+   protected ActiveMQRAManagedConnectionFactory mcf;
+   ActiveMQRAConnectionManager qraConnectionManager = new ActiveMQRAConnectionManager();
+
+   @Override
+   public boolean useSecurity() {
+      return true;
+   }
+
+   @Override
+   @Before
+   public void setUp() throws Exception {
+      useDummyTransactionManager();
+      super.setUp();
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("testuser", "testpassword");
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addUser("guest", "guest");
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("testuser", "arole");
+      ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "arole");
+      Role role = new Role("arole", true, true, true, true, true, true, true, true);
+      Set<Role> roles = new HashSet<>();
+      roles.add(role);
+      server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles);
+
+      resourceAdapter = new ActiveMQResourceAdapter();
+      resourceAdapter.setEntries("[\"java://jmsXA\"]");
+      resourceAdapter.setConnectorClassName(InVMConnectorFactory.class.getName());
+      MyBootstrapContext ctx = new MyBootstrapContext();
+      resourceAdapter.start(ctx);
+      mcf = new ActiveMQRAManagedConnectionFactory();
+      mcf.setAllowLocalTransactions(true);
+      mcf.setResourceAdapter(resourceAdapter);
+      qraConnectionFactory = new ActiveMQRAConnectionFactoryImpl(mcf, qraConnectionManager);
+   }
+
+   @Override
+   @After
+   public void tearDown() throws Exception {
+      ((DummyTransactionManager) ServiceUtils.getTransactionManager()).tx = null;
+      if (resourceAdapter != null) {
+         resourceAdapter.stop();
+      }
+
+      qraConnectionManager.stop();
+      super.tearDown();
+   }
+
+   @Test
+   public void testSimpleMessageSendAndReceiveSessionTransacted() throws Exception {
+      setupDLQ(10);
+      resourceAdapter = newResourceAdapter();
+      MyBootstrapContext ctx = new MyBootstrapContext();
+      resourceAdapter.start(ctx);
+      ActiveMQRAManagedConnectionFactory mcf = new ActiveMQRAManagedConnectionFactory();
+      mcf.setAllowLocalTransactions(true);
+      mcf.setResourceAdapter(resourceAdapter);
+      ActiveMQRAConnectionFactory qraConnectionFactory = new ActiveMQRAConnectionFactoryImpl(mcf, qraConnectionManager);
+      QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
+      Session s = queueConnection.createSession(true, Session.SESSION_TRANSACTED);
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+      MessageProducer mp = s.createProducer(q);
+      MessageConsumer consumer = s.createConsumer(q);
+      Message message = s.createTextMessage("test");
+      mp.send(message);
+      s.commit();
+      queueConnection.start();
+      TextMessage textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+      s.rollback();
+      textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+      s.commit();
+      textMessage = (TextMessage) consumer.receiveNoWait();
+      assertNull(textMessage);
+   }
+
+   @Test
+   public void testSimpleMessageSendAndReceiveNotTransacted() throws Exception {
+      setupDLQ(10);
+      resourceAdapter = newResourceAdapter();
+      MyBootstrapContext ctx = new MyBootstrapContext();
+      resourceAdapter.start(ctx);
+      ActiveMQRAManagedConnectionFactory mcf = new ActiveMQRAManagedConnectionFactory();
+      mcf.setAllowLocalTransactions(true);
+      mcf.setResourceAdapter(resourceAdapter);
+      ActiveMQRAConnectionFactory qraConnectionFactory = new ActiveMQRAConnectionFactoryImpl(mcf, qraConnectionManager);
+      QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
+      Session s = queueConnection.createSession(false, Session.SESSION_TRANSACTED);
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+      MessageProducer mp = s.createProducer(q);
+      MessageConsumer consumer = s.createConsumer(q);
+      Message message = s.createTextMessage("test");
+      mp.send(message);
+      s.commit();
+      queueConnection.start();
+      TextMessage textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+      s.rollback();
+      textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+      s.commit();
+      textMessage = (TextMessage) consumer.receiveNoWait();
+      assertNull(textMessage);
+   }
+
+   @Test
+   public void testSimpleMessageSendAndReceiveSessionTransacted2() throws Exception {
+      setupDLQ(10);
+      resourceAdapter = newResourceAdapter();
+      MyBootstrapContext ctx = new MyBootstrapContext();
+      resourceAdapter.start(ctx);
+      ActiveMQRAManagedConnectionFactory mcf = new ActiveMQRAManagedConnectionFactory();
+      mcf.setAllowLocalTransactions(true);
+      mcf.setResourceAdapter(resourceAdapter);
+      ActiveMQRAConnectionFactory qraConnectionFactory = new ActiveMQRAConnectionFactoryImpl(mcf, qraConnectionManager);
+      QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
+      Session s = queueConnection.createSession(Session.SESSION_TRANSACTED);
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+      MessageProducer mp = s.createProducer(q);
+      MessageConsumer consumer = s.createConsumer(q);
+      Message message = s.createTextMessage("test");
+      mp.send(message);
+      s.commit();
+      queueConnection.start();
+      TextMessage textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+      s.rollback();
+      textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+      s.commit();
+      textMessage = (TextMessage) consumer.receiveNoWait();
+      assertNull(textMessage);
+   }
+
+   @Test
+   public void sessionTransactedTestNoActiveJTATx() throws Exception {
+      JMSContext context = qraConnectionFactory.createContext(JMSContext.SESSION_TRANSACTED);
+      assertEquals(context.getSessionMode(), JMSContext.AUTO_ACKNOWLEDGE);
+   }
+
+
+   @Test
+   public void testQueuSessionAckMode() throws Exception {
+
+      QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
+
+      Session s = queueConnection.createSession(false, Session.SESSION_TRANSACTED);
+
+      s.close();
+   }
+
+
+
+   @Test
+   public void testSimpleSendNoXAJMSContext() throws Exception {
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+
+      try (ClientSessionFactory sf = locator.createSessionFactory();
+           ClientSession session = sf.createSession();
+           ClientConsumer consVerify = session.createConsumer("jms.queue." + MDBQUEUE);
+           JMSContext jmsctx = qraConnectionFactory.createContext();
+      ) {
+         session.start();
+         // These next 4 lines could be written in a single line however it makes difficult for debugging
+         JMSProducer producer = jmsctx.createProducer();
+         producer.setProperty("strvalue", "hello");
+         TextMessage msgsend = jmsctx.createTextMessage("hello");
+         producer.send(q, msgsend);
+
+         ClientMessage msg = consVerify.receive(1000);
+         assertNotNull(msg);
+         assertEquals("hello", msg.getStringProperty("strvalue"));
+      }
+   }
+
+   @Test
+   public void testSimpleMessageSendAndReceive() throws Exception {
+      QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
+      Session s = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+      MessageProducer mp = s.createProducer(q);
+      MessageConsumer consumer = s.createConsumer(q);
+      Message message = s.createTextMessage("test");
+      mp.send(message);
+      queueConnection.start();
+      TextMessage textMessage = (TextMessage) consumer.receive(1000);
+      assertNotNull(textMessage);
+      assertEquals(textMessage.getText(), "test");
+   }
+
+   @Test
+   public void testSimpleSendNoXAJMS1() throws Exception {
+      Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
+      try (ClientSessionFactory sf = locator.createSessionFactory();
+           ClientSession session = sf.createSession();
+           ClientConsumer consVerify = session.createConsumer("jms.queue." + MDBQUEUE);
+           Connection conn = qraConnectionFactory.createConnection();
+      ) {
+         Session jmsSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         session.start();
+         MessageProducer producer = jmsSess.createProducer(q);
+         // These next 4 lines could be written in a single line however it makes difficult for debugging
+         TextMessage msgsend = jmsSess.createTextMessage("hello");
+         msgsend.setStringProperty("strvalue", "hello");
+         producer.send(msgsend);
+
+         ClientMessage msg = consVerify.receive(1000);
+         assertNotNull(msg);
+         assertEquals("hello", msg.getStringProperty("strvalue"));
+      }
+   }
+}


Mime
View raw message