activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/4] activemq-artemis git commit: ARTEMIS-1765 Adding StompWithLargeMessageTest
Date Thu, 22 Mar 2018 20:19:08 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 37657f22f -> fae3a8fad


ARTEMIS-1765 Adding StompWithLargeMessageTest

This closes #1965


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

Branch: refs/heads/master
Commit: 51f105da7b1d416bc42533895645e34c34d0371d
Parents: 552e4a2
Author: Howard Gao <howard.gao@gmail.com>
Authored: Thu Mar 22 12:24:39 2018 +0800
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Mar 22 16:06:37 2018 -0400

----------------------------------------------------------------------
 .../stomp/StompWithLargeMessagesTest.java       | 44 +++++++++++---------
 1 file changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/51f105da/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
index 38da2d2..eb515bd 100644
--- 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
@@ -69,29 +69,33 @@ public class StompWithLargeMessagesTest extends StompTestBase {
    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();
+      try {
+         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);
+         // 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);
+         // 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));
+         // Receive STOMP Message
+         ClientStompFrame frame = conn.receiveFrame();
+         System.out.println(frame.getBody().length());
+         assertTrue(frame.getBody().equals(payload));
+      } finally {
+         conn.disconnect();
+      }
    }
 
    //stomp sender -> large -> stomp receiver


Mime
View raw message