directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r948711 [5/7] - in /directory: apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/ apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/ apacheds/trunk/core-integ/src/test/java/org/apache/...
Date Thu, 27 May 2010 08:08:45 GMT
Modified: directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReaderTest.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReaderTest.java
(original)
+++ directory/shared/trunk/ldap-ldif/src/test/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReaderTest.java
Thu May 27 08:08:44 2010
@@ -20,15 +20,21 @@
 package org.apache.directory.shared.ldap.ldif;
 
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.DataOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 
+import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.NamingException;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -39,12 +45,6 @@ import org.apache.directory.shared.ldap.
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
-
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -53,13 +53,14 @@ import static org.junit.Assert.assertNot
 public class LdifAttributesReaderTest
 {
     private byte[] data;
-    
+
     private File HJENSEN_JPEG_FILE = null;
-    
+
+
     private File createFile( String name, byte[] data ) throws IOException
     {
         File jpeg = File.createTempFile( name, "jpg" );
-        
+
         jpeg.createNewFile();
 
         DataOutputStream os = new DataOutputStream( new FileOutputStream( jpeg ) );
@@ -74,22 +75,26 @@ public class LdifAttributesReaderTest
         return jpeg;
     }
 
+
     /**
      * Create a file to be used by ":<" values
      */
-    @Before public void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
         data = new byte[256];
 
         for ( int i = 0; i < 256; i++ )
         {
-            data[i] = (byte) i;
+            data[i] = ( byte ) i;
         }
 
         HJENSEN_JPEG_FILE = createFile( "hjensen", data );
     }
 
-    @Test public void testLdifNull() throws LdapLdifException
+
+    @Test
+    public void testLdifNull() throws LdapLdifException
     {
         String ldif = null;
 
@@ -98,9 +103,10 @@ public class LdifAttributesReaderTest
 
         assertEquals( 0, entry.size() );
     }
-    
 
-    @Test public void testLdifEmpty() throws LdapLdifException
+
+    @Test
+    public void testLdifEmpty() throws LdapLdifException
     {
         String ldif = "";
 
@@ -110,8 +116,9 @@ public class LdifAttributesReaderTest
         assertEquals( 0, entry.size() );
     }
 
-    
-    @Test public void testLdifEmptyLines() throws LdapLdifException
+
+    @Test
+    public void testLdifEmptyLines() throws LdapLdifException
     {
         String ldif = "\n\n\r\r\n";
 
@@ -120,15 +127,11 @@ public class LdifAttributesReaderTest
         assertNull( entry );
     }
 
-    
-    @Test public void testLdifComments() throws LdapLdifException
+
+    @Test
+    public void testLdifComments() throws LdapLdifException
     {
-        String ldif = 
-            "#Comment 1\r" + 
-            "#\r" + 
-            " th\n" + 
-            " is is still a comment\n" + 
-            "\n";
+        String ldif = "#Comment 1\r" + "#\r" + " th\n" + " is is still a comment\n" + "\n";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -136,17 +139,12 @@ public class LdifAttributesReaderTest
         assertNull( entry );
     }
 
