jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1235675 - /jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
Date Wed, 25 Jan 2012 08:24:50 GMT
Author: thomasm
Date: Wed Jan 25 08:24:49 2012
New Revision: 1235675

URL: http://svn.apache.org/viewvc?rev=1235675&view=rev
Log:
Write-behind cache

Modified:
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java?rev=1235675&r1=1235674&r2=1235675&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
Wed Jan 25 08:24:49 2012
@@ -88,6 +88,7 @@ public class FileSystemTest extends Test
     }
 
     private void testFileSystem(String fsBase) throws Exception {
+        testAppend(fsBase);
         testDirectories(fsBase);
         testMoveTo(fsBase);
         testParentEventuallyReturnsNull(fsBase);
@@ -99,6 +100,32 @@ public class FileSystemTest extends Test
         testUnsupportedFeatures(fsBase);
     }
 
+    public void testAppend(String fsBase) throws IOException {
+        String fileName = fsBase + "/testFile.txt";
+        if (FileUtils.exists(fileName)) {
+            FileUtils.delete(fileName);
+        }
+        FileUtils.createDirectories(FileUtils.getParent(fileName));
+        FileUtils.createFile(fileName);
+        // Profiler prof = new Profiler();
+        // prof.interval = 1;
+        // prof.startCollecting();
+        FileChannel c = FileUtils.open(fileName, "rw");
+        c.position(0);
+        // long t = System.currentTimeMillis();
+        byte[] array = new byte[100];
+        ByteBuffer buff = ByteBuffer.wrap(array);
+        for (int i = 0; i < 100000; i++) {
+            array[0] = (byte) i;
+            c.write(buff);
+            buff.rewind();
+        }
+        c.close();
+        // System.out.println(fsBase + ": " + (System.currentTimeMillis() - t));
+        // System.out.println(prof.getTop(10));
+        FileUtils.delete(fileName);
+    }
+
     private void testDirectories(String fsBase) throws IOException {
         final String fileName = fsBase + "/testFile";
         if (FileUtils.exists(fileName)) {



Mime
View raw message