jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r723281 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/directory/DirectoryManagerTest.java
Date Thu, 04 Dec 2008 10:38:08 GMT
Author: mreutegg
Date: Thu Dec  4 02:38:07 2008
New Revision: 723281

URL: http://svn.apache.org/viewvc?rev=723281&view=rev
Log:
JCR-1747: org.apache.jackrabbit.core.query.lucene.SearchIndex with in-memory lucene index
- test fails on second run

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/directory/DirectoryManagerTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/directory/DirectoryManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/directory/DirectoryManagerTest.java?rev=723281&r1=723280&r2=723281&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/directory/DirectoryManagerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/directory/DirectoryManagerTest.java
Thu Dec  4 02:38:07 2008
@@ -37,15 +37,24 @@
 
     private static final SearchIndex INDEX = new SearchIndex();
 
+    private static final String TEST = "test";
+
+    private static final String RENAMED = "renamed";
+
     static {
         INDEX.setPath(new File(new File("target"), "directory-factory-test").getAbsolutePath());
     }
 
+    protected void tearDown() throws Exception {
+        new File(INDEX.getPath(), TEST).delete();
+        new File(INDEX.getPath(), RENAMED).delete();
+    }
+
     public void testHasDirectory() throws Exception {
         execute(new Callable(){
             public void call(DirectoryManager directoryManager) throws Exception {
-                Directory dir = directoryManager.getDirectory("test");
-                assertTrue(directoryManager.hasDirectory("test"));
+                Directory dir = directoryManager.getDirectory(TEST);
+                assertTrue(directoryManager.hasDirectory(TEST));
                 dir.close();
             }
         });
@@ -54,9 +63,9 @@
     public void testDelete() throws Exception {
         execute(new Callable(){
             public void call(DirectoryManager directoryManager) throws Exception {
-                directoryManager.getDirectory("test").close();
-                directoryManager.delete("test");
-                assertFalse(directoryManager.hasDirectory("test"));
+                directoryManager.getDirectory(TEST).close();
+                directoryManager.delete(TEST);
+                assertFalse(directoryManager.hasDirectory(TEST));
             }
         });
     }
@@ -64,8 +73,8 @@
     public void testGetDirectoryNames() throws Exception {
         execute(new Callable(){
             public void call(DirectoryManager directoryManager) throws Exception {
-                directoryManager.getDirectory("test").close();
-                assertTrue(Arrays.asList(directoryManager.getDirectoryNames()).contains("test"));
+                directoryManager.getDirectory(TEST).close();
+                assertTrue(Arrays.asList(directoryManager.getDirectoryNames()).contains(TEST));
             }
         });
     }
@@ -73,10 +82,10 @@
     public void testRename() throws Exception {
         execute(new Callable(){
             public void call(DirectoryManager directoryManager) throws Exception {
-                directoryManager.getDirectory("test").close();
-                directoryManager.rename("test", "renamed");
-                assertTrue(directoryManager.hasDirectory("renamed"));
-                assertFalse(directoryManager.hasDirectory("test"));
+                directoryManager.getDirectory(TEST).close();
+                directoryManager.rename(TEST, RENAMED);
+                assertTrue(directoryManager.hasDirectory(RENAMED));
+                assertFalse(directoryManager.hasDirectory(TEST));
             }
         });
     }



Mime
View raw message