-    
-    @Test public void testLdifVersionStart() throws LdapLdifException
-    {
-        String ldif = 
-            "cn: app1\n" + 
-            "objectClass: top\n" + 
-            "objectClass: apApplication\n" + 
-            "displayName:   app1   \n" + 
-            "dependencies:\n" + 
-            "envVars:";
 
+    @Test
+    public void testLdifVersionStart() throws LdapLdifException
+    {
+        String ldif = "cn: app1\n" + "objectClass: top\n" + "objectClass: apApplication\n"
+ "displayName:   app1   \n"
+            + "dependencies:\n" + "envVars:";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -164,15 +162,11 @@ public class LdifAttributesReaderTest
      * 
      * @throws NamingException
      */
-    @Test public void testLdifParserEndSpaces() throws LdapLdifException
+    @Test
+    public void testLdifParserEndSpaces() throws LdapLdifException
     {
-        String ldif = 
-            "cn: app1\n" + 
-            "objectClass: top\n" + 
-            "objectClass: apApplication\n" + 
-            "displayName:   app1   \n" + 
-            "dependencies:\n" + 
-            "envVars:";
+        String ldif = "cn: app1\n" + "objectClass: top\n" + "objectClass: apApplication\n"
+ "displayName:   app1   \n"
+            + "dependencies:\n" + "envVars:";
 
         LdifAttributesReader reader = new LdifAttributesReader();
 
@@ -185,15 +179,11 @@ public class LdifAttributesReaderTest
     }
 
 
-    @Test public void testLdifParser() throws LdapLdifException, LdapInvalidAttributeValueException
+    @Test
+    public void testLdifParser() throws LdapLdifException, LdapInvalidAttributeValueException
     {
-        String ldif = 
-            "cn: app1\n" + 
-            "objectClass: top\n" + 
-            "objectClass: apApplication\n" + 
-            "displayName: app1   \n" + 
-            "dependencies:\n" + 
-            "envVars:";
+        String ldif = "cn: app1\n" + "objectClass: top\n" + "objectClass: apApplication\n"
+ "displayName: app1   \n"
+            + "dependencies:\n" + "envVars:";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -217,21 +207,13 @@ public class LdifAttributesReaderTest
         assertNull( attr.get().get() );
     }
 
-    
-    @Test public void testLdifParserMuiltiLineComments() throws LdapLdifException
+
+    @Test
+    public void testLdifParserMuiltiLineComments() throws LdapLdifException
     {
-        String ldif = 
-            "#comment\n" + 
-            " still a comment\n" + 
-            "cn: app1#another comment\n" + 
-            "objectClass: top\n" + 
-            "objectClass: apApplication\n" + 
-            "displayName: app1\n" + 
-            "serviceType: http\n" + 
-            "dependencies:\n" + 
-            "httpHeaders:\n" + 
-            "startupOptions:\n" + 
-            "envVars:";
+        String ldif = "#comment\n" + " still a comment\n" + "cn: app1#another comment\n"
+ "objectClass: top\n"
+            + "objectClass: apApplication\n" + "displayName: app1\n" + "serviceType: http\n"
+ "dependencies:\n"
+            + "httpHeaders:\n" + "startupOptions:\n" + "envVars:";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -255,21 +237,13 @@ public class LdifAttributesReaderTest
         assertNull( attr.get().get() );
     }
 
-    
-    @Test public void testLdifParserMultiLineEntries() throws LdapLdifException
+
+    @Test
+    public void testLdifParserMultiLineEntries() throws LdapLdifException
     {
-        String ldif = 
-            "#comment\n" + 
-            "cn: app1#another comment\n" + 
-            "objectClass: top\n" + 
-            "objectClass: apAppli\n" +
-            " cation\n" + 
-            "displayName: app1\n" + 
-            "serviceType: http\n" + 
-            "dependencies:\n" + 
-            "httpHeaders:\n" + 
-            "startupOptions:\n" + 
-            "envVars:";
+        String ldif = "#comment\n" + "cn: app1#another comment\n" + "objectClass: top\n"
+ "objectClass: apAppli\n"
+            + " cation\n" + "displayName: app1\n" + "serviceType: http\n" + "dependencies:\n"
+ "httpHeaders:\n"
+            + "startupOptions:\n" + "envVars:";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -293,20 +267,13 @@ public class LdifAttributesReaderTest
         assertNull( attr.get().get() );
     }
 
-    
-    @Test public void testLdifParserBase64() throws LdapLdifException, UnsupportedEncodingException
+
+    @Test
+    public void testLdifParserBase64() throws LdapLdifException, UnsupportedEncodingException
     {
-        String ldif = 
-            "#comment\n" + 
-            "cn:: RW1tYW51ZWwgTMOpY2hhcm55\n" + 
-            "objectClass: top\n" + 
-            "objectClass: apApplication\n" + 
-            "displayName: app1\n" + 
-            "serviceType: http\n" + 
-            "dependencies:\n" + 
-            "httpHeaders:\n" + 
-            "startupOptions:\n" + 
-            "envVars:";
+        String ldif = "#comment\n" + "cn:: RW1tYW51ZWwgTMOpY2hhcm55\n" + "objectClass: top\n"
+            + "objectClass: apApplication\n" + "displayName: app1\n" + "serviceType: http\n"
+ "dependencies:\n"
+            + "httpHeaders:\n" + "startupOptions:\n" + "envVars:";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -330,21 +297,13 @@ public class LdifAttributesReaderTest
         assertNull( attr.get().get() );
     }
 
-    
-    @Test public void testLdifParserBase64MultiLine() throws LdapLdifException, UnsupportedEncodingException
+
+    @Test
+    public void testLdifParserBase64MultiLine() throws LdapLdifException, UnsupportedEncodingException
     {
-        String ldif = 
-            "#comment\n" + 
-            "cn:: RW1tYW51ZWwg\n" + 
-            " TMOpY2hhcm55ICA=\n" + 
-            "objectClass: top\n" + 
-            "objectClass: apApplication\n" + 
-            "displayName: app1\n" + 
-            "serviceType: http\n" + 
-            "dependencies:\n" + 
-            "httpHeaders:\n" + 
-            "startupOptions:\n" + 
-            "envVars:";
+        String ldif = "#comment\n" + "cn:: RW1tYW51ZWwg\n" + " TMOpY2hhcm55ICA=\n" + "objectClass:
top\n"
+            + "objectClass: apApplication\n" + "displayName: app1\n" + "serviceType: http\n"
+ "dependencies:\n"
+            + "httpHeaders:\n" + "startupOptions:\n" + "envVars:";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -368,20 +327,13 @@ public class LdifAttributesReaderTest
         assertNull( attr.get().get() );
     }
 
-    
-    @Test public void testLdifParserRFC2849Sample1() throws LdapLdifException
+
+    @Test
+    public void testLdifParserRFC2849Sample1() throws LdapLdifException
     {
-        String ldif = 
-            "objectclass: top\n" + 
-            "objectclass: person\n" + 
-            "objectclass: organizationalPerson\n" + 
-            "cn: Barbara Jensen\n" + 
-            "cn: Barbara J Jensen\n" + 
-            "cn: Babs Jensen\n" + 
-            "sn: Jensen\n" + 
-            "uid: bjensen\n" + 
-            "telephonenumber: +1 408 555 1212\n" + 
-            "description: A big sailing fan.\n"; 
+        String ldif = "objectclass: top\n" + "objectclass: person\n" + "objectclass: organizationalPerson\n"
+            + "cn: Barbara Jensen\n" + "cn: Barbara J Jensen\n" + "cn: Babs Jensen\n" + "sn:
Jensen\n"
+            + "uid: bjensen\n" + "telephonenumber: +1 408 555 1212\n" + "description: A big
sailing fan.\n";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -410,22 +362,15 @@ public class LdifAttributesReaderTest
 
     }
 
-    
-    @Test public void testLdifParserRFC2849Sample2() throws LdapLdifException
+
+    @Test
+    public void testLdifParserRFC2849Sample2() throws LdapLdifException
     {
-        String ldif = 
-            "objectclass: top\n" + 
-            "objectclass: person\n" + 
-            "objectclass: organizationalPerson\n" + 
-            "cn: Barbara Jensen\n" + 
-            "cn: Barbara J Jensen\n" + 
-            "cn: Babs Jensen\n" + 
-            "sn: Jensen\n" + 
-            "uid: bjensen\n" + 
-            "telephonenumber: +1 408 555 1212\n" + 
-            "description:Babs is a big sailing fan, and travels extensively in sea\n" + 
-            " rch of perfect sailing conditions.\n" + 
-            "title:Product Manager, Rod and Reel Division";
+        String ldif = "objectclass: top\n" + "objectclass: person\n" + "objectclass: organizationalPerson\n"
+            + "cn: Barbara Jensen\n" + "cn: Barbara J Jensen\n" + "cn: Babs Jensen\n" + "sn:
Jensen\n"
+            + "uid: bjensen\n" + "telephonenumber: +1 408 555 1212\n"
+            + "description:Babs is a big sailing fan, and travels extensively in sea\n"
+            + " rch of perfect sailing conditions.\n" + "title:Product Manager, Rod and Reel
Division";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Entry entry = reader.parseEntry( ldif );
@@ -451,29 +396,23 @@ public class LdifAttributesReaderTest
 
         attr = entry.get( "description" );
         assertTrue( attr
-                .contains( "Babs is a big sailing fan, and travels extensively in search
of perfect sailing conditions." ) );
+            .contains( "Babs is a big sailing fan, and travels extensively in search of perfect
sailing conditions." ) );
 
         attr = entry.get( "title" );
         assertTrue( attr.contains( "Product Manager, Rod and Reel Division" ) );
 
     }
 
-    
-    @Test public void testLdifParserRFC2849Sample3() throws LdapLdifException, Exception
+
+    @Test
+    public void testLdifParserRFC2849Sample3() throws LdapLdifException, Exception
     {
-        String ldif = 
-            "objectclass: top\n" + 
-            "objectclass: person\n" + 
-            "objectclass: organizationalPerson\n" + 
-            "cn: Gern Jensen\n" + 
-            "cn: Gern O Jensen\n" + 
-            "sn: Jensen\n" + 
-            "uid: gernj\n" + 
-            "telephonenumber: +1 408 555 1212\n" + 
-            "description:: V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvdSBhcmUhICBUaGlzIHZhbHVl\n" +

-            " IGlzIGJhc2UtNjQtZW5jb2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdG\n" +

-            " VyIGluIGl0IChhIENSKS4NICBCeSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQg\n" +

-            " b3V0IG1vcmUu";
+        String ldif = "objectclass: top\n" + "objectclass: person\n" + "objectclass: organizationalPerson\n"
+            + "cn: Gern Jensen\n" + "cn: Gern O Jensen\n" + "sn: Jensen\n" + "uid: gernj\n"
+            + "telephonenumber: +1 408 555 1212\n"
+            + "description:: V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvdSBhcmUhICBUaGlzIHZhbHVl\n"
+            + " IGlzIGJhc2UtNjQtZW5jb2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdG\n"
+            + " VyIGluIGl0IChhIENSKS4NICBCeSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQg\n"
+ " b3V0IG1vcmUu";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Attributes attributes = reader.parseAttributes( ldif );
@@ -498,26 +437,20 @@ public class LdifAttributesReaderTest
 
         attr = attributes.get( "description" );
         assertTrue( attr
-                .contains( "What a careful reader you are!  This value is base-64-encoded
because it has a control character in it (a CR).\r  By the way, you should really get out
more."
-                        .getBytes( "UTF-8" ) ) );
+            .contains( "What a careful reader you are!  This value is base-64-encoded because
it has a control character in it (a CR).\r  By the way, you should really get out more."
+                .getBytes( "UTF-8" ) ) );
     }
 
-    
-    @Test public void testLdifParserRFC2849Sample3VariousSpacing() throws LdapLdifException,
Exception
+
+    @Test
+    public void testLdifParserRFC2849Sample3VariousSpacing() throws LdapLdifException, Exception
     {
-        String ldif = 
-            "objectclass:top\n" + 
-            "objectclass:   person   \n" + 
-            "objectclass:organizationalPerson\n" + 
-            "cn:Gern Jensen\n"  + 
-            "cn:Gern O Jensen\n" + 
-            "sn:Jensen\n" + 
-            "uid:gernj\n" + 
-            "telephonenumber:+1 408 555 1212  \n" + 
-            "description::  V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvdSBhcmUhICBUaGlzIHZhbHVl\n" +

-            " IGlzIGJhc2UtNjQtZW5jb2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdG\n" +

-            " VyIGluIGl0IChhIENSKS4NICBCeSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQg\n" +

-            " b3V0IG1vcmUu  ";
+        String ldif = "objectclass:top\n" + "objectclass:   person   \n" + "objectclass:organizationalPerson\n"
+            + "cn:Gern Jensen\n" + "cn:Gern O Jensen\n" + "sn:Jensen\n" + "uid:gernj\n"
+            + "telephonenumber:+1 408 555 1212  \n"
+            + "description::  V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvdSBhcmUhICBUaGlzIHZhbHVl\n"
+            + " IGlzIGJhc2UtNjQtZW5jb2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdG\n"
+            + " VyIGluIGl0IChhIENSKS4NICBCeSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQg\n"
+ " b3V0IG1vcmUu  ";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Attributes attributes = reader.parseAttributes( ldif );
@@ -542,25 +475,20 @@ public class LdifAttributesReaderTest
 
         attr = attributes.get( "description" );
         assertTrue( attr
-                .contains( "What a careful reader you are!  This value is base-64-encoded
because it has a control character in it (a CR).\r  By the way, you should really get out
more."
-                        .getBytes( "UTF-8" ) ) );
+            .contains( "What a careful reader you are!  This value is base-64-encoded because
it has a control character in it (a CR).\r  By the way, you should really get out more."
+                .getBytes( "UTF-8" ) ) );
     }
 
-    
-    @Test public void testLdifParserRFC2849Sample4() throws NamingException, Exception
+
+    @Test
+    public void testLdifParserRFC2849Sample4() throws NamingException, Exception
     {
-        String ldif = 
-            "# dn:: ou=���������,o=Airius\n"
+ 
-            "objectclass: top\n" + 
-            "objectclass: organizationalUnit\n" + 
-            "ou:: 5Za25qWt6YOo\n" + 
-            "# ou:: ���������\n" + 
-            "ou;lang-ja:: 5Za25qWt6YOo\n" + 
-            "# ou;lang-ja:: ���������\n" + 
-            "ou;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2\n" + 
-            "# ou;lang-ja:: ������������������\n"
+ 
-            "ou;lang-en: Sales\n" + 
-            "description: Japanese office\n";
+        String ldif = "# dn:: ou=���������,o=Airius\n"
+ "objectclass: top\n"
+            + "objectclass: organizationalUnit\n" + "ou:: 5Za25qWt6YOo\n" + "# ou:: ���������\n"
+            + "ou;lang-ja:: 5Za25qWt6YOo\n" + "# ou;lang-ja:: ���������\n"
+            + "ou;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2\n"
+            + "# ou;lang-ja:: ������������������\n"
+ "ou;lang-en: Sales\n"
+            + "description: Japanese office\n";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Attributes attributes = reader.parseAttributes( ldif );
@@ -572,10 +500,9 @@ public class LdifAttributesReaderTest
                 { "ou", "\u55b6\u696d\u90e8" },
                 { "ou;lang-ja", "\u55b6\u696d\u90e8" },
                 { "ou;lang-ja;phonetic", "\u3048\u3044\u304e\u3087\u3046\u3076" }, // 3048
= ���, 3044 = ���, 304e = ���
-                                                                                // 3087 =
���, 3046 = ���, 3076 = ���
+                    // 3087 = ���, 3046 = ���, 3076 = ���
                 { "ou;lang-en", "Sales" },
-                { "description", "Japanese office" }
-            }; 
+                { "description", "Japanese office" } };
 
         for ( int j = 0; j < values.length; j++ )
         {
@@ -592,19 +519,13 @@ public class LdifAttributesReaderTest
         }
     }
 
-    
-    @Test public void testLdifParserRFC2849Sample5() throws NamingException, Exception
+
+    @Test
+    public void testLdifParserRFC2849Sample5() throws NamingException, Exception
     {
-        String ldif = 
-            "objectclass: top\n" + 
-            "objectclass: person\n" + 
-            "objectclass: organizationalPerson\n" + 
-            "cn: Horatio Jensen\n" + 
-            "cn: Horatio N Jensen\n" + 
-            "sn: Jensen\n" + 
-            "uid: hjensen\n" + 
-            "telephonenumber: +1 408 555 1212\n" + 
-            "jpegphoto:< file:" + HJENSEN_JPEG_FILE.getAbsolutePath() + "\n";
+        String ldif = "objectclass: top\n" + "objectclass: person\n" + "objectclass: organizationalPerson\n"
+            + "cn: Horatio Jensen\n" + "cn: Horatio N Jensen\n" + "sn: Jensen\n" + "uid:
hjensen\n"
+            + "telephonenumber: +1 408 555 1212\n" + "jpegphoto:< file:" + HJENSEN_JPEG_FILE.getAbsolutePath()
+ "\n";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Attributes attributes = reader.parseAttributes( ldif );
@@ -619,15 +540,14 @@ public class LdifAttributesReaderTest
                 { "sn", "Jensen" },
                 { "uid", "hjensen" },
                 { "telephonenumber", "+1 408 555 1212" },
-                { "jpegphoto", null } 
-            };
+                { "jpegphoto", null } };
 
         for ( int i = 0; i < values.length; i++ )
         {
             if ( "jpegphoto".equalsIgnoreCase( values[i][0] ) )
             {
                 Attribute attr = attributes.get( values[i][0] );
-                assertEquals( StringTools.dumpBytes( data ), StringTools.dumpBytes( (byte[])
attr.get() ) );
+                assertEquals( StringTools.dumpBytes( data ), StringTools.dumpBytes( ( byte[]
) attr.get() ) );
             }
             else
             {
@@ -645,19 +565,13 @@ public class LdifAttributesReaderTest
         }
     }
 
