[jboss-cvs] JBoss Messaging SVN: r5921 - trunk/tests/src/org/jboss/messaging/tests/unit/util.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 23 18:35:13 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-02-23 18:35:13 -0500 (Mon, 23 Feb 2009)
New Revision: 5921

Modified:
   trunk/tests/src/org/jboss/messaging/tests/unit/util/UTF8Test.java
Log:
test tweak

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/util/UTF8Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/util/UTF8Test.java	2009-02-23 20:09:31 UTC (rev 5920)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/util/UTF8Test.java	2009-02-23 23:35:13 UTC (rev 5921)
@@ -34,6 +34,7 @@
 import org.jboss.messaging.core.remoting.impl.ExpandingMessagingBuffer;
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.integration.transports.netty.ChannelBufferWrapper;
+import org.jboss.messaging.tests.util.RandomUtil;
 import org.jboss.messaging.util.DataConstants;
 import org.jboss.messaging.util.Random;
 import org.jboss.messaging.util.UTF8Util;
@@ -74,13 +75,15 @@
    {
       for (int i = 0; i < 100; i++)
       {
-         byte[] bytes = new byte[20000];
+         Random random = new Random();
 
-         Random random = new Random();
+         // Random size between 15k and 20K
+         byte[] bytes = new byte[15000 + RandomUtil.randomPositiveInt() % 5000];
+
          random.getRandom().nextBytes(bytes);
 
          String str = new String(bytes);
-
+         
          // The maximum size the encoded UTF string would reach is str.length * 3 (look at the UTF8 implementation)
          testValidateUTFOnDataInputStream(str, new ByteBufferWrapper(ByteBuffer.allocate(str.length() * 3 + DataConstants.SIZE_SHORT)));
 




More information about the jboss-cvs-commits mailing list