directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1551493 - in /directory/mavibot/trunk/mavibot/src: main/java/org/apache/directory/mavibot/btree/ test/java/org/apache/directory/mavibot/btree/
Date Tue, 17 Dec 2013 09:24:18 GMT
Author: elecharny
Date: Tue Dec 17 09:24:18 2013
New Revision: 1551493

URL: http://svn.apache.org/r1551493
Log:
Added some cleanup in tests

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBulkDataSorterTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
Tue Dec 17 09:24:18 2013
@@ -33,6 +33,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
 
+import net.sf.ehcache.Status;
+
 import org.apache.directory.mavibot.btree.exception.BTreeAlreadyManagedException;
 import org.apache.directory.mavibot.btree.exception.EndOfFileExceededException;
 import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeTest.java
Tue Dec 17 09:24:18 2013
@@ -923,6 +923,8 @@ public class InMemoryBTreeTest
 
         assertFalse( btree.hasKey( 0 ) );
         assertFalse( btree.hasKey( 21 ) );
+        
+        btree.close();
     }
 
 
@@ -1041,6 +1043,7 @@ public class InMemoryBTreeTest
 
         TupleCursor<Integer, String> cursor = btree.browseFrom( 11 );
         assertFalse( cursor.hasNext() );
+        
         btree.close();
     }
 
@@ -1737,6 +1740,8 @@ public class InMemoryBTreeTest
 
         assertNotNull( deleted );
         assertNull( deleted.getValue() );
+        
+        btree.close();
     }
 
 
@@ -1944,6 +1949,7 @@ public class InMemoryBTreeTest
         tuple = cursor.next();
         assertEquals( Integer.valueOf( 4 ), tuple.getKey() );
         assertEquals( Integer.valueOf( 4 ), tuple.getValue() );
+        
         cursor.close();
         btree.close();
     }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBulkDataSorterTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBulkDataSorterTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBulkDataSorterTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBulkDataSorterTest.java
Tue Dec 17 09:24:18 2013
@@ -143,6 +143,7 @@ public class InMemoryBulkDataSorterTest
         Iterator<Tuple<Integer, Integer>> itr = bds.getMergeSortedTuples();
 
         Integer prev = null;
+        
         while ( itr.hasNext() )
         {
             Tuple<Integer, Integer> t = itr.next();

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
Tue Dec 17 09:24:18 2013
@@ -31,6 +31,7 @@ import java.io.IOException;
 import java.util.NoSuchElementException;
 import java.util.UUID;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.directory.mavibot.btree.BTree;
 import org.apache.directory.mavibot.btree.RecordManager;
 import org.apache.directory.mavibot.btree.Tuple;
@@ -39,6 +40,7 @@ import org.apache.directory.mavibot.btre
 import org.apache.directory.mavibot.btree.exception.EndOfFileExceededException;
 import org.apache.directory.mavibot.btree.serializer.LongSerializer;
 import org.apache.directory.mavibot.btree.serializer.StringSerializer;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -82,6 +84,20 @@ public class PersistedBTreeBrowseTest
             throw new RuntimeException( e );
         }
     }