-    
-    @Test public void testLdifParserRFC2849Sample5WithSizeLimit() throws Exception
+
+    @Test
+    public void testLdifParserRFC2849Sample5WithSizeLimit() throws Exception
     {
-        String ldif = 
-            "objectclass: top\n" + 
-            "objectclass: person\n" + 
-            "objectclass: organizationalPerson\n" + 
-            "cn: Horatio Jensen\n" + 
-            "cn: Horatio N Jensen\n" + 
-            "sn: Jensen\n" + 
-            "uid: hjensen\n" + 
-            "telephonenumber: +1 408 555 1212\n" + 
-            "jpegphoto:< file:" + HJENSEN_JPEG_FILE.getAbsolutePath() + "\n";
+        String ldif = "objectclass: top\n" + "objectclass: person\n" + "objectclass: organizationalPerson\n"
+            + "cn: Horatio Jensen\n" + "cn: Horatio N Jensen\n" + "sn: Jensen\n" + "uid:
hjensen\n"
+            + "telephonenumber: +1 408 555 1212\n" + "jpegphoto:< file:" + HJENSEN_JPEG_FILE.getAbsolutePath()
+ "\n";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         reader.setSizeLimit( 128 );
@@ -669,44 +583,33 @@ public class LdifAttributesReaderTest
         }
         catch ( LdapLdifException ne )
         {
-        	assertTrue(I18n.err(I18n.ERR_12009), ne.getMessage().startsWith(I18n.ERR_12009.getErrorCode()));
+            assertTrue( I18n.err( I18n.ERR_12009 ), ne.getMessage().startsWith( I18n.ERR_12009.getErrorCode()
) );
         }
     }
 
