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:35 UTC
[3/6] activemq-artemis git commit: ARTEMIS-1532 Enable tests which
are unintentionally skipped by Surefire
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";