activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject [1/5] activemq git commit: use a bytes message, I think default encoding may the the root cause of variation of message size and limit checks on ci boxes
Date Thu, 22 Jan 2015 14:14:10 GMT
Repository: activemq
Updated Branches:
  refs/heads/trunk b53d8ea29 -> 35115fece


use a bytes message, I think default encoding may the the root cause of variation of message
size and limit checks on ci boxes


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

Branch: refs/heads/trunk
Commit: 35115fece7c0f5c6c8c4af8b45b811d1710b9c9d
Parents: 2166265
Author: gtully <gary.tully@gmail.com>
Authored: Thu Jan 22 14:12:47 2015 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Thu Jan 22 14:13:32 2015 +0000

----------------------------------------------------------------------
 .../org/apache/activemq/usecases/MemoryLimitTest.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/35115fec/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
index 3f0ea77..49026bd 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
@@ -17,6 +17,7 @@
 package org.apache.activemq.usecases;
 
 import java.util.Arrays;
+import javax.jms.BytesMessage;
 import javax.jms.Connection;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
@@ -44,7 +45,7 @@ import org.slf4j.LoggerFactory;
 @RunWith(value = Parameterized.class)
 public class MemoryLimitTest extends TestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(MemoryLimitTest.class);
-    final String payload = new String(new byte[10 * 1024]); //10KB
+    final byte[] payload = new byte[10 * 1024]; //10KB
     protected BrokerService broker;
 
     @Parameterized.Parameter
@@ -104,7 +105,9 @@ public class MemoryLimitTest extends TestSupport {
         final ProducerThread producer = new ProducerThread(sess, queue) {
             @Override
             protected Message createMessage(int i) throws Exception {
-                return sess.createTextMessage(payload + "::" + i);
+                BytesMessage bytesMessage = sess.createBytesMessage();
+                bytesMessage.writeBytes(payload);
+                return bytesMessage;
             }
         };
         producer.setMessageCount(2000);
@@ -132,12 +135,12 @@ public class MemoryLimitTest extends TestSupport {
             @Override
             public boolean isSatisified() throws Exception {
                 LOG.info("Destination usage: " + dest.getMemoryUsage());
-                return dest.getMemoryUsage().getPercentUsage() >= 470;
+                return dest.getMemoryUsage().getPercentUsage() >= 200;
             }
         }));
 
         LOG.info("Broker usage: " + broker.getSystemUsage().getMemoryUsage());
-        assertTrue(broker.getSystemUsage().getMemoryUsage().getPercentUsage() >= 470);
+        assertTrue(broker.getSystemUsage().getMemoryUsage().getPercentUsage() >= 200);
 
         // let's make sure we can consume all messages
         for (int i = 1; i < 2000; i++) {


Mime
View raw message