jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r585463 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs: AbstractFileSystemTest.java db/ db/DerbyFileSystemTest.java local/ local/LocalFileSystemTest.java
Date Wed, 17 Oct 2007 12:40:02 GMT
Author: jukka
Date: Wed Oct 17 05:40:01 2007
New Revision: 585463

URL: http://svn.apache.org/viewvc?rev=585463&view=rev
Log:
JCR-1175: Test cases for all FileSystem implementations
    - Added tests for LocalFileSystem and DerbyFileSystem
    - TODO: Test failures!

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/db/
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystemTest.java
      - copied, changed from r585438, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystemTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/local/
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/local/LocalFileSystemTest.java
      - copied, changed from r585438, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystemTest.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/AbstractFileSystemTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/AbstractFileSystemTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/AbstractFileSystemTest.java?rev=585463&r1=585462&r2=585463&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/AbstractFileSystemTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/AbstractFileSystemTest.java
Wed Oct 17 05:40:01 2007
@@ -31,14 +31,14 @@
     private FileSystem fs;
     private byte[] sampleBytes = new byte[]{(byte)0x12, (byte)0x0F, (byte)0xF0};
 
-    protected abstract FileSystem getFileSystem() throws Exception;
+    protected abstract FileSystem getFileSystem();
 
     protected void setUp() throws Exception {
         fs = getFileSystem();
         fs.init();
     }
 
-    protected void tearDown() throws FileSystemException {
+    protected void tearDown() throws Exception {
         fs.close();
     }
 

Copied: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystemTest.java
(from r585438, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystemTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystemTest.java?p2=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystemTest.java&p1=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystemTest.java&r1=585438&r2=585463&rev=585463&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystemTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystemTest.java
Wed Oct 17 05:40:01 2007
@@ -14,15 +14,41 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.core.fs.mem;
+package org.apache.jackrabbit.core.fs.db;
+
+import java.io.File;
+import java.io.IOException;
 
 import org.apache.jackrabbit.core.fs.AbstractFileSystemTest;
 import org.apache.jackrabbit.core.fs.FileSystem;
 
-public class MemoryFileSystemTest extends AbstractFileSystemTest {
+public class DerbyFileSystemTest extends AbstractFileSystemTest {
+
+    private File file;
 
     protected FileSystem getFileSystem() {
-        return new MemoryFileSystem();
+        DerbyFileSystem filesystem = new DerbyFileSystem();
+        filesystem.setUrl("jdbc:derby:" + file.getPath() + ";create=true");
+        return filesystem;
+    }
+
+    protected void setUp() throws Exception {
+        file = File.createTempFile("jackrabbit", "derbyfs");
+        file.delete();
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        delete(file);
+    }
+
+    private void delete(File file) throws IOException {
+        File[] files = file.listFiles();
+        for (int i = 0; files != null && i < files.length; i++) {
+            delete(files[i]);
+        }
+        file.delete();
     }
 
 }

Copied: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/local/LocalFileSystemTest.java
(from r585438, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystemTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/local/LocalFileSystemTest.java?p2=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/local/LocalFileSystemTest.java&p1=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystemTest.java&r1=585438&r2=585463&rev=585463&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystemTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/fs/local/LocalFileSystemTest.java
Wed Oct 17 05:40:01 2007
@@ -14,15 +14,41 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.core.fs.mem;
+package org.apache.jackrabbit.core.fs.local;
+
+import java.io.File;
+import java.io.IOException;
 
 import org.apache.jackrabbit.core.fs.AbstractFileSystemTest;
 import org.apache.jackrabbit.core.fs.FileSystem;
 
-public class MemoryFileSystemTest extends AbstractFileSystemTest {
+public class LocalFileSystemTest extends AbstractFileSystemTest {
+
+    private File file;
 
     protected FileSystem getFileSystem() {
-        return new MemoryFileSystem();
+        LocalFileSystem filesystem = new LocalFileSystem();
+        filesystem.setPath(file.getPath());
+        return filesystem;
+    }
+
+    protected void setUp() throws Exception {
+        file = File.createTempFile("jackrabbit", "localfs");
+        file.delete();
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        delete(file);
+    }
+
+    private void delete(File file) throws IOException {
+        File[] files = file.listFiles();
+        for (int i = 0; files != null && i < files.length; i++) {
+            delete(files[i]);
+        }
+        file.delete();
     }
 
 }



Mime
View raw message