activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r908618 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java
Date Wed, 10 Feb 2010 18:15:25 GMT
Author: gtully
Date: Wed Feb 10 18:15:16 2010
New Revision: 908618

URL: http://svn.apache.org/viewvc?rev=908618&view=rev
Log:
exercise all unicode for byte array stream write/readUTF to validate 

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java?rev=908618&r1=908617&r2=908618&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java
Wed Feb 10 18:15:16 2010
@@ -26,14 +26,40 @@
     public void testNonAscii() throws Exception {
         doMarshallUnMarshallValidation("meißen");
         
+        String accumulator = new String();
+        
         int test = 0; // int to get Supplementary chars
         while(Character.isDefined(test)) {
-            doMarshallUnMarshallValidation(String.valueOf((char)test));
+            String toTest = String.valueOf((char)test);
+            accumulator += toTest;
+            doMarshallUnMarshallValidation(toTest);
             test++;
         }
         
         int massiveThreeByteCharValue = 0x0FFF;
+        String toTest = String.valueOf((char)massiveThreeByteCharValue);
+        accumulator += toTest;
         doMarshallUnMarshallValidation(String.valueOf((char)massiveThreeByteCharValue));
+        
+        // Altogether
+        doMarshallUnMarshallValidation(accumulator);
+        
+        // the three byte values
+        char t = '\u0800';
+        final char max =  '\uffff';
+        accumulator = String.valueOf(t);
+        while (t < max) {
+            String val = String.valueOf(t);
+            accumulator += val;
+            doMarshallUnMarshallValidation(val);
+            t++;
+        }
+        
+        // Altogether so long as it is not too big
+        while (accumulator.length() > 20000) {
+            accumulator = accumulator.substring(20000);
+        }
+        doMarshallUnMarshallValidation(accumulator);
     }
     
     void doMarshallUnMarshallValidation(String value) throws Exception {        



Mime
View raw message