Emmanuel Lecharny schrieb:
Alex Karasulu a écrit :Ok, thanks for the overview. Since I am focused on getting something production-ish ready, I'll stick with 1.0-trunks for now. I've had some problems getting org.apache.directory.shared.ldap.ldif.LdifReaderTest.java to succeed: - the generated test files use the absolute path "/tmp/" as a prefix. This is fine on *nix, but fails on Windows, of course. - the file:// URLs have the same Problem, of course. - the UTF-8 used in the file doesn't seem to be recognized out of the box. This causes problems with three tests. I don't know whether this is a problem with maven, my setup, or Windows. Anyway: I converted two of them to use \uxxxx escapes, however there is still testLdifParserRFC2849Sample4() which I don't readily see how to convert, since eclipse doesn't display some characters (and I do have CJK fonts installed!). Maybe I'll start another try with vi tomorrow. Joerg Henne Here's a patch for the file, although I fear that applying it might fail due to character set problems... Index: C:/workspaces/apacheds-1.0-trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java =================================================================== --- C:/workspaces/apacheds-1.0-trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java (revision 426825) +++ C:/workspaces/apacheds-1.0-trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java (working copy) @@ -8,6 +8,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.net.URL; import java.util.List; import junit.framework.TestCase; @@ -27,10 +28,12 @@ public class LdifReaderTest extends TestCase { private byte[] data; + private URL jensenURL; + private URL fionaURL; private File createFile( String name, byte[] data ) throws IOException { - File jpeg = new File( "/tmp/" + name ); + File jpeg = File.createTempFile(name, null); jpeg.createNewFile(); @@ -60,8 +63,8 @@ data[i] = (byte) i; } - createFile( "hjensen.jpg", data ); - createFile( "fiona.jpg", data ); + jensenURL = createFile( "hjensen.jpg", data ).toURL(); + fionaURL = createFile( "fiona.jpg", data ).toURL(); } public void testLdifNull() throws NamingException @@ -467,7 +470,7 @@ assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", entry.getDn() ); Attribute attr = entry.get( "cn" ); - assertTrue( attr.contains( "Emmanuel Lécharny".getBytes( "UTF-8" ) ) ); + assertTrue( attr.contains( "Emmanuel L\u00e9charny".getBytes( "UTF-8" ) ) ); attr = entry.get( "objectclass" ); assertTrue( attr.contains( "top" ) ); @@ -510,7 +513,7 @@ assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", entry.getDn() ); Attribute attr = entry.get( "cn" ); - assertTrue( attr.contains( "Emmanuel Lécharny ".getBytes( "UTF-8" ) ) ); + assertTrue( attr.contains( "Emmanuel L\u00e9charny ".getBytes( "UTF-8" ) ) ); attr = entry.get( "objectclass" ); assertTrue( attr.contains( "top" ) ); @@ -911,7 +915,7 @@ "sn: Jensen\n" + "uid: hjensen\n" + "telephonenumber: +1 408 555 1212\n" + - "jpegphoto:< file:///tmp/hjensen.jpg"; + "jpegphoto:< " + jensenURL.toExternalForm(); LdifReader reader = new LdifReader(); List entries = reader.parseLdif( ldif ); @@ -1007,7 +1011,7 @@ "sn: Jensen\n" + "uid: fiona\n" + "telephonenumber: +1 408 555 1212\n" + - "jpegphoto:< file:///tmp/fiona.jpg\n" + + "jpegphoto:< " + fionaURL + "\n" + "\n" + // Second entry modification : DELETE "# Delete an existing entry\n" + |
- Re: Questions about the versions in the repository Jörg Henne
- Re: Questions about the versions in the repository Emmanuel Lecharny
