directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1512443 - in /directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree: BTreeConfigurationTest.java BTreeFlushTest.java ReadTest.java StoreTest.java util/BulkDataSorterTest.java
Date Fri, 09 Aug 2013 18:52:38 GMT
Author: seelmann
Date: Fri Aug  9 18:52:37 2013
New Revision: 1512443

URL: http://svn.apache.org/r1512443
Log:
Use TemporaryFolder rule for all test, should solve build issues on Windows.

Modified:
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeConfigurationTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeFlushTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/ReadTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/StoreTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/util/BulkDataSorterTest.java

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeConfigurationTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeConfigurationTest.java?rev=1512443&r1=1512442&r2=1512443&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeConfigurationTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeConfigurationTest.java
Fri Aug  9 18:52:37 2013
@@ -28,7 +28,9 @@ import java.io.IOException;
 import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;
 import org.apache.directory.mavibot.btree.serializer.IntSerializer;
 import org.apache.directory.mavibot.btree.serializer.StringSerializer;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 
 /**
@@ -38,6 +40,9 @@ import org.junit.Test;
  */
 public class BTreeConfigurationTest
 {
+    @Rule
+    public TemporaryFolder tempFolder = new TemporaryFolder();
+
     // Some values to inject in a btree
     private static int[] sortedValues = new int[]
         {
@@ -170,8 +175,7 @@ public class BTreeConfigurationTest
     public void testConfigurationFlushReload() throws IOException, KeyNotFoundException
     {
         // Create a temporary file
-        File file = File.createTempFile( "testFlush", "data" );
-        file.deleteOnExit();
+        File file = tempFolder.newFile( "testFlush.data" );
         String parent = file.getParent();
 
         try

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeFlushTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeFlushTest.java?rev=1512443&r1=1512442&r2=1512443&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeFlushTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeFlushTest.java
Fri Aug  9 18:52:37 2013
@@ -33,7 +33,9 @@ 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.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 
 /**
@@ -43,6 +45,9 @@ import org.junit.Test;
  */
 public class BTreeFlushTest
 {
+    @Rule
+    public TemporaryFolder tempFolder = new TemporaryFolder();
+
     // Some values to inject in a btree
     private static int[] sortedValues = new int[]
         {
@@ -165,8 +170,7 @@ public class BTreeFlushTest
 
         // Now, flush the btree
 
-        File tempFile = File.createTempFile( "mavibot", ".tmp" );
-        tempFile.deleteOnExit();
+        File tempFile = tempFolder.newFile( "mavibot.tmp" );
 
         long t0 = System.currentTimeMillis();
 
@@ -212,10 +216,7 @@ public class BTreeFlushTest
     public void testFlushBTree() throws Exception
     {
         // Create a BTree with pages containing 8 elements
-        // Create the file, it will be deleted on exit
-        File tempFile = File.createTempFile( "testFlush", null );
-        String path = tempFile.getParent();
-        tempFile.delete();
+        String path = tempFolder.getRoot().getCanonicalPath();
 
         BTree<Integer, String> btree = new BTree<Integer, String>( "test", path,
new IntSerializer(),
             new StringSerializer() );

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/ReadTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/ReadTest.java?rev=1512443&r1=1512442&r2=1512443&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/ReadTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/ReadTest.java
Fri Aug  9 18:52:37 2013
@@ -27,7 +27,9 @@ import java.io.File;
 import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 
 /**
@@ -37,15 +39,17 @@ import org.junit.Test;
  */
 public class ReadTest
 {
+    @Rule
+    public TemporaryFolder tempFolder = new TemporaryFolder();
+
     /**
      * Test the readInt method
      */
     @Test
     public void testReadInt() throws Exception
     {
-        File tempFile = File.createTempFile( "mavibot", ".db" );
+        File tempFile = tempFolder.newFile( "mavibot.db" );
         String tempFileName = tempFile.getAbsolutePath();
-        tempFile.deleteOnExit();
 
         // Create page size of 32 only
         RecordManager recordManager = new RecordManager( tempFileName, 32 );
@@ -118,9 +122,8 @@ public class ReadTest
     @Test
     public void testReadLong() throws Exception
     {
-        File tempFile = File.createTempFile( "mavibot", ".db" );
+        File tempFile = tempFolder.newFile( "mavibot.db" );
         String tempFileName = tempFile.getAbsolutePath();
-        tempFile.deleteOnExit();
 
         // Create page size of 32 only
         RecordManager recordManager = new RecordManager( tempFileName, 32 );
@@ -229,9 +232,8 @@ public class ReadTest
     @Test
     public void testReadBytes() throws Exception
     {
-        File tempFile = File.createTempFile( "mavibot", ".db" );
+        File tempFile = tempFolder.newFile( "mavibot.db" );
         String tempFileName = tempFile.getAbsolutePath();
-        tempFile.deleteOnExit();
 
         // We use smaller pages
         RecordManager recordManager = new RecordManager( tempFileName, 32 );

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/StoreTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/StoreTest.java?rev=1512443&r1=1512442&r2=1512443&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/StoreTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/StoreTest.java
Fri Aug  9 18:52:37 2013
@@ -26,7 +26,9 @@ import java.io.File;
 import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 
 /**
@@ -36,15 +38,17 @@ import org.junit.Test;
  */
 public class StoreTest
 {
+    @Rule
+    public TemporaryFolder tempFolder = new TemporaryFolder();
+
     /**
      * Test the store( int ) method
      */
     @Test
     public void testInjectInt() throws Exception
     {
-        File tempFile = File.createTempFile( "mavibot", ".db" );
+        File tempFile = tempFolder.newFile( "mavibot.db" );
         String tempFileName = tempFile.getAbsolutePath();
-        tempFile.deleteOnExit();
 
         RecordManager recordManager = new RecordManager( tempFileName, 4 * 1024 );
         Method method = RecordManager.class.getDeclaredMethod( "store", long.class, int.class,
PageIO[].class );
@@ -131,9 +135,8 @@ public class StoreTest
     @Test
     public void testInjectLong() throws Exception
     {
-        File tempFile = File.createTempFile( "mavibot", ".db" );
+        File tempFile = tempFolder.newFile( "mavibot.db" );
         String tempFileName = tempFile.getAbsolutePath();
-        tempFile.deleteOnExit();
 
         RecordManager recordManager = new RecordManager( tempFileName, 4 * 1024 );
         Method method = RecordManager.class.getDeclaredMethod( "store", long.class, long.class,
PageIO[].class );
@@ -308,9 +311,8 @@ public class StoreTest
     @Test
     public void testInjectBytes() throws Exception
     {
-        File tempFile = File.createTempFile( "mavibot", ".db" );
+        File tempFile = tempFolder.newFile( "mavibot.db" );
         String tempFileName = tempFile.getAbsolutePath();
-        tempFile.deleteOnExit();
 
         // We use smaller pages
         RecordManager recordManager = new RecordManager( tempFileName, 32 );

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/util/BulkDataSorterTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/util/BulkDataSorterTest.java?rev=1512443&r1=1512442&r2=1512443&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/util/BulkDataSorterTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/util/BulkDataSorterTest.java
Fri Aug  9 18:52:37 2013
@@ -33,7 +33,9 @@ import java.util.Iterator;
 import java.util.Random;
 
 import org.apache.directory.mavibot.btree.Tuple;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 
 /**
@@ -43,6 +45,8 @@ import org.junit.Test;
  */
 public class BulkDataSorterTest
 {
+    @Rule
+    public TemporaryFolder tempFolder = new TemporaryFolder();
 
     private Comparator<Tuple<Integer, Integer>> tupleComp = new Comparator<Tuple<Integer,
Integer>>()
     {
@@ -62,8 +66,7 @@ public class BulkDataSorterTest
         IntTupleReaderWriter itrw = new IntTupleReaderWriter();
         Random random = new Random();
 
-        File dataFile = File.createTempFile( "tuple", ".data" );
-        dataFile.deleteOnExit();
+        File dataFile = tempFolder.newFile( "tuple.data" );
         DataOutputStream out = new DataOutputStream( new FileOutputStream( dataFile ) );
 
         Tuple<Integer, Integer>[] arr = ( Tuple<Integer, Integer>[] ) Array.newInstance(
Tuple.class, count );
@@ -108,8 +111,7 @@ public class BulkDataSorterTest
         IntTupleReaderWriter itrw = new IntTupleReaderWriter();
         Random random = new Random();
 
-        File dataFile = File.createTempFile( "tuple", ".data" );
-        dataFile.deleteOnExit();
+        File dataFile = tempFolder.newFile( "tuple.data" );
 
         DataOutputStream out = new DataOutputStream( new FileOutputStream( dataFile ) );
 



Mime
View raw message