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 2017/12/20 21:06:33 UTC
[1/6] activemq-artemis git commit: ARTEMIS-1532 Use @Ignore
annotation to disable tests
Repository: activemq-artemis
Updated Branches:
refs/heads/master f7ea0d7e7 -> 43b72759e
ARTEMIS-1532 Use @Ignore annotation to disable 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/b17cec0a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b17cec0a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b17cec0a
Branch: refs/heads/master
Commit: b17cec0a5e9d774d65a74ccc4b4f193fd7e45ff2
Parents: 62280c8
Author: Jiri Danek <jd...@redhat.com>
Authored: Sun Dec 3 23:51:01 2017 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Dec 20 16:06:22 2017 -0500
----------------------------------------------------------------------
.../integration/client/ConsumerWindowSizeTest.java | 13 +++++++------
.../distribution/ClusteredRequestResponseTest.java | 5 ++++-
.../tests/integration/jms/client/PreACKJMSTest.java | 5 ++++-
.../tests/integration/openwire/SimpleOpenWireTest.java | 4 +++-
.../tests/integration/security/SecurityTest.java | 7 +++++--
.../artemis/jms/tests/selector/SelectorTest.java | 5 ++++-
6 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b17cec0a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java
index 5bd3ea0..d3adee0 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java
@@ -44,6 +44,7 @@ import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
public class ConsumerWindowSizeTest extends ActiveMQTestBase {
@@ -542,8 +543,9 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase {
internalTestSlowConsumerNoBuffer(false);
}
- // I believe this test became invalid after we started using another thread to deliver the large message
- public void disabled_testSlowConsumerNoBufferLargeMessages() throws Exception {
+ @Test
+ @Ignore("I believe this test became invalid after we started using another thread to deliver the large message")
+ public void testSlowConsumerNoBufferLargeMessages() throws Exception {
internalTestSlowConsumerNoBuffer(true);
}
@@ -559,13 +561,12 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase {
server.start();
locator.setConsumerWindowSize(0);
-
- ClientSessionFactory sf = createSessionFactory(locator);
-
if (largeMessages) {
- sf.getServerLocator().setMinLargeMessageSize(100);
+ locator.setMinLargeMessageSize(100);
}
+ ClientSessionFactory sf = createSessionFactory(locator);
+
session = sf.createSession(false, true, true);
SimpleString ADDRESS = addressA;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b17cec0a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
index efbbac8..63acca7 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
public class ClusteredRequestResponseTest extends ClusterTestBase {
@@ -83,7 +84,9 @@ public class ClusteredRequestResponseTest extends ClusterTestBase {
*
* TODO: I believe this test is invalid. I'm just ignoring it for now. It will probably go away
*/
- public void invalidTest_testRequestResponseNoWaitForBindings() throws Exception {
+ @Test
+ @Ignore
+ public void testRequestResponseNoWaitForBindings() throws Exception {
setupCluster();
startServers(0, 1, 2, 3, 4);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b17cec0a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/PreACKJMSTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/PreACKJMSTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/PreACKJMSTest.java
index cc96f08..e6b23de 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/PreACKJMSTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/PreACKJMSTest.java
@@ -29,6 +29,7 @@ import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
public class PreACKJMSTest extends JMSTestBase {
@@ -95,7 +96,9 @@ public class PreACKJMSTest extends JMSTestBase {
assertNull("ConnectionFactory is on PreACK mode, the message shouldn't be received", msg2);
}
- public void disabled_testPreACKTransactional() throws Exception {
+ @Test
+ @Ignore
+ public void testPreACKTransactional() throws Exception {
conn = cf.createConnection();
Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b17cec0a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
index 4c5b957..618249b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
@@ -72,6 +72,7 @@ import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
public class SimpleOpenWireTest extends BasicOpenWireTest {
@@ -526,7 +527,8 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
}
}
- // @Test -- ignored for now
+ @Test
+ @Ignore("ignored for now")
public void testKeepAlive() throws Exception {
connection.start();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b17cec0a/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 6ff547b..6d5b77d 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
@@ -62,6 +62,7 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.CreateMessage;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
public class SecurityTest extends ActiveMQTestBase {
@@ -1605,7 +1606,9 @@ public class SecurityTest extends ActiveMQTestBase {
}
- public void _testComplexRoles2() throws Exception {
+ @Test
+ @Ignore
+ public void testComplexRoles2() throws Exception {
ActiveMQServer server = createServer();
server.start();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
@@ -1645,8 +1648,8 @@ public class SecurityTest extends ActiveMQTestBase {
ClientSession andrewConnection = null;
ClientSession frankConnection = null;
ClientSession samConnection = null;
+ locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true);
ClientSessionFactory factory = createSessionFactory(locator);
- factory.getServerLocator().setBlockOnNonDurableSend(true).setBlockOnDurableSend(true);
ClientSession adminSession = factory.createSession("all", "all", false, true, true, false, -1);
String genericQueueName = "genericQueue";
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b17cec0a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java
index 80f0ced..21bc704 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java
@@ -33,6 +33,7 @@ import org.apache.activemq.artemis.jms.tests.ActiveMQServerTestCase;
import org.apache.activemq.artemis.jms.tests.util.ProxyAssertSupport;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;
@@ -883,7 +884,9 @@ public class SelectorTest extends ActiveMQServerTestCase {
// Test case proposed by a customer on this user forum:
// http://community.jboss.org/thread/153426?tstart=0
// This test needs to be moved away
- public void disabled_testMultipleConsumers() throws Exception {
+ @Test
+ @Ignore
+ public void testMultipleConsumers() throws Exception {
Connection conn = null;
try {
[3/6] activemq-artemis git commit: ARTEMIS-1532 Enable tests which
are unintentionally skipped by Surefire
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java
new file mode 100644
index 0000000..38da2d2
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java
@@ -0,0 +1,466 @@
+/*
+ * 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.stomp;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.activemq.artemis.api.core.RoutingType;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
+import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
+import org.apache.activemq.artemis.tests.integration.largemessage.LargeMessageTestBase;
+import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+@RunWith(Parameterized.class)
+@Ignore
+public class StompWithLargeMessagesTest extends StompTestBase {
+
+ // Web Socket has max frame size of 64kb. Large message tests only available over TCP.
+ @Parameterized.Parameters(name = "{0}")
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][]{{"tcp+v10.stomp"}, {"tcp+v12.stomp"}});
+ }
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ public boolean isCompressLargeMessages() {
+ return true;
+ }
+
+ @Override
+ public boolean isPersistenceEnabled() {
+ return true;
+ }
+
+ @Override
+ public Integer getStompMinLargeMessageSize() {
+ return 2048;
+ }
+
+ @Test
+ public void testSendReceiveLargeMessage() throws Exception {
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+
+ String address = "testLargeMessageAddress";
+ server.getActiveMQServer().createQueue(SimpleString.toSimpleString(address), RoutingType.ANYCAST, SimpleString.toSimpleString(address), null, true, false);
+
+ // STOMP default is UTF-8 == 1 byte per char.
+ int largeMessageStringSize = 10 * 1024 * 1024; // 10MB
+ StringBuilder b = new StringBuilder(largeMessageStringSize);
+ for (int i = 0; i < largeMessageStringSize; i++) {
+ b.append('t');
+ }
+ String payload = b.toString();
+
+ // Set up STOMP subscription
+ conn.connect(defUser, defPass);
+ subscribe(conn, null, Stomp.Headers.Subscribe.AckModeValues.AUTO, null, null, address, true);
+
+ // Send Large Message
+ System.out.println("Sending Message Size: " + largeMessageStringSize);
+ send(conn, address, null, payload);
+
+ // Receive STOMP Message
+ ClientStompFrame frame = conn.receiveFrame();
+ System.out.println(frame.getBody().length());
+ assertTrue(frame.getBody().equals(payload));
+ }
+
+ //stomp sender -> large -> stomp receiver
+ @Test
+ public void testSendReceiveLargePersistentMessages() throws Exception {
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+ conn.connect(defUser, defPass);
+
+ int count = 10;
+ int msgSize = 1024 * 1024;
+ char[] contents = new char[msgSize];
+ for (int i = 0; i < msgSize; i++) {
+ contents[i] = 'A';
+ }
+ String body = new String(contents);
+
+ for (int i = 0; i < count; i++) {
+ ClientStompFrame frame = conn.createFrame("SEND");
+ frame.addHeader("destination", getQueuePrefix() + getQueueName());
+ frame.addHeader("persistent", "true");
+ frame.setBody(body);
+ conn.sendFrame(frame);
+ }
+
+ ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
+ subFrame.addHeader("subscription-type", "ANYCAST");
+ subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ subFrame.addHeader("ack", "auto");
+ conn.sendFrame(subFrame);
+
+ for (int i = 0; i < count; i++) {
+ ClientStompFrame frame = conn.receiveFrame(60000);
+ Assert.assertNotNull(frame);
+ System.out.println("part of frame: " + frame.getBody().substring(0, 200));
+ Assert.assertTrue(frame.getCommand().equals("MESSAGE"));
+ Assert.assertTrue(frame.getHeader("destination").equals(getQueuePrefix() + getQueueName()));
+ int index = frame.getBody().indexOf("AAAA");
+ assertEquals(msgSize, (frame.getBody().length() - index));
+ }
+
+ ClientStompFrame unsubFrame = conn.createFrame("UNSUBSCRIBE");
+ unsubFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ unsubFrame.addHeader("receipt", "567");
+ ClientStompFrame response = conn.sendFrame(unsubFrame);
+ assertNotNull(response);
+ assertNotNull(response.getCommand().equals("RECEIPT"));
+
+ conn.disconnect();
+ }
+
+ //core sender -> large -> stomp receiver
+ @Test
+ public void testReceiveLargePersistentMessagesFromCore() throws Exception {
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+ conn.connect(defUser, defPass);
+
+ int msgSize = 3 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+ char[] contents = new char[msgSize];
+ for (int i = 0; i < msgSize; i++) {
+ contents[i] = 'B';
+ }
+ String msg = new String(contents);
+
+ int count = 10;
+ for (int i = 0; i < count; i++) {
+ this.sendJmsMessage(msg);
+ }
+
+ ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
+ subFrame.addHeader("subscription-type", "ANYCAST");
+ subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ subFrame.addHeader("ack", "auto");
+ conn.sendFrame(subFrame);
+
+ for (int i = 0; i < count; i++) {
+ ClientStompFrame frame = conn.receiveFrame(60000);
+ Assert.assertNotNull(frame);
+ System.out.println("part of frame: " + frame.getBody().substring(0, 200));
+ Assert.assertTrue(frame.getCommand().equals("MESSAGE"));
+ Assert.assertTrue(frame.getHeader("destination").equals(getQueuePrefix() + getQueueName()));
+ int index = frame.getBody().indexOf("BBB");
+ assertEquals(msgSize, (frame.getBody().length() - index));
+ }
+
+ ClientStompFrame unsubFrame = conn.createFrame("UNSUBSCRIBE");
+ unsubFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ unsubFrame.addHeader("receipt", "567");
+ ClientStompFrame response = conn.sendFrame(unsubFrame);
+ assertNotNull(response);
+ assertNotNull(response.getCommand().equals("RECEIPT"));
+
+ conn.disconnect();
+ }
+
+// //stomp v12 sender -> large -> stomp v12 receiver
+// @Test
+// public void testSendReceiveLargePersistentMessagesV12() throws Exception {
+// StompClientConnection connV12 = StompClientConnectionFactory.createClientConnection("1.2", "localhost", port);
+// connV12.connect(defUser, defPass);
+//
+// int count = 10;
+// int szBody = 1024 * 1024;
+// char[] contents = new char[szBody];
+// for (int i = 0; i < szBody; i++) {
+// contents[i] = 'A';
+// }
+// String body = new String(contents);
+//
+// ClientStompFrame frame = connV12.createFrame("SEND");
+// frame.addHeader("destination-type", "ANYCAST");
+// frame.addHeader("destination", getQueuePrefix() + getQueueName());
+// frame.addHeader("persistent", "true");
+// frame.setBody(body);
+//
+// for (int i = 0; i < count; i++) {
+// connV12.sendFrame(frame);
+// }
+//
+// ClientStompFrame subFrame = connV12.createFrame("SUBSCRIBE");
+// subFrame.addHeader("id", "a-sub");
+// subFrame.addHeader("subscription-type", "ANYCAST");
+// subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+// subFrame.addHeader("ack", "auto");
+//
+// connV12.sendFrame(subFrame);
+//
+// for (int i = 0; i < count; i++) {
+// ClientStompFrame receiveFrame = connV12.receiveFrame(30000);
+//
+// Assert.assertNotNull(receiveFrame);
+// System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 20));
+// Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
+// Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
+// assertEquals(szBody, receiveFrame.getBody().length());
+// }
+//
+// // remove susbcription
+// ClientStompFrame unsubFrame = connV12.createFrame("UNSUBSCRIBE");
+// unsubFrame.addHeader("id", "a-sub");
+// connV12.sendFrame(unsubFrame);
+//
+// connV12.disconnect();
+// }
+//
+// //core sender -> large -> stomp v12 receiver
+// @Test
+// public void testReceiveLargePersistentMessagesFromCoreV12() throws Exception {
+// int msgSize = 3 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+// char[] contents = new char[msgSize];
+// for (int i = 0; i < msgSize; i++) {
+// contents[i] = 'B';
+// }
+// String msg = new String(contents);
+//
+// int count = 10;
+// for (int i = 0; i < count; i++) {
+// this.sendJmsMessage(msg);
+// }
+//
+// StompClientConnection connV12 = StompClientConnectionFactory.createClientConnection("1.2", "localhost", port);
+// connV12.connect(defUser, defPass);
+//
+// ClientStompFrame subFrame = connV12.createFrame("SUBSCRIBE");
+// subFrame.addHeader("id", "a-sub");
+// subFrame.addHeader("subscription-type", "ANYCAST");
+// subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+// subFrame.addHeader("ack", "auto");
+// connV12.sendFrame(subFrame);
+//
+// for (int i = 0; i < count; i++) {
+// ClientStompFrame receiveFrame = connV12.receiveFrame(30000);
+//
+// Assert.assertNotNull(receiveFrame);
+// System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 20));
+// Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
+// Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
+// assertEquals(msgSize, receiveFrame.getBody().length());
+// }
+//
+// // remove susbcription
+// ClientStompFrame unsubFrame = connV12.createFrame("UNSUBSCRIBE");
+// unsubFrame.addHeader("id", "a-sub");
+// connV12.sendFrame(unsubFrame);
+//
+// connV12.disconnect();
+// }
+
+ //core sender -> large (compressed regular) -> stomp v10 receiver
+ @Test
+ public void testReceiveLargeCompressedToRegularPersistentMessagesFromCore() throws Exception {
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+ conn.connect(defUser, defPass);
+
+ LargeMessageTestBase.TestLargeMessageInputStream input = new LargeMessageTestBase.TestLargeMessageInputStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, true);
+ LargeMessageTestBase.adjustLargeCompression(true, input, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
+
+ char[] contents = input.toArray();
+ String msg = new String(contents);
+
+ String leadingPart = msg.substring(0, 100);
+
+ int count = 10;
+ for (int i = 0; i < count; i++) {
+ this.sendJmsMessage(msg);
+ }
+
+ ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
+ subFrame.addHeader("subscription-type", "ANYCAST");
+ subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ subFrame.addHeader("ack", "auto");
+ conn.sendFrame(subFrame);
+
+ for (int i = 0; i < count; i++) {
+ ClientStompFrame receiveFrame = conn.receiveFrame(30000);
+ Assert.assertNotNull(receiveFrame);
+ System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 250));
+ Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
+ Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
+ int index = receiveFrame.getBody().indexOf(leadingPart);
+ assertEquals(msg.length(), (receiveFrame.getBody().length() - index));
+ }
+
+ // remove suscription
+ ClientStompFrame unsubFrame = conn.createFrame("UNSUBSCRIBE");
+ unsubFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ unsubFrame.addHeader("receipt", "567");
+ ClientStompFrame response = conn.sendFrame(unsubFrame);
+ assertNotNull(response);
+ assertNotNull(response.getCommand().equals("RECEIPT"));
+
+ conn.disconnect();
+ }
+
+// //core sender -> large (compressed regular) -> stomp v12 receiver
+// @Test
+// public void testReceiveLargeCompressedToRegularPersistentMessagesFromCoreV12() throws Exception {
+// LargeMessageTestBase.TestLargeMessageInputStream input = new LargeMessageTestBase.TestLargeMessageInputStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, true);
+// LargeMessageTestBase.adjustLargeCompression(true, input, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
+//
+// char[] contents = input.toArray();
+// String msg = new String(contents);
+//
+// int count = 10;
+// for (int i = 0; i < count; i++) {
+// this.sendJmsMessage(msg);
+// }
+//
+// StompClientConnection connV12 = StompClientConnectionFactory.createClientConnection("1.2", "localhost", port);
+// connV12.connect(defUser, defPass);
+//
+// ClientStompFrame subFrame = connV12.createFrame("SUBSCRIBE");
+// subFrame.addHeader("id", "a-sub");
+// subFrame.addHeader("subscription-type", "ANYCAST");
+// subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+// subFrame.addHeader("ack", "auto");
+//
+// connV12.sendFrame(subFrame);
+//
+// for (int i = 0; i < count; i++) {
+// ClientStompFrame receiveFrame = connV12.receiveFrame(30000);
+//
+// Assert.assertNotNull(receiveFrame);
+// System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 20));
+// Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
+// Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
+// assertEquals(contents.length, receiveFrame.getBody().length());
+// }
+//
+// // remove susbcription
+// ClientStompFrame unsubFrame = connV12.createFrame("UNSUBSCRIBE");
+// unsubFrame.addHeader("id", "a-sub");
+// connV12.sendFrame(unsubFrame);
+//
+// connV12.disconnect();
+// }
+//
+// //core sender -> large (compressed large) -> stomp v12 receiver
+// @Test
+// public void testReceiveLargeCompressedToLargePersistentMessagesFromCoreV12() throws Exception {
+// LargeMessageTestBase.TestLargeMessageInputStream input = new LargeMessageTestBase.TestLargeMessageInputStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, true);
+// input.setSize(10 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
+// LargeMessageTestBase.adjustLargeCompression(false, input, 10 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
+//
+// char[] contents = input.toArray();
+// String msg = new String(contents);
+//
+// int count = 10;
+// for (int i = 0; i < count; i++) {
+// this.sendJmsMessage(msg);
+// }
+//
+// IntegrationTestLogger.LOGGER.info("Message count for " + getQueueName() + ": " + server.getActiveMQServer().locateQueue(SimpleString.toSimpleString(getQueueName())).getMessageCount());
+//
+// StompClientConnection connV12 = StompClientConnectionFactory.createClientConnection("1.2", hostname, port);
+// connV12.connect(defUser, defPass);
+//
+// ClientStompFrame subFrame = connV12.createFrame("SUBSCRIBE");
+// subFrame.addHeader("id", "a-sub");
+// subFrame.addHeader("subscription-type", "ANYCAST");
+// subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+// subFrame.addHeader("ack", "auto");
+//
+// connV12.sendFrame(subFrame);
+//
+// for (int i = 0; i < count; i++) {
+// ClientStompFrame receiveFrame = connV12.receiveFrame(30000);
+//
+// Assert.assertNotNull(receiveFrame);
+// System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 20));
+// Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
+// Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
+// assertEquals(contents.length, receiveFrame.getBody().length());
+// }
+//
+// // remove susbcription
+// ClientStompFrame unsubFrame = connV12.createFrame("UNSUBSCRIBE");
+// unsubFrame.addHeader("id", "a-sub");
+// connV12.sendFrame(unsubFrame);
+//
+// connV12.disconnect();
+// }
+
+ //core sender -> large (compressed large) -> stomp v10 receiver
+ @Test
+ public void testReceiveLargeCompressedToLargePersistentMessagesFromCore() throws Exception {
+
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+ try {
+ LargeMessageTestBase.TestLargeMessageInputStream input = new LargeMessageTestBase.TestLargeMessageInputStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, true);
+ input.setSize(10 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
+ LargeMessageTestBase.adjustLargeCompression(false, input, 10 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
+
+ char[] contents = input.toArray();
+ String msg = new String(contents);
+
+ String leadingPart = msg.substring(0, 100);
+
+ int count = 10;
+ for (int i = 0; i < count; i++) {
+ this.sendJmsMessage(msg);
+ }
+
+ conn.connect(defUser, defPass);
+
+ ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
+ subFrame.addHeader("subscription-type", "ANYCAST");
+ subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ subFrame.addHeader("ack", "auto");
+ conn.sendFrame(subFrame);
+
+ for (int i = 0; i < count; i++) {
+ ClientStompFrame frame = conn.receiveFrame(60000);
+ Assert.assertNotNull(frame);
+ System.out.println(frame.toString());
+ System.out.println("part of frame: " + frame.getBody().substring(0, 250));
+ Assert.assertTrue(frame.getCommand().equals("MESSAGE"));
+ Assert.assertTrue(frame.getHeader("destination").equals(getQueuePrefix() + getQueueName()));
+ int index = frame.getBody().toString().indexOf(leadingPart);
+ assertEquals(msg.length(), (frame.getBody().toString().length() - index));
+ }
+
+ ClientStompFrame unsubFrame = conn.createFrame("UNSUBSCRIBE");
+ unsubFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ unsubFrame.addHeader("receipt", "567");
+ conn.sendFrame(unsubFrame);
+ } finally {
+ conn.disconnect();
+ conn.closeTransport();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithMessageIDTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithMessageIDTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithMessageIDTest.java
new file mode 100644
index 0000000..c9e68e8
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithMessageIDTest.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.stomp;
+
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.QueueBrowser;
+import javax.jms.TextMessage;
+import java.util.Enumeration;
+
+import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StompWithMessageIDTest extends StompTestBase {
+
+ @Override
+ public boolean isEnableStompMessageId() {
+ return true;
+ }
+
+ @Test
+ public void testEnableMessageID() throws Exception {
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+ conn.connect(defUser, defPass);
+
+ ClientStompFrame frame = conn.createFrame("SEND");
+ frame.addHeader("destination", getQueuePrefix() + getQueueName());
+ frame.setBody("Hello World 1");
+ conn.sendFrame(frame);
+
+ frame = conn.createFrame("SEND");
+ frame.addHeader("destination", getQueuePrefix() + getQueueName());
+ frame.setBody("Hello World 2");
+ conn.sendFrame(frame);
+
+ QueueBrowser browser = session.createBrowser(queue);
+
+ Enumeration enu = browser.getEnumeration();
+
+ while (enu.hasMoreElements()) {
+ Message msg = (Message) enu.nextElement();
+ String msgId = msg.getStringProperty("amqMessageId");
+ assertNotNull(msgId);
+ assertTrue(msgId.indexOf("STOMP") == 0);
+ }
+
+ browser.close();
+
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ TextMessage message = (TextMessage) consumer.receive(1000);
+ Assert.assertNotNull(message);
+
+ message = (TextMessage) consumer.receive(1000);
+ Assert.assertNotNull(message);
+
+ message = (TextMessage) consumer.receive(2000);
+ Assert.assertNull(message);
+
+ conn.disconnect();
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.java
new file mode 100644
index 0000000..7bdc18b
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithSecurityTest.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.stomp;
+
+import javax.jms.MessageConsumer;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StompWithSecurityTest extends StompTestBase {
+
+ @Override
+ public boolean isSecurityEnabled() {
+ return true;
+ }
+
+ @Test
+ public void testJMSXUserID() throws Exception {
+ server.getActiveMQServer().getConfiguration().setPopulateValidatedUser(true);
+
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+ conn.connect(defUser, defPass);
+
+ ClientStompFrame frame = conn.createFrame("SEND");
+ frame.addHeader("destination", getQueuePrefix() + getQueueName());
+ frame.setBody("Hello World");
+ conn.sendFrame(frame);
+
+ conn.disconnect();
+
+ TextMessage message = (TextMessage) consumer.receive(1000);
+ Assert.assertNotNull(message);
+ Assert.assertEquals("Hello World", message.getText());
+ // Assert default priority 4 is used when priority header is not set
+ Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
+ Assert.assertEquals("JMSXUserID", "brianm", message.getStringProperty("JMSXUserID"));
+
+ // Make sure that the timestamp is valid - should
+ // be very close to the current time.
+ long tnow = System.currentTimeMillis();
+ long tmsg = message.getJMSTimestamp();
+ Assert.assertTrue(Math.abs(tnow - tmsg) < 1000);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java
index aa2b666..0e22146 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.unit.core.server.group.impl;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.junit.Test;
public class SystemPropertyOverrideTest extends ActiveMQTestBase {
// Constants -----------------------------------------------------
@@ -31,6 +32,7 @@ public class SystemPropertyOverrideTest extends ActiveMQTestBase {
// Public --------------------------------------------------------
+ @Test
public void testSystemPropertyOverride() throws Exception {
final String groupTimeoutPropertyValue = "1234";
final String reaperPeriodPropertyValue = "5678";
[4/6] activemq-artemis git commit: ARTEMIS-1532 Enable tests which
are unintentionally skipped by Surefire
Posted by cl...@apache.org.
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/OutgoingConnectionTestJTA.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java
deleted file mode 100644
index ab32ad3..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java
+++ /dev/null
@@ -1,256 +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.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 OutgoingConnectionTestJTA 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/OutgoingConnectionTestNoJTA.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestNoJTA.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestNoJTA.java
deleted file mode 100644
index 7b2ba8d..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestNoJTA.java
+++ /dev/null
@@ -1,271 +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.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 OutgoingConnectionTestNoJTA 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"));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompPropertiesInterceptorTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompPropertiesInterceptorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompPropertiesInterceptorTest.java
new file mode 100644
index 0000000..f5656f5
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompPropertiesInterceptorTest.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.stomp;
+
+import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
+import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor;
+import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
+import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
+import org.apache.felix.resolver.util.ArrayMap;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+@RunWith(value = Parameterized.class)
+public class StompPropertiesInterceptorTest extends StompTestBase {
+
+ @Parameterized.Parameters(name = "{0}")
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}});
+ }
+
+ @Override
+ public List<String> getIncomingInterceptors() {
+ List<String> stompIncomingInterceptor = new ArrayList<>();
+ stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompPropertiesInterceptorTest$StompFramePropertiesInterceptor");
+ return stompIncomingInterceptor;
+ }
+
+ @Override
+ public List<String> getOutgoingInterceptors() {
+ List<String> stompOutgoingInterceptor = new ArrayList<>();
+ stompOutgoingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompPropertiesInterceptorTest$StompFramePropertiesInterceptor");
+
+ return stompOutgoingInterceptor;
+ }
+
+ public static class StompFramePropertiesInterceptor implements StompFrameInterceptor {
+
+ @Override
+ public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
+ if (stompFrame.getCommand().equals("CONNECT") || stompFrame.getCommand().equals("CONNECTED")) {
+ return true;
+ }
+ System.out.println("Checking properties in interceptor");
+ assertNotNull(stompFrame);
+ assertEquals(stompFrame.getHeader(MY_HEADER), expectedProperties.get(MY_HEADER));
+ assertEquals(stompFrame.getBody(), expectedProperties.get(MESSAGE_TEXT));
+ return true;
+ }
+ }
+
+
+ private static final String MESSAGE_TEXT = "messageText";
+ private static final String MY_HEADER = "my-header";
+ private static Map<String, Object> expectedProperties = new ArrayMap<>();
+
+ @Test(timeout = 60000)
+ public void testCheckInterceptedStompMessageProperties() throws Exception {
+ final String msgText = "Test intercepted message";
+ final String myHeader = "TestInterceptedHeader";
+ expectedProperties.put(MESSAGE_TEXT, msgText);
+ expectedProperties.put(MY_HEADER, myHeader);
+
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+ conn.connect(defUser, defPass);
+
+ ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
+
+ subFrame.addHeader("subscription-type", "ANYCAST");
+ subFrame.addHeader("destination", name.getMethodName());
+ subFrame.addHeader("ack", "auto");
+ subFrame.addHeader(MY_HEADER, myHeader);
+ subFrame.setBody(msgText);
+
+ conn.sendFrame(subFrame);
+
+ ClientStompFrame frame = conn.createFrame("SEND");
+ frame.addHeader("destination", name.getMethodName());
+ frame.addHeader("ack", "auto");
+ frame.addHeader(MY_HEADER, myHeader);
+ conn.sendFrame(frame);
+
+ conn.disconnect();
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestPropertiesInterceptor.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestPropertiesInterceptor.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestPropertiesInterceptor.java
deleted file mode 100644
index 62fa1b5..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestPropertiesInterceptor.java
+++ /dev/null
@@ -1,108 +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.stomp;
-
-import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
-import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor;
-import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
-import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
-import org.apache.felix.resolver.util.ArrayMap;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-@RunWith(value = Parameterized.class)
-public class StompTestPropertiesInterceptor extends StompTestBase {
-
- @Parameterized.Parameters(name = "{0}")
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][]{{"ws+v12.stomp"}, {"tcp+v12.stomp"}});
- }
-
- @Override
- public List<String> getIncomingInterceptors() {
- List<String> stompIncomingInterceptor = new ArrayList<>();
- stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompTestPropertiesInterceptor$StompFramePropertiesInterceptor");
- return stompIncomingInterceptor;
- }
-
- @Override
- public List<String> getOutgoingInterceptors() {
- List<String> stompOutgoingInterceptor = new ArrayList<>();
- stompOutgoingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompTestPropertiesInterceptor$StompFramePropertiesInterceptor");
-
- return stompOutgoingInterceptor;
- }
-
- public static class StompFramePropertiesInterceptor implements StompFrameInterceptor {
-
- @Override
- public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
- if (stompFrame.getCommand().equals("CONNECT") || stompFrame.getCommand().equals("CONNECTED")) {
- return true;
- }
- System.out.println("Checking properties in interceptor");
- assertNotNull(stompFrame);
- assertEquals(stompFrame.getHeader(MY_HEADER), expectedProperties.get(MY_HEADER));
- assertEquals(stompFrame.getBody(), expectedProperties.get(MESSAGE_TEXT));
- return true;
- }
- }
-
-
- private static final String MESSAGE_TEXT = "messageText";
- private static final String MY_HEADER = "my-header";
- private static Map<String, Object> expectedProperties = new ArrayMap<>();
-
- @Test(timeout = 60000)
- public void testCheckInterceptedStompMessageProperties() throws Exception {
- final String msgText = "Test intercepted message";
- final String myHeader = "TestInterceptedHeader";
- expectedProperties.put(MESSAGE_TEXT, msgText);
- expectedProperties.put(MY_HEADER, myHeader);
-
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
- conn.connect(defUser, defPass);
-
- ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
-
- subFrame.addHeader("subscription-type", "ANYCAST");
- subFrame.addHeader("destination", name.getMethodName());
- subFrame.addHeader("ack", "auto");
- subFrame.addHeader(MY_HEADER, myHeader);
- subFrame.setBody(msgText);
-
- conn.sendFrame(subFrame);
-
- ClientStompFrame frame = conn.createFrame("SEND");
- frame.addHeader("destination", name.getMethodName());
- frame.addHeader("ack", "auto");
- frame.addHeader(MY_HEADER, myHeader);
- conn.sendFrame(frame);
-
- conn.disconnect();
-
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithInterceptors.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithInterceptors.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithInterceptors.java
deleted file mode 100644
index b4e2217..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithInterceptors.java
+++ /dev/null
@@ -1,166 +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.stomp;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.activemq.artemis.api.core.Interceptor;
-import org.apache.activemq.artemis.core.protocol.core.Packet;
-import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
-import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor;
-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.util.ClientStompFrame;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
-import org.apache.activemq.artemis.tests.util.Wait;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class StompTestWithInterceptors extends StompTestBase {
-
- @Override
- public List<String> getIncomingInterceptors() {
- List<String> stompIncomingInterceptor = new ArrayList<>();
- stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompTestWithInterceptors$MyIncomingStompFrameInterceptor");
- stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompTestWithInterceptors$MyCoreInterceptor");
-
- return stompIncomingInterceptor;
- }
-
- @Override
- public List<String> getOutgoingInterceptors() {
- List<String> stompOutgoingInterceptor = new ArrayList<>();
- stompOutgoingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompTestWithInterceptors$MyOutgoingStompFrameInterceptor");
-
- return stompOutgoingInterceptor;
- }
-
- @Test
- public void stompFrameInterceptor() throws Exception {
- MyIncomingStompFrameInterceptor.incomingInterceptedFrames.clear();
- MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.clear();
-
- Thread.sleep(200);
-
- // So we clear them here
- MyCoreInterceptor.incomingInterceptedFrames.clear();
-
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
- conn.connect(defUser, defPass);
-
- ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
- subFrame.addHeader("subscription-type", "ANYCAST");
- subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- subFrame.addHeader("ack", "auto");
- conn.sendFrame(subFrame);
-
- assertEquals(0, MyCoreInterceptor.incomingInterceptedFrames.size());
- sendJmsMessage(getName());
-
- // Something was supposed to be called on sendMessages
- assertTrue("core interceptor is not working", MyCoreInterceptor.incomingInterceptedFrames.size() > 0);
-
- conn.receiveFrame(10000);
-
- ClientStompFrame frame = conn.createFrame("SEND");
- frame.addHeader("destination", getQueuePrefix() + getQueueName());
- frame.setBody("Hello World");
- conn.sendFrame(frame);
-
- conn.disconnect();
-
- List<String> incomingCommands = new ArrayList<>(4);
- incomingCommands.add("CONNECT");
- incomingCommands.add("SUBSCRIBE");
- incomingCommands.add("SEND");
- incomingCommands.add("DISCONNECT");
-
- List<String> outgoingCommands = new ArrayList<>(3);
- outgoingCommands.add("CONNECTED");
- outgoingCommands.add("MESSAGE");
- outgoingCommands.add("MESSAGE");
-
- long timeout = System.currentTimeMillis() + 1000;
-
- // Things are async, giving some time to things arrive before we actually assert
- while (MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size() < 4 &&
- MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size() < 3 &&
- timeout > System.currentTimeMillis()) {
- Thread.sleep(10);
- }
-
- Wait.waitFor(() -> {
- return MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size() == 4;
- });
- Assert.assertEquals(4, MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size());
- Wait.waitFor(() -> {
- return MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size() == 3;
- });
- Assert.assertEquals(3, MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size());
-
- for (int i = 0; i < MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size(); i++) {
- Assert.assertEquals(incomingCommands.get(i), MyIncomingStompFrameInterceptor.incomingInterceptedFrames.get(i).getCommand());
- Assert.assertEquals("incomingInterceptedVal", MyIncomingStompFrameInterceptor.incomingInterceptedFrames.get(i).getHeader("incomingInterceptedProp"));
- }
-
- for (int i = 0; i < MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size(); i++) {
- Assert.assertEquals(outgoingCommands.get(i), MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(i).getCommand());
- }
-
- Assert.assertEquals("incomingInterceptedVal", MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(2).getHeader("incomingInterceptedProp"));
- Assert.assertEquals("outgoingInterceptedVal", MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(2).getHeader("outgoingInterceptedProp"));
- }
-
- public static class MyCoreInterceptor implements Interceptor {
-
- static List<Packet> incomingInterceptedFrames = new ArrayList<>();
-
- @Override
- public boolean intercept(Packet packet, RemotingConnection connection) {
- IntegrationTestLogger.LOGGER.info("Core intercepted: " + packet);
- incomingInterceptedFrames.add(packet);
- return true;
- }
- }
-
- public static class MyIncomingStompFrameInterceptor implements StompFrameInterceptor {
-
- static List<StompFrame> incomingInterceptedFrames = new ArrayList<>();
-
- @Override
- public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
- incomingInterceptedFrames.add(stompFrame);
- stompFrame.addHeader("incomingInterceptedProp", "incomingInterceptedVal");
- return true;
- }
- }
-
- public static class MyOutgoingStompFrameInterceptor implements StompFrameInterceptor {
-
- static List<StompFrame> outgoingInterceptedFrames = new ArrayList<>();
-
- @Override
- public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
- outgoingInterceptedFrames.add(stompFrame);
- stompFrame.addHeader("outgoingInterceptedProp", "outgoingInterceptedVal");
- 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/stomp/StompTestWithLargeMessages.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithLargeMessages.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithLargeMessages.java
deleted file mode 100644
index 89eefdc..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithLargeMessages.java
+++ /dev/null
@@ -1,466 +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.stomp;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.activemq.artemis.api.core.RoutingType;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
-import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
-import org.apache.activemq.artemis.tests.integration.largemessage.LargeMessageTestBase;
-import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-@RunWith(Parameterized.class)
-@Ignore
-public class StompTestWithLargeMessages extends StompTestBase {
-
- // Web Socket has max frame size of 64kb. Large message tests only available over TCP.
- @Parameterized.Parameters(name = "{0}")
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][]{{"tcp+v10.stomp"}, {"tcp+v12.stomp"}});
- }
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- public boolean isCompressLargeMessages() {
- return true;
- }
-
- @Override
- public boolean isPersistenceEnabled() {
- return true;
- }
-
- @Override
- public Integer getStompMinLargeMessageSize() {
- return 2048;
- }
-
- @Test
- public void testSendReceiveLargeMessage() throws Exception {
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
-
- String address = "testLargeMessageAddress";
- server.getActiveMQServer().createQueue(SimpleString.toSimpleString(address), RoutingType.ANYCAST, SimpleString.toSimpleString(address), null, true, false);
-
- // STOMP default is UTF-8 == 1 byte per char.
- int largeMessageStringSize = 10 * 1024 * 1024; // 10MB
- StringBuilder b = new StringBuilder(largeMessageStringSize);
- for (int i = 0; i < largeMessageStringSize; i++) {
- b.append('t');
- }
- String payload = b.toString();
-
- // Set up STOMP subscription
- conn.connect(defUser, defPass);
- subscribe(conn, null, Stomp.Headers.Subscribe.AckModeValues.AUTO, null, null, address, true);
-
- // Send Large Message
- System.out.println("Sending Message Size: " + largeMessageStringSize);
- send(conn, address, null, payload);
-
- // Receive STOMP Message
- ClientStompFrame frame = conn.receiveFrame();
- System.out.println(frame.getBody().length());
- assertTrue(frame.getBody().equals(payload));
- }
-
- //stomp sender -> large -> stomp receiver
- @Test
- public void testSendReceiveLargePersistentMessages() throws Exception {
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
- conn.connect(defUser, defPass);
-
- int count = 10;
- int msgSize = 1024 * 1024;
- char[] contents = new char[msgSize];
- for (int i = 0; i < msgSize; i++) {
- contents[i] = 'A';
- }
- String body = new String(contents);
-
- for (int i = 0; i < count; i++) {
- ClientStompFrame frame = conn.createFrame("SEND");
- frame.addHeader("destination", getQueuePrefix() + getQueueName());
- frame.addHeader("persistent", "true");
- frame.setBody(body);
- conn.sendFrame(frame);
- }
-
- ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
- subFrame.addHeader("subscription-type", "ANYCAST");
- subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- subFrame.addHeader("ack", "auto");
- conn.sendFrame(subFrame);
-
- for (int i = 0; i < count; i++) {
- ClientStompFrame frame = conn.receiveFrame(60000);
- Assert.assertNotNull(frame);
- System.out.println("part of frame: " + frame.getBody().substring(0, 200));
- Assert.assertTrue(frame.getCommand().equals("MESSAGE"));
- Assert.assertTrue(frame.getHeader("destination").equals(getQueuePrefix() + getQueueName()));
- int index = frame.getBody().indexOf("AAAA");
- assertEquals(msgSize, (frame.getBody().length() - index));
- }
-
- ClientStompFrame unsubFrame = conn.createFrame("UNSUBSCRIBE");
- unsubFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- unsubFrame.addHeader("receipt", "567");
- ClientStompFrame response = conn.sendFrame(unsubFrame);
- assertNotNull(response);
- assertNotNull(response.getCommand().equals("RECEIPT"));
-
- conn.disconnect();
- }
-
- //core sender -> large -> stomp receiver
- @Test
- public void testReceiveLargePersistentMessagesFromCore() throws Exception {
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
- conn.connect(defUser, defPass);
-
- int msgSize = 3 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
- char[] contents = new char[msgSize];
- for (int i = 0; i < msgSize; i++) {
- contents[i] = 'B';
- }
- String msg = new String(contents);
-
- int count = 10;
- for (int i = 0; i < count; i++) {
- this.sendJmsMessage(msg);
- }
-
- ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
- subFrame.addHeader("subscription-type", "ANYCAST");
- subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- subFrame.addHeader("ack", "auto");
- conn.sendFrame(subFrame);
-
- for (int i = 0; i < count; i++) {
- ClientStompFrame frame = conn.receiveFrame(60000);
- Assert.assertNotNull(frame);
- System.out.println("part of frame: " + frame.getBody().substring(0, 200));
- Assert.assertTrue(frame.getCommand().equals("MESSAGE"));
- Assert.assertTrue(frame.getHeader("destination").equals(getQueuePrefix() + getQueueName()));
- int index = frame.getBody().indexOf("BBB");
- assertEquals(msgSize, (frame.getBody().length() - index));
- }
-
- ClientStompFrame unsubFrame = conn.createFrame("UNSUBSCRIBE");
- unsubFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- unsubFrame.addHeader("receipt", "567");
- ClientStompFrame response = conn.sendFrame(unsubFrame);
- assertNotNull(response);
- assertNotNull(response.getCommand().equals("RECEIPT"));
-
- conn.disconnect();
- }
-
-// //stomp v12 sender -> large -> stomp v12 receiver
-// @Test
-// public void testSendReceiveLargePersistentMessagesV12() throws Exception {
-// StompClientConnection connV12 = StompClientConnectionFactory.createClientConnection("1.2", "localhost", port);
-// connV12.connect(defUser, defPass);
-//
-// int count = 10;
-// int szBody = 1024 * 1024;
-// char[] contents = new char[szBody];
-// for (int i = 0; i < szBody; i++) {
-// contents[i] = 'A';
-// }
-// String body = new String(contents);
-//
-// ClientStompFrame frame = connV12.createFrame("SEND");
-// frame.addHeader("destination-type", "ANYCAST");
-// frame.addHeader("destination", getQueuePrefix() + getQueueName());
-// frame.addHeader("persistent", "true");
-// frame.setBody(body);
-//
-// for (int i = 0; i < count; i++) {
-// connV12.sendFrame(frame);
-// }
-//
-// ClientStompFrame subFrame = connV12.createFrame("SUBSCRIBE");
-// subFrame.addHeader("id", "a-sub");
-// subFrame.addHeader("subscription-type", "ANYCAST");
-// subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
-// subFrame.addHeader("ack", "auto");
-//
-// connV12.sendFrame(subFrame);
-//
-// for (int i = 0; i < count; i++) {
-// ClientStompFrame receiveFrame = connV12.receiveFrame(30000);
-//
-// Assert.assertNotNull(receiveFrame);
-// System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 20));
-// Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
-// Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
-// assertEquals(szBody, receiveFrame.getBody().length());
-// }
-//
-// // remove susbcription
-// ClientStompFrame unsubFrame = connV12.createFrame("UNSUBSCRIBE");
-// unsubFrame.addHeader("id", "a-sub");
-// connV12.sendFrame(unsubFrame);
-//
-// connV12.disconnect();
-// }
-//
-// //core sender -> large -> stomp v12 receiver
-// @Test
-// public void testReceiveLargePersistentMessagesFromCoreV12() throws Exception {
-// int msgSize = 3 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
-// char[] contents = new char[msgSize];
-// for (int i = 0; i < msgSize; i++) {
-// contents[i] = 'B';
-// }
-// String msg = new String(contents);
-//
-// int count = 10;
-// for (int i = 0; i < count; i++) {
-// this.sendJmsMessage(msg);
-// }
-//
-// StompClientConnection connV12 = StompClientConnectionFactory.createClientConnection("1.2", "localhost", port);
-// connV12.connect(defUser, defPass);
-//
-// ClientStompFrame subFrame = connV12.createFrame("SUBSCRIBE");
-// subFrame.addHeader("id", "a-sub");
-// subFrame.addHeader("subscription-type", "ANYCAST");
-// subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
-// subFrame.addHeader("ack", "auto");
-// connV12.sendFrame(subFrame);
-//
-// for (int i = 0; i < count; i++) {
-// ClientStompFrame receiveFrame = connV12.receiveFrame(30000);
-//
-// Assert.assertNotNull(receiveFrame);
-// System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 20));
-// Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
-// Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
-// assertEquals(msgSize, receiveFrame.getBody().length());
-// }
-//
-// // remove susbcription
-// ClientStompFrame unsubFrame = connV12.createFrame("UNSUBSCRIBE");
-// unsubFrame.addHeader("id", "a-sub");
-// connV12.sendFrame(unsubFrame);
-//
-// connV12.disconnect();
-// }
-
- //core sender -> large (compressed regular) -> stomp v10 receiver
- @Test
- public void testReceiveLargeCompressedToRegularPersistentMessagesFromCore() throws Exception {
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
- conn.connect(defUser, defPass);
-
- LargeMessageTestBase.TestLargeMessageInputStream input = new LargeMessageTestBase.TestLargeMessageInputStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, true);
- LargeMessageTestBase.adjustLargeCompression(true, input, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
-
- char[] contents = input.toArray();
- String msg = new String(contents);
-
- String leadingPart = msg.substring(0, 100);
-
- int count = 10;
- for (int i = 0; i < count; i++) {
- this.sendJmsMessage(msg);
- }
-
- ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
- subFrame.addHeader("subscription-type", "ANYCAST");
- subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- subFrame.addHeader("ack", "auto");
- conn.sendFrame(subFrame);
-
- for (int i = 0; i < count; i++) {
- ClientStompFrame receiveFrame = conn.receiveFrame(30000);
- Assert.assertNotNull(receiveFrame);
- System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 250));
- Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
- Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
- int index = receiveFrame.getBody().indexOf(leadingPart);
- assertEquals(msg.length(), (receiveFrame.getBody().length() - index));
- }
-
- // remove suscription
- ClientStompFrame unsubFrame = conn.createFrame("UNSUBSCRIBE");
- unsubFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- unsubFrame.addHeader("receipt", "567");
- ClientStompFrame response = conn.sendFrame(unsubFrame);
- assertNotNull(response);
- assertNotNull(response.getCommand().equals("RECEIPT"));
-
- conn.disconnect();
- }
-
-// //core sender -> large (compressed regular) -> stomp v12 receiver
-// @Test
-// public void testReceiveLargeCompressedToRegularPersistentMessagesFromCoreV12() throws Exception {
-// LargeMessageTestBase.TestLargeMessageInputStream input = new LargeMessageTestBase.TestLargeMessageInputStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, true);
-// LargeMessageTestBase.adjustLargeCompression(true, input, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
-//
-// char[] contents = input.toArray();
-// String msg = new String(contents);
-//
-// int count = 10;
-// for (int i = 0; i < count; i++) {
-// this.sendJmsMessage(msg);
-// }
-//
-// StompClientConnection connV12 = StompClientConnectionFactory.createClientConnection("1.2", "localhost", port);
-// connV12.connect(defUser, defPass);
-//
-// ClientStompFrame subFrame = connV12.createFrame("SUBSCRIBE");
-// subFrame.addHeader("id", "a-sub");
-// subFrame.addHeader("subscription-type", "ANYCAST");
-// subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
-// subFrame.addHeader("ack", "auto");
-//
-// connV12.sendFrame(subFrame);
-//
-// for (int i = 0; i < count; i++) {
-// ClientStompFrame receiveFrame = connV12.receiveFrame(30000);
-//
-// Assert.assertNotNull(receiveFrame);
-// System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 20));
-// Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
-// Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
-// assertEquals(contents.length, receiveFrame.getBody().length());
-// }
-//
-// // remove susbcription
-// ClientStompFrame unsubFrame = connV12.createFrame("UNSUBSCRIBE");
-// unsubFrame.addHeader("id", "a-sub");
-// connV12.sendFrame(unsubFrame);
-//
-// connV12.disconnect();
-// }
-//
-// //core sender -> large (compressed large) -> stomp v12 receiver
-// @Test
-// public void testReceiveLargeCompressedToLargePersistentMessagesFromCoreV12() throws Exception {
-// LargeMessageTestBase.TestLargeMessageInputStream input = new LargeMessageTestBase.TestLargeMessageInputStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, true);
-// input.setSize(10 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
-// LargeMessageTestBase.adjustLargeCompression(false, input, 10 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
-//
-// char[] contents = input.toArray();
-// String msg = new String(contents);
-//
-// int count = 10;
-// for (int i = 0; i < count; i++) {
-// this.sendJmsMessage(msg);
-// }
-//
-// IntegrationTestLogger.LOGGER.info("Message count for " + getQueueName() + ": " + server.getActiveMQServer().locateQueue(SimpleString.toSimpleString(getQueueName())).getMessageCount());
-//
-// StompClientConnection connV12 = StompClientConnectionFactory.createClientConnection("1.2", hostname, port);
-// connV12.connect(defUser, defPass);
-//
-// ClientStompFrame subFrame = connV12.createFrame("SUBSCRIBE");
-// subFrame.addHeader("id", "a-sub");
-// subFrame.addHeader("subscription-type", "ANYCAST");
-// subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
-// subFrame.addHeader("ack", "auto");
-//
-// connV12.sendFrame(subFrame);
-//
-// for (int i = 0; i < count; i++) {
-// ClientStompFrame receiveFrame = connV12.receiveFrame(30000);
-//
-// Assert.assertNotNull(receiveFrame);
-// System.out.println("part of frame: " + receiveFrame.getBody().substring(0, 20));
-// Assert.assertTrue(receiveFrame.getCommand().equals("MESSAGE"));
-// Assert.assertEquals(receiveFrame.getHeader("destination"), getQueuePrefix() + getQueueName());
-// assertEquals(contents.length, receiveFrame.getBody().length());
-// }
-//
-// // remove susbcription
-// ClientStompFrame unsubFrame = connV12.createFrame("UNSUBSCRIBE");
-// unsubFrame.addHeader("id", "a-sub");
-// connV12.sendFrame(unsubFrame);
-//
-// connV12.disconnect();
-// }
-
- //core sender -> large (compressed large) -> stomp v10 receiver
- @Test
- public void testReceiveLargeCompressedToLargePersistentMessagesFromCore() throws Exception {
-
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
- try {
- LargeMessageTestBase.TestLargeMessageInputStream input = new LargeMessageTestBase.TestLargeMessageInputStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, true);
- input.setSize(10 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
- LargeMessageTestBase.adjustLargeCompression(false, input, 10 * ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
-
- char[] contents = input.toArray();
- String msg = new String(contents);
-
- String leadingPart = msg.substring(0, 100);
-
- int count = 10;
- for (int i = 0; i < count; i++) {
- this.sendJmsMessage(msg);
- }
-
- conn.connect(defUser, defPass);
-
- ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
- subFrame.addHeader("subscription-type", "ANYCAST");
- subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- subFrame.addHeader("ack", "auto");
- conn.sendFrame(subFrame);
-
- for (int i = 0; i < count; i++) {
- ClientStompFrame frame = conn.receiveFrame(60000);
- Assert.assertNotNull(frame);
- System.out.println(frame.toString());
- System.out.println("part of frame: " + frame.getBody().substring(0, 250));
- Assert.assertTrue(frame.getCommand().equals("MESSAGE"));
- Assert.assertTrue(frame.getHeader("destination").equals(getQueuePrefix() + getQueueName()));
- int index = frame.getBody().toString().indexOf(leadingPart);
- assertEquals(msg.length(), (frame.getBody().toString().length() - index));
- }
-
- ClientStompFrame unsubFrame = conn.createFrame("UNSUBSCRIBE");
- unsubFrame.addHeader("destination", getQueuePrefix() + getQueueName());
- unsubFrame.addHeader("receipt", "567");
- conn.sendFrame(unsubFrame);
- } finally {
- conn.disconnect();
- conn.closeTransport();
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithMessageID.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithMessageID.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithMessageID.java
deleted file mode 100644
index a82df0d..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithMessageID.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.stomp;
-
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.QueueBrowser;
-import javax.jms.TextMessage;
-import java.util.Enumeration;
-
-import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class StompTestWithMessageID extends StompTestBase {
-
- @Override
- public boolean isEnableStompMessageId() {
- return true;
- }
-
- @Test
- public void testEnableMessageID() throws Exception {
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
- conn.connect(defUser, defPass);
-
- ClientStompFrame frame = conn.createFrame("SEND");
- frame.addHeader("destination", getQueuePrefix() + getQueueName());
- frame.setBody("Hello World 1");
- conn.sendFrame(frame);
-
- frame = conn.createFrame("SEND");
- frame.addHeader("destination", getQueuePrefix() + getQueueName());
- frame.setBody("Hello World 2");
- conn.sendFrame(frame);
-
- QueueBrowser browser = session.createBrowser(queue);
-
- Enumeration enu = browser.getEnumeration();
-
- while (enu.hasMoreElements()) {
- Message msg = (Message) enu.nextElement();
- String msgId = msg.getStringProperty("amqMessageId");
- assertNotNull(msgId);
- assertTrue(msgId.indexOf("STOMP") == 0);
- }
-
- browser.close();
-
- MessageConsumer consumer = session.createConsumer(queue);
-
- TextMessage message = (TextMessage) consumer.receive(1000);
- Assert.assertNotNull(message);
-
- message = (TextMessage) consumer.receive(1000);
- Assert.assertNotNull(message);
-
- message = (TextMessage) consumer.receive(2000);
- Assert.assertNull(message);
-
- conn.disconnect();
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithSecurity.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithSecurity.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithSecurity.java
deleted file mode 100644
index ead1522..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestWithSecurity.java
+++ /dev/null
@@ -1,64 +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.stomp;
-
-import javax.jms.MessageConsumer;
-import javax.jms.TextMessage;
-
-import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
-import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class StompTestWithSecurity extends StompTestBase {
-
- @Override
- public boolean isSecurityEnabled() {
- return true;
- }
-
- @Test
- public void testJMSXUserID() throws Exception {
- server.getActiveMQServer().getConfiguration().setPopulateValidatedUser(true);
-
- MessageConsumer consumer = session.createConsumer(queue);
-
- StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
- conn.connect(defUser, defPass);
-
- ClientStompFrame frame = conn.createFrame("SEND");
- frame.addHeader("destination", getQueuePrefix() + getQueueName());
- frame.setBody("Hello World");
- conn.sendFrame(frame);
-
- conn.disconnect();
-
- TextMessage message = (TextMessage) consumer.receive(1000);
- Assert.assertNotNull(message);
- Assert.assertEquals("Hello World", message.getText());
- // Assert default priority 4 is used when priority header is not set
- Assert.assertEquals("getJMSPriority", 4, message.getJMSPriority());
- Assert.assertEquals("JMSXUserID", "brianm", message.getStringProperty("JMSXUserID"));
-
- // Make sure that the timestamp is valid - should
- // be very close to the current time.
- long tnow = System.currentTimeMillis();
- long tmsg = message.getJMSTimestamp();
- Assert.assertTrue(Math.abs(tnow - tmsg) < 1000);
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/aa730fda/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithInterceptorsTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithInterceptorsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithInterceptorsTest.java
new file mode 100644
index 0000000..f795ad3
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithInterceptorsTest.java
@@ -0,0 +1,166 @@
+/**
+ * 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.stomp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.activemq.artemis.api.core.Interceptor;
+import org.apache.activemq.artemis.core.protocol.core.Packet;
+import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
+import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor;
+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.util.ClientStompFrame;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
+import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
+import org.apache.activemq.artemis.tests.util.Wait;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StompWithInterceptorsTest extends StompTestBase {
+
+ @Override
+ public List<String> getIncomingInterceptors() {
+ List<String> stompIncomingInterceptor = new ArrayList<>();
+ stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$MyIncomingStompFrameInterceptor");
+ stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$MyCoreInterceptor");
+
+ return stompIncomingInterceptor;
+ }
+
+ @Override
+ public List<String> getOutgoingInterceptors() {
+ List<String> stompOutgoingInterceptor = new ArrayList<>();
+ stompOutgoingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$MyOutgoingStompFrameInterceptor");
+
+ return stompOutgoingInterceptor;
+ }
+
+ @Test
+ public void stompFrameInterceptor() throws Exception {
+ MyIncomingStompFrameInterceptor.incomingInterceptedFrames.clear();
+ MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.clear();
+
+ Thread.sleep(200);
+
+ // So we clear them here
+ MyCoreInterceptor.incomingInterceptedFrames.clear();
+
+ StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
+ conn.connect(defUser, defPass);
+
+ ClientStompFrame subFrame = conn.createFrame("SUBSCRIBE");
+ subFrame.addHeader("subscription-type", "ANYCAST");
+ subFrame.addHeader("destination", getQueuePrefix() + getQueueName());
+ subFrame.addHeader("ack", "auto");
+ conn.sendFrame(subFrame);
+
+ assertEquals(0, MyCoreInterceptor.incomingInterceptedFrames.size());
+ sendJmsMessage(getName());
+
+ // Something was supposed to be called on sendMessages
+ assertTrue("core interceptor is not working", MyCoreInterceptor.incomingInterceptedFrames.size() > 0);
+
+ conn.receiveFrame(10000);
+
+ ClientStompFrame frame = conn.createFrame("SEND");
+ frame.addHeader("destination", getQueuePrefix() + getQueueName());
+ frame.setBody("Hello World");
+ conn.sendFrame(frame);
+
+ conn.disconnect();
+
+ List<String> incomingCommands = new ArrayList<>(4);
+ incomingCommands.add("CONNECT");
+ incomingCommands.add("SUBSCRIBE");
+ incomingCommands.add("SEND");
+ incomingCommands.add("DISCONNECT");
+
+ List<String> outgoingCommands = new ArrayList<>(3);
+ outgoingCommands.add("CONNECTED");
+ outgoingCommands.add("MESSAGE");
+ outgoingCommands.add("MESSAGE");
+
+ long timeout = System.currentTimeMillis() + 1000;
+
+ // Things are async, giving some time to things arrive before we actually assert
+ while (MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size() < 4 &&
+ MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size() < 3 &&
+ timeout > System.currentTimeMillis()) {
+ Thread.sleep(10);
+ }
+
+ Wait.waitFor(() -> {
+ return MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size() == 4;
+ });
+ Assert.assertEquals(4, MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size());
+ Wait.waitFor(() -> {
+ return MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size() == 3;
+ });
+ Assert.assertEquals(3, MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size());
+
+ for (int i = 0; i < MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size(); i++) {
+ Assert.assertEquals(incomingCommands.get(i), MyIncomingStompFrameInterceptor.incomingInterceptedFrames.get(i).getCommand());
+ Assert.assertEquals("incomingInterceptedVal", MyIncomingStompFrameInterceptor.incomingInterceptedFrames.get(i).getHeader("incomingInterceptedProp"));
+ }
+
+ for (int i = 0; i < MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size(); i++) {
+ Assert.assertEquals(outgoingCommands.get(i), MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(i).getCommand());
+ }
+
+ Assert.assertEquals("incomingInterceptedVal", MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(2).getHeader("incomingInterceptedProp"));
+ Assert.assertEquals("outgoingInterceptedVal", MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(2).getHeader("outgoingInterceptedProp"));
+ }
+
+ public static class MyCoreInterceptor implements Interceptor {
+
+ static List<Packet> incomingInterceptedFrames = new ArrayList<>();
+
+ @Override
+ public boolean intercept(Packet packet, RemotingConnection connection) {
+ IntegrationTestLogger.LOGGER.info("Core intercepted: " + packet);
+ incomingInterceptedFrames.add(packet);
+ return true;
+ }
+ }
+
+ public static class MyIncomingStompFrameInterceptor implements StompFrameInterceptor {
+
+ static List<StompFrame> incomingInterceptedFrames = new ArrayList<>();
+
+ @Override
+ public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
+ incomingInterceptedFrames.add(stompFrame);
+ stompFrame.addHeader("incomingInterceptedProp", "incomingInterceptedVal");
+ return true;
+ }
+ }
+
+ public static class MyOutgoingStompFrameInterceptor implements StompFrameInterceptor {
+
+ static List<StompFrame> outgoingInterceptedFrames = new ArrayList<>();
+
+ @Override
+ public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
+ outgoingInterceptedFrames.add(stompFrame);
+ stompFrame.addHeader("outgoingInterceptedProp", "outgoingInterceptedVal");
+ return true;
+ }
+ }
+}
[5/6] activemq-artemis git commit: ARTEMIS-1532 Enable tests which
are unintentionally skipped by Surefire
Posted by cl...@apache.org.
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 <jd...@redhat.com>
Authored: Sun Dec 3 19:44:58 2017 +0100
Committer: Clebert Suconic <cl...@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"));
+ }
+ }
+}
[6/6] activemq-artemis git commit: This closes #1683
Posted by cl...@apache.org.
This closes #1683
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/43b72759
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/43b72759
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/43b72759
Branch: refs/heads/master
Commit: 43b72759e50dc5618189a30f1e0edad8dc092523
Parents: f7ea0d7 b17cec0
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Dec 20 16:06:23 2017 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Dec 20 16:06:23 2017 -0500
----------------------------------------------------------------------
.../config/ConfigUsingDestinationOptions.java | 73 ---
.../ConfigUsingDestinationOptionsTest.java | 76 +++
.../client/ConsumerWindowSizeTest.java | 13 +-
.../distribution/ClusteredGroupingTest.java | 1 +
.../ClusteredRequestResponseTest.java | 5 +-
.../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 +++++
.../integration/jms/client/PreACKJMSTest.java | 5 +-
.../CloseConnectionFactoryOnGCTest.java | 64 +++
.../CloseConnectionFactoryOnGCest.java | 62 ---
.../openwire/SimpleOpenWireTest.java | 4 +-
.../ra/OutgoingConnectionJTATest.java | 256 ++++++++++
.../ra/OutgoingConnectionNoJTATest.java | 280 +++++++++++
.../ra/OutgoingConnectionTestJTA.java | 256 ----------
.../ra/OutgoingConnectionTestNoJTA.java | 271 -----------
.../integration/security/SecurityTest.java | 7 +-
.../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 +++
.../jms/tests/selector/SelectorTest.java | 5 +-
.../group/impl/SystemPropertyOverrideTest.java | 2 +
34 files changed, 2070 insertions(+), 2038 deletions(-)
----------------------------------------------------------------------
[2/6] activemq-artemis git commit: ARTEMIS-1532 Fix
OutgoingConnectionNoJTATest
Posted by cl...@apache.org.
ARTEMIS-1532 Fix OutgoingConnectionNoJTATest
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/62280c88
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/62280c88
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/62280c88
Branch: refs/heads/master
Commit: 62280c88dc2fce0fdaded6ba8cb98c77c9ae873b
Parents: aa730fd
Author: Jiri Danek <jd...@redhat.com>
Authored: Sun Dec 3 19:56:47 2017 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Dec 20 16:06:22 2017 -0500
----------------------------------------------------------------------
.../ra/OutgoingConnectionNoJTATest.java | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/62280c88/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
index d18bf76..2cc129f 100644
--- 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
@@ -38,6 +38,7 @@ import org.junit.Test;
import javax.jms.Connection;
import javax.jms.JMSContext;
import javax.jms.JMSProducer;
+import javax.jms.JMSRuntimeException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
@@ -192,14 +193,22 @@ public class OutgoingConnectionNoJTATest extends ActiveMQRATestBase {
}
@Test
- public void sessionTransactedTestNoActiveJTATx() throws Exception {
- JMSContext context = qraConnectionFactory.createContext(JMSContext.SESSION_TRANSACTED);
+ public void sessionNotTransactedTestNoActiveJTATx() throws Exception {
+ JMSContext context = qraConnectionFactory.createContext(JMSContext.AUTO_ACKNOWLEDGE);
assertEquals(context.getSessionMode(), JMSContext.AUTO_ACKNOWLEDGE);
}
+ @Test
+ public void sessionTransactedTestNoActiveJTATx() throws Exception {
+ try {
+ qraConnectionFactory.createContext(JMSContext.SESSION_TRANSACTED);
+ fail("Exception expected");
+ } catch (JMSRuntimeException ignored) {
+ }
+ }
@Test
- public void testQueuSessionAckMode() throws Exception {
+ public void testQueueSessionAckMode() throws Exception {
QueueConnection queueConnection = qraConnectionFactory.createQueueConnection();
@@ -216,7 +225,7 @@ public class OutgoingConnectionNoJTATest extends ActiveMQRATestBase {
try (ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession();
- ClientConsumer consVerify = session.createConsumer("jms.queue." + MDBQUEUE);
+ ClientConsumer consVerify = session.createConsumer(MDBQUEUE);
JMSContext jmsctx = qraConnectionFactory.createContext();
) {
session.start();
@@ -252,7 +261,7 @@ public class OutgoingConnectionNoJTATest extends ActiveMQRATestBase {
Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE);
try (ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession();
- ClientConsumer consVerify = session.createConsumer("jms.queue." + MDBQUEUE);
+ ClientConsumer consVerify = session.createConsumer(MDBQUEUE);
Connection conn = qraConnectionFactory.createConnection();
) {
Session jmsSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);