You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/07/02 14:19:55 UTC

svn commit: r418586 - /directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java

Author: elecharny
Date: Sun Jul  2 05:19:55 2006
New Revision: 418586

URL: http://svn.apache.org/viewvc?rev=418586&view=rev
Log:
Fixed a bug in Ldif tests : I was using /tmp to store temporary jpeg
files, and obviously this was not good on Windows...

Modified:
    directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java

Modified: directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java?rev=418586&r1=418585&r2=418586&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java (original)
+++ directory/branches/shared/optimization/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java Sun Jul  2 05:19:55 2006
@@ -40,11 +40,14 @@
 public class LdifReaderTest extends TestCase
 {
     private byte[] data;
-
+    
+    private static File HJENSEN_JPEG_FILE = null;
+    private static File FIONA_JPEG_FILE = null;
+    
     private File createFile( String name, byte[] data ) throws IOException
     {
-        File jpeg = new File( "/tmp/" + name );
-
+        File jpeg = File.createTempFile( name, "jpg" );
+        
         jpeg.createNewFile();
 
         DataOutputStream os = new DataOutputStream( new FileOutputStream( jpeg ) );
@@ -73,8 +76,8 @@
             data[i] = (byte) i;
         }
 
-        createFile( "hjensen.jpg", data );
-        createFile( "fiona.jpg", data );
+        HJENSEN_JPEG_FILE = createFile( "hjensen", data );
+        FIONA_JPEG_FILE = createFile( "fiona", data );
     }
 
     public void testLdifNull() throws NamingException
@@ -924,7 +927,7 @@
             "sn: Jensen\n" + 
             "uid: hjensen\n" + 
             "telephonenumber: +1 408 555 1212\n" + 
-            "jpegphoto:< file:///tmp/hjensen.jpg";
+            "jpegphoto:< file:" + HJENSEN_JPEG_FILE.getAbsolutePath() + "\n";
 
         LdifReader reader = new LdifReader();
         List entries = reader.parseLdif( ldif );
@@ -989,7 +992,7 @@
             "sn: Jensen\n" + 
             "uid: hjensen\n" + 
             "telephonenumber: +1 408 555 1212\n" + 
-            "jpegphoto:< file:///tmp/hjensen.jpg";
+            "jpegphoto:< file:" + HJENSEN_JPEG_FILE.getAbsolutePath() + "\n";
 
         LdifReader reader = new LdifReader();
         reader.setSizeLimit( 128 );
@@ -1020,7 +1023,7 @@
             "sn: Jensen\n" +
             "uid: fiona\n" +
             "telephonenumber: +1 408 555 1212\n" +
-            "jpegphoto:< file:///tmp/fiona.jpg\n" +
+            "jpegphoto:< file:"  + FIONA_JPEG_FILE.getAbsolutePath() + "\n" +
             "\n" +
             // Second entry modification : DELETE
             "# Delete an existing entry\n" +