-    
-    @Test public void testLdifAttributesReaderDirServer() throws NamingException, Exception
+
+    @Test
+    public void testLdifAttributesReaderDirServer() throws NamingException, Exception
     {
-        String ldif = 
-            "# -------------------------------------------------------------------\n" +
-            "#\n" +
-            "#  Licensed to the Apache Software Foundation (ASF) under one\n" +
-            "#  or more contributor license agreements.  See the NOTICE file\n" +
-            "#  distributed with this work for additional information\n" +
-            "#  regarding copyright ownership.  The ASF licenses this file\n" +
-            "#  to you under the Apache License, Version 2.0 (the\n" +
-            "#  \"License\"); you may not use this file except in compliance\n" +
-            "#  with the License.  You may obtain a copy of the License at\n" +
-            "#  \n" +
-            "#    http://www.apache.org/licenses/LICENSE-2.0\n" +
-            "#  \n" +
-            "#  Unless required by applicable law or agreed to in writing,\n" +
-            "#  software distributed under the License is distributed on an\n" +
-            "#  \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n" +
-            "#  KIND, either express or implied.  See the License for the\n" +
-            "#  specific language governing permissions and limitations\n" +
-            "#  under the License. \n" +
-            "#  \n" +
-            "#\n" +
-            "# EXAMPLE.COM is freely and reserved for testing according to this RFC:\n" +
-            "#\n" +
-            "# http://www.rfc-editor.org/rfc/rfc2606.txt\n" +
-            "#\n" +
-            "# -------------------------------------------------------------------\n" +
-            "\n" +
-            "objectclass: top\n" +
-            "objectclass: organizationalunit\n" +
-            "ou: Users";
-            
+        String ldif = "# -------------------------------------------------------------------\n"
+ "#\n"
+            + "#  Licensed to the Apache Software Foundation (ASF) under one\n"
+            + "#  or more contributor license agreements.  See the NOTICE file\n"
+            + "#  distributed with this work for additional information\n"
+            + "#  regarding copyright ownership.  The ASF licenses this file\n"
+            + "#  to you under the Apache License, Version 2.0 (the\n"
+            + "#  \"License\"); you may not use this file except in compliance\n"
+            + "#  with the License.  You may obtain a copy of the License at\n" + "#  \n"
+            + "#    http://www.apache.org/licenses/LICENSE-2.0\n" + "#  \n"
+            + "#  Unless required by applicable law or agreed to in writing,\n"
+            + "#  software distributed under the License is distributed on an\n"
+            + "#  \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n"
+            + "#  KIND, either express or implied.  See the License for the\n"
+            + "#  specific language governing permissions and limitations\n" + "#  under
the License. \n" + "#  \n"
+            + "#\n" + "# EXAMPLE.COM is freely and reserved for testing according to this
RFC:\n" + "#\n"
+            + "# http://www.rfc-editor.org/rfc/rfc2606.txt\n" + "#\n"
+            + "# -------------------------------------------------------------------\n" +
"\n" + "objectclass: top\n"
+            + "objectclass: organizationalunit\n" + "ou: Users";
+
         LdifAttributesReader reader = new LdifAttributesReader();
 
         Attributes attributes = reader.parseAttributes( ldif );
@@ -719,47 +622,47 @@ public class LdifAttributesReaderTest
         assertTrue( attr.contains( "Users" ) );
     }
 
