Author: asmuts
Date: Mon Jun  1 21:23:17 2009
New Revision: 780835

URL: http://svn.apache.org/viewvc?rev=780835&view=rev
Log:
Resolved bug JCS-56.  There was a problem in the chunking method.

Modified:
    
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java
    
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java
    
jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/StandardSerializerUnitTest.java

Modified: 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java?rev=780835&r1=780834&r2=780835&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java
 (original)
+++ 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskCacheUnitTest.java
 Mon Jun  1 21:23:17 2009
@@ -133,7 +133,7 @@
      * <p>
      * @throws Exception
      */
-    public void SKIP_testPutGet_BigString()
+    public void testPutGet_BigString()
         throws Exception
     {
         String string = "This is my big string ABCDEFGH";
@@ -174,7 +174,7 @@
      * <p>
      * @throws Exception
      */
-    public void SKIP_testUTF8String()
+    public void testUTF8String()
         throws Exception
     {
         String string = "Iñtërnâtiônàlizætiøn";
@@ -217,7 +217,7 @@
      * <p>
      * @throws Exception
      */
-    public void SKIP_testUTF8ByteArray()
+    public void testUTF8ByteArray()
         throws Exception
     {
         String string = "Iñtërnâtiônàlizætiøn";
@@ -249,7 +249,7 @@
         Thread.sleep( 1000 );
         ICacheElement afterElement = diskCache.get( "x" );
         assertNotNull( afterElement );
-        System.out.println( "afterElement = " + afterElement );
+        //System.out.println( "afterElement = " + afterElement );
         byte[] after = (byte[]) afterElement.getVal();
 
         assertNotNull( after );
@@ -264,7 +264,7 @@
      * <p>
      * @throws Exception
      */
-    public void SKIP_testUTF8StringAndBytes()
+    public void testUTF8StringAndBytes()
         throws Exception
     {
         X before = new X();

Modified: 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java?rev=780835&r1=780834&r2=780835&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java
 (original)
+++ 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java
 Mon Jun  1 21:23:17 2009
@@ -251,7 +251,7 @@
      * <p>
      * @throws Exception
      */
-    public void SKIP_testWriteAndRead_BigString()
+    public void testWriteAndRead_BigString()
         throws Exception
     {
         // SETUP
@@ -286,11 +286,9 @@
      * <p>
      * @throws Exception
      */
-    public void SKIP_testWriteAndRead_BigString2()
+    public void testWriteAndRead_BigString2()
         throws Exception
     {
-        System.setProperty("file.encoding", "UTF-8");
-
         // SETUP
         String fileName = "testWriteAndRead_BigString";
         File file = new File( rafDir, fileName + ".data" );
@@ -307,18 +305,7 @@
         int[] blocks = disk.write( string );
         String result = (String) disk.read( blocks );
 
-        // VERIFY
-        System.out.println( string );
-        System.out.println( result );
-        byte[] bytes = string.getBytes();
-        
-        for ( int i=0; i < bytes.length; i++)
-        {
-            int c = bytes[i];
-            System.out.println( c ); 
-            System.out.println( (char)c );        
-        }
-        System.out.println( disk );        
+        // VERIFY 
         assertEquals( "Wrong item retured.", string, result );
     }    
 }

Modified: 
jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/StandardSerializerUnitTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/StandardSerializerUnitTest.java?rev=780835&r1=780834&r2=780835&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/StandardSerializerUnitTest.java
 (original)
+++ 
jakarta/jcs/trunk/src/test/org/apache/jcs/utils/serialization/StandardSerializerUnitTest.java
 Mon Jun  1 21:23:17 2009
@@ -72,4 +72,31 @@
         // VERIFY
         assertNull( "Should have nothing.", after );
     }
+    
+    /**
+     * Test simple back and forth with a string.
+     *<p>
+     * @throws Exception
+     */
+    public void testBigStringBackAndForth()
+        throws Exception
+    {
+        // SETUP
+        StandardSerializer serializer = new StandardSerializer();
+
+        String string = "This is my big string ABCDEFGH";
+        StringBuffer sb = new StringBuffer();
+        sb.append( string );
+        for ( int i = 0; i < 4; i++ )
+        {
+            sb.append( " " + i + sb.toString() ); // big string
+        }
+        String before = sb.toString();
+
+        // DO WORK
+        String after = (String) serializer.deSerialize( serializer.serialize( 
before ) );
+
+        // VERIFY
+        assertEquals( "Before and after should be the same.", before, after );
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jcs-dev-h...@jakarta.apache.org

Reply via email to