+    
+    
+    @After
+    public void cleanup() throws IOException
+    {
+        dataDir = new File( System.getProperty( "java.io.tmpdir" ) + "/recordman" );
+        
+        btree.close();
+
+        if ( dataDir.exists() )
+        {
+            FileUtils.deleteDirectory( dataDir );
+        }
+    }
 
 
     /**

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java
Tue Dec 17 09:24:18 2013
@@ -27,6 +27,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.directory.mavibot.btree.BTree;
 import org.apache.directory.mavibot.btree.PersistedBTreeBuilder;
 import org.apache.directory.mavibot.btree.RecordManager;
@@ -91,5 +92,4 @@ public class PersistedBTreeBuilderTest
         cursor.close();
         btree.close();
     }
-
 }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java
Tue Dec 17 09:24:18 2013
@@ -32,6 +32,7 @@ import java.io.IOException;
 import java.util.NoSuchElementException;
 import java.util.UUID;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.directory.mavibot.btree.BTree;
 import org.apache.directory.mavibot.btree.PersistedBTree;
 import org.apache.directory.mavibot.btree.RecordManager;
@@ -40,6 +41,7 @@ import org.apache.directory.mavibot.btre
 import org.apache.directory.mavibot.btree.serializer.IntSerializer;
 import org.apache.directory.mavibot.btree.serializer.LongSerializer;
 import org.apache.directory.mavibot.btree.serializer.StringSerializer;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -80,6 +82,20 @@ public class PersistedBTreeDuplicateKeyT
             throw new RuntimeException( e );
         }
     }
+    
+    
+    @After
+    public void cleanup() throws IOException
+    {
+        dataDir = new File( System.getProperty( "java.io.tmpdir" ) + "/recordman" );
+        
+        btree.close();
+
+        if ( dataDir.exists() )
+        {
+            FileUtils.deleteDirectory( dataDir );
+        }
+    }
 
     
     private void openRecordManagerAndBtree()

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java
Tue Dec 17 09:24:18 2013
@@ -116,6 +116,8 @@ public class PersistedReadTest
 
         // Read it back
         readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 20 );
+        
+        recordManager.close();
     }
 
 
@@ -226,6 +228,8 @@ public class PersistedReadTest
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 20 );
+        
+        recordManager.close();
     }
 
 
@@ -350,5 +354,7 @@ public class PersistedReadTest
         {
             assertEquals( i + 1, readBytes.get() );
         }
+        
+        recordManager.close();
     }
 }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java
Tue Dec 17 09:24:18 2013
@@ -128,6 +128,8 @@ public class PersistedStoreTest
         assertEquals( 0x34, pageIos[1].getData().get( pos++ ) );
         assertEquals( 0x56, pageIos[1].getData().get( pos++ ) );
         assertEquals( 0x78, pageIos[1].getData().get( pos++ ) );
+        
+        recordManager.close();
     }
 
 
@@ -304,6 +306,8 @@ public class PersistedStoreTest
         assertEquals( ( byte ) 0xAB, pageIos[1].getData().get( pos++ ) );
         assertEquals( ( byte ) 0xCD, pageIos[1].getData().get( pos++ ) );
         assertEquals( ( byte ) 0xEF, pageIos[1].getData().get( pos++ ) );
+        
+        recordManager.close();
     }
 
 
@@ -440,6 +444,7 @@ public class PersistedStoreTest
 
         // The data in the second page
         pos = 8;
+        
         for ( int i = 14; i < 38; i++ )
         {
             assertEquals( ( byte ) ( i + 1 ), pageIos[1].getData().get( pos++ ) );
@@ -447,6 +452,7 @@ public class PersistedStoreTest
 
         // The data in the third page
         pos = 8;
+        
         for ( int i = 38; i < 62; i++ )
         {
             assertEquals( ( byte ) ( i + 1 ), pageIos[2].getData().get( pos++ ) );
@@ -454,9 +460,12 @@ public class PersistedStoreTest
 
         // The data in the forth page
         pos = 8;
+        
         for ( int i = 62; i < 80; i++ )
         {
             assertEquals( ( byte ) ( i + 1 ), pageIos[3].getData().get( pos++ ) );
         }
+        
+        recordManager.close();
     }
 }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
Tue Dec 17 09:24:18 2013
@@ -91,6 +91,8 @@ public class RecordManagerFreePageTest
         {
             FileUtils.deleteDirectory( dataDir );
         }
+        
+        recordManager1.close();
     }
 
 

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
Tue Dec 17 09:24:18 2013
@@ -34,6 +34,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.directory.mavibot.btree.BTree;
 import org.apache.directory.mavibot.btree.PersistedBTree;
 import org.apache.directory.mavibot.btree.RecordManager;
@@ -44,6 +45,7 @@ import org.apache.directory.mavibot.btre
 import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;
 import org.apache.directory.mavibot.btree.serializer.LongSerializer;
 import org.apache.directory.mavibot.btree.serializer.StringSerializer;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Rule;
@@ -85,6 +87,18 @@ public class RecordManagerTest
             throw new RuntimeException( e );
         }
     }
+    
+    
+    @After
+    public void cleanup() throws IOException
+    {
+        btree.close();
+
+        if ( dataDir.exists() )
+        {
+            FileUtils.deleteDirectory( dataDir );
+        }
+    }
 
 
     private void openRecordManagerAndBtree()

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java?rev=1551493&r1=1551492&r2=1551493&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java
Tue Dec 17 09:24:18 2013
@@ -29,12 +29,14 @@ import java.io.IOException;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.directory.mavibot.btree.BTree;
 import org.apache.directory.mavibot.btree.RecordManager;
 import org.apache.directory.mavibot.btree.exception.BTreeAlreadyManagedException;
 import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;
 import org.apache.directory.mavibot.btree.serializer.LongSerializer;
 import org.apache.directory.mavibot.btree.serializer.StringSerializer;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -75,6 +77,18 @@ public class RecordManagerWithDuplicates
             throw new RuntimeException( e );
         }
     }
+    
+    
+    @After
+    public void cleanup() throws IOException
+    {
+        btree.close();
+
+        if ( dataDir.exists() )
+        {
+            FileUtils.deleteDirectory( dataDir );
+        }
+    }
 
 
     private void openRecordManagerAndBtree()



Mime
View raw message