jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asm...@apache.org
Subject svn commit: r780804 - /jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/block/BlockDiskUnitTest.java
Date Mon, 01 Jun 2009 20:05:46 GMT
Author: asmuts
Date: Mon Jun  1 20:05:46 2009
New Revision: 780804

URL: http://svn.apache.org/viewvc?rev=780804&view=rev
Log:
adding more skip tests

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

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=780804&r1=780803&r2=780804&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 20:05:46 2009
@@ -245,4 +245,80 @@
         // byte arrays encur some bytes of serialization overhead.
         return blockSize * numBlocks - ( numBlocks * BlockDisk.HEADER_SIZE_BYTES ) - ( numBlocks
* 14 );
     }
+
+    /**
+     * Verify that the block disk can handle a big string.
+     * <p>
+     * @throws Exception
+     */
+    public void SKIP_testWriteAndRead_BigString()
+        throws Exception
+    {
+        // SETUP
+        String fileName = "testWriteAndRead_BigString";
+        File file = new File( rafDir, fileName + ".data" );
+        file.delete();
+        int blockSizeBytes = 4096;//1024;
+        BlockDisk disk = new BlockDisk( file, blockSizeBytes, new StandardSerializer() );
       
+
+        String string = "This is my big string ABCDEFGH";
+        StringBuffer sb = new StringBuffer();
+        sb.append( string );
+        for ( int i = 0; i < 8; i++ )
+        {
+            sb.append( " " + i + sb.toString() ); // big string
+        }
+        string = sb.toString();
+
+        // DO WORK
+        int[] blocks = disk.write( string );
+        String result = (String) disk.read( blocks );
+
+        // VERIFY
+        System.out.println( string );
+        System.out.println( result );
+        System.out.println( disk );        
+        assertEquals( "Wrong item retured.", string, result );
+    }
+    
+    /**
+     * Verify that the block disk can handle a big string.
+     * <p>
+     * @throws Exception
+     */
+    public void SKIP_testWriteAndRead_BigString2()
+        throws Exception
+    {
+        System.setProperty("file.encoding", "UTF-8");
+
+        // SETUP
+        String fileName = "testWriteAndRead_BigString";
+        File file = new File( rafDir, fileName + ".data" );
+        file.delete();
+        int blockSizeBytes = 47;//4096;//1024;
+        BlockDisk disk = new BlockDisk( file, blockSizeBytes, new StandardSerializer() );
       
+
+        String string = "abcdefghijklmnopqrstuvwxyz1234567890";
+        string += string;
+        string += string;
+
+
+        // DO WORK
+        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 );        
+        assertEquals( "Wrong item retured.", string, result );
+    }    
 }



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


Mime
View raw message