-    
-    @Test public void testLdifParserCommentsEmptyLines() throws NamingException, Exception
+
+    @Test
+    public void testLdifParserCommentsEmptyLines() throws NamingException, Exception
     {
-        String ldif = 
-            "#\n" +
-            "#  Licensed to the Apache Software Foundation (ASF) under one\n" +
-            "#  or more contributor license agreements.  See the NOTICE file\n" +
-            "#  distributed with this work for additional information\n" +
-            "#  regarding copyright ownership.  The ASF licenses this file\n" +
-            "#  to you under the Apache License, Version 2.0 (the\n" +
-            "#  \"License\"); you may not use this file except in compliance\n" +
-            "#  with the License.  You may obtain a copy of the License at\n" +
-            "#  \n" +
-            "#    http://www.apache.org/licenses/LICENSE-2.0\n" +
-            "#  \n" +
-            "#  Unless required by applicable law or agreed to in writing,\n" +
-            "#  software distributed under the License is distributed on an\n" +
-            "#  \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n" +
-            "#  KIND, either express or implied.  See the License for the\n" +
-            "#  specific language governing permissions and limitations\n" +
-            "#  under the License. \n" +
-            "#  \n" +
-            "#\n" +
-            "#\n" +
-            "#   EXAMPLE.COM is freely and reserved for testing according to this RFC:\n"
+
-            "#\n" +
-            "#   http://www.rfc-editor.org/rfc/rfc2606.txt\n" +
-            "#\n" +
-            "#\n" +
-            "\n" +
-            "#\n" +
-            "# This ACI allows brouse access to the root suffix and one level below that
to anyone.\n" +
-            "# At this level there is nothing critical exposed.  Everything that matters
is one or\n" +
-            "# more levels below this.\n" +
-            "#\n" +
-            "\n" +
-            "objectClass: top\n" +
-            "objectClass: subentry\n" +
-            "objectClass: accessControlSubentry\n" +
-            "subtreeSpecification: { maximum 1 }\n" +
-            "prescriptiveACI: { identificationTag \"browseRoot\", precedence 100, authenticationLevel
none, itemOrUserFirst userFirst: { userClasses { allUsers }, userPermissions { { protectedItems
{entry}, grantsAndDenials { grantReturnDN, grantBrowse } } } } }\n";
+        String ldif = "#\n"
+            + "#  Licensed to the Apache Software Foundation (ASF) under one\n"
+            + "#  or more contributor license agreements.  See the NOTICE file\n"
+            + "#  distributed with this work for additional information\n"
+            + "#  regarding copyright ownership.  The ASF licenses this file\n"
+            + "#  to you under the Apache License, Version 2.0 (the\n"
+            + "#  \"License\"); you may not use this file except in compliance\n"
+            + "#  with the License.  You may obtain a copy of the License at\n"
+            + "#  \n"
+            + "#    http://www.apache.org/licenses/LICENSE-2.0\n"
+            + "#  \n"
+            + "#  Unless required by applicable law or agreed to in writing,\n"
+            + "#  software distributed under the License is distributed on an\n"
+            + "#  \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n"
+            + "#  KIND, either express or implied.  See the License for the\n"
+            + "#  specific language governing permissions and limitations\n"
+            + "#  under the License. \n"
+            + "#  \n"
+            + "#\n"
+            + "#\n"
+            + "#   EXAMPLE.COM is freely and reserved for testing according to this RFC:\n"
+            + "#\n"
+            + "#   http://www.rfc-editor.org/rfc/rfc2606.txt\n"
+            + "#\n"
+            + "#\n"
+            + "\n"
+            + "#\n"
+            + "# This ACI allows brouse access to the root suffix and one level below that
to anyone.\n"
+            + "# At this level there is nothing critical exposed.  Everything that matters
is one or\n"
+            + "# more levels below this.\n"
+            + "#\n"
+            + "\n"
+            + "objectClass: top\n"
+            + "objectClass: subentry\n"
+            + "objectClass: accessControlSubentry\n"
+            + "subtreeSpecification: { maximum 1 }\n"
+            + "prescriptiveACI: { identificationTag \"browseRoot\", precedence 100, authenticationLevel
none, itemOrUserFirst userFirst: { userClasses { allUsers }, userPermissions { { protectedItems
{entry}, grantsAndDenials { grantReturnDN, grantBrowse } } } } }\n";
 
         LdifAttributesReader reader = new LdifAttributesReader();
         Attributes attributes = reader.parseAttributes( ldif );
@@ -773,6 +676,7 @@ public class LdifAttributesReaderTest
         assertTrue( attr.contains( "{ maximum 1 }" ) );
 
         attr = attributes.get( "prescriptiveACI" );
-        assertTrue( attr.contains( "{ identificationTag \"browseRoot\", precedence 100, authenticationLevel
none, itemOrUserFirst userFirst: { userClasses { allUsers }, userPermissions { { protectedItems
{entry}, grantsAndDenials { grantReturnDN, grantBrowse } } } } }" ) );
+        assertTrue( attr
+            .contains( "{ identificationTag \"browseRoot\", precedence 100, authenticationLevel
none, itemOrUserFirst userFirst: { userClasses { allUsers }, userPermissions { { protectedItems
{entry}, grantsAndDenials { grantReturnDN, grantBrowse } } } } }" ) );
     }
 }



Mime
View raw message