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/05/13 16:25:57 UTC

svn commit: r406112 - in /directory/branches/elecharny: ./ apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/ apacheds/core/src/main/java/org/apache/directory/server/core/ apacheds/core/src/main/java/org/apache/directory/server/cor...

Author: elecharny
Date: Sat May 13 07:25:54 2006
New Revision: 406112

URL: http://svn.apache.org/viewcvs?rev=406112&view=rev
Log:
created a private branches for more ldif modification testing

Added:
    directory/branches/elecharny/
      - copied from r406104, directory/trunks/
Removed:
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIterator.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIteratorMonitor.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIteratorMonitorAdapter.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifParser.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifParserImpl.java
    directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifParserImplTest.java
Modified:
    directory/branches/elecharny/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java
    directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java
    directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/ConfigurationUtil.java
    directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
    directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
    directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java
    directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
    directory/branches/elecharny/apacheds/server-main/log4j.properties
    directory/branches/elecharny/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/Entry.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
    directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java
    directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java

Modified: directory/branches/elecharny/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java (original)
+++ directory/branches/elecharny/apacheds/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java Sat May 13 07:25:54 2006
@@ -24,6 +24,7 @@
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.naming.Context;
@@ -36,13 +37,11 @@
 import junit.framework.TestCase;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.exception.NestableRuntimeException;
 import org.apache.directory.server.core.configuration.Configuration;
 import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
 import org.apache.directory.server.core.configuration.ShutdownConfiguration;
-import org.apache.directory.shared.ldap.ldif.LdifIterator;
-import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
-import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
+import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
 
 
 /**
@@ -53,12 +52,24 @@
  */
 public abstract class AbstractTestCase extends TestCase
 {
-    public static final String LDIF = "dn: uid=akarasulu,ou=users,ou=system\n" + "cn: Alex Karasulu\n"
-        + "sn: Karasulu\n" + "givenname: Alex\n" + "objectclass: top\n" + "objectclass: person\n"
-        + "objectclass: organizationalPerson\n" + "objectclass: inetOrgPerson\n" + "ou: Engineering\n" + "ou: People\n"
-        + "l: Bogusville\n" + "uid: akarasulu\n" + "mail: akarasulu@apache.org\n"
-        + "telephonenumber: +1 408 555 4798\n" + "facsimiletelephonenumber: +1 408 555 9751\n" + "roomnumber: 4612\n"
-        + "userpassword: test\n";
+    public static final String LDIF = 
+    	"dn: uid=akarasulu,ou=users,ou=system\n" + 
+    	"cn: Alex Karasulu\n" +
+        "sn: Karasulu\n" + 
+        "givenname: Alex\n" + 
+        "objectclass: top\n" + 
+        "objectclass: person\n" +
+        "objectclass: organizationalPerson\n" + 
+        "objectclass: inetOrgPerson\n" + 
+        "ou: Engineering\n" + 
+        "ou: People\n" +
+        "l: Bogusville\n" + 
+        "uid: akarasulu\n" + 
+        "mail: akarasulu@apache.org\n" +
+        "telephonenumber: +1 408 555 4798\n" + 
+        "facsimiletelephonenumber: +1 408 555 9751\n" + 
+        "roomnumber: 4612\n" +
+        "userpassword: test\n";
 
     private final String username;
 
@@ -136,17 +147,13 @@
         // Add a single test entry
         // -------------------------------------------------------------------
 
-        Attributes attributes = new LockableAttributesImpl();
-        LdifParserImpl parser = new LdifParserImpl();
-        try
-        {
-            parser.parse( attributes, LDIF );
-        }
-        catch ( NamingException e )
-        {
-            throw new NestableRuntimeException( e );
-        }
-        testEntries.add( attributes );
+        LdifReader reader = new LdifReader();
+        
+    	List entries = reader.parseLdif( LDIF );
+        
+        Entry entry = (Entry)entries.get(0);
+
+        testEntries.add( entry );
 
         // -------------------------------------------------------------------
         // Add more from an optional LDIF file if they exist
@@ -177,13 +184,13 @@
 
         if ( in != null )
         {
-            LdifIterator list = new LdifIterator( in );
+            Iterator list = new LdifReader( in );
+            
             while ( list.hasNext() )
             {
-                String ldif = ( String ) list.next();
-                attributes = new LockableAttributesImpl();
-                parser.parse( attributes, ldif );
-                testEntries.add( attributes );
+                entry = ( Entry ) list.next();
+                
+                testEntries.add( entry );
             }
         }
 

Modified: directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sat May 13 07:25:54 2006
@@ -48,6 +48,7 @@
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException;
 import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
+import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -670,17 +671,25 @@
         Iterator i = startupConfiguration.getTestEntries().iterator();
         while ( i.hasNext() )
         {
-            Attributes entry = ( Attributes ) ( ( Attributes ) i.next() ).clone();
-            String dn = ( String ) entry.remove( "dn" ).get();
-
-            try
-            {
-                ctx.createSubcontext( dn, entry );
-            }
-            catch ( Exception e )
-            {
-                log.warn( dn + " test entry already exists.", e );
-            }
+        	try
+        	{
+	        	Entry entry =  (Entry)( ( Entry ) i.next() ).clone();
+	            Attributes attributes = entry.getAttributes();
+	            String dn = entry.getDn();
+
+	            try
+	            {
+	                ctx.createSubcontext( dn, attributes );
+	            }
+	            catch ( Exception e )
+	            {
+	                log.warn( dn + " test entry already exists.", e );
+	            }
+        	}
+        	catch ( CloneNotSupportedException cnse )
+        	{
+                log.warn( "Cannot clone the entry ", cnse );
+        	}
         }
     }
 

Modified: directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java (original)
+++ directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java Sat May 13 07:25:54 2006
@@ -22,6 +22,7 @@
 import java.beans.PropertyEditor;
 import java.beans.PropertyEditorSupport;
 import java.util.Collection;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -29,14 +30,13 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttributes;
 
 import org.apache.commons.collections.MultiHashMap;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.ldif.LdifComposer;
 import org.apache.directory.shared.ldap.ldif.LdifComposerImpl;
-import org.apache.directory.shared.ldap.ldif.LdifParser;
-import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.util.MultiMap;
 
 
@@ -194,12 +194,21 @@
             text = "";
         }
 
-        Attributes attrs = new BasicAttributes( true );
-        LdifParser parser = new LdifParserImpl();
+        LdifReader parser = new LdifReader();
+        
         try
         {
-            parser.parse( attrs, text.trim() );
-            setValue( attrs );
+        	List entries = parser.parseLdif( text );
+        	
+        	if ( entries.size() != 0 )
+        	{
+        		Entry entry = (Entry)entries.get( 0 );
+        		
+        		if ( entry.isEntry() )
+        		{
+        			setValue( entry.getAttributes() );
+        		}
+        	}
         }
         catch ( NamingException e )
         {

Modified: directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/ConfigurationUtil.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/ConfigurationUtil.java (original)
+++ directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/ConfigurationUtil.java Sat May 13 07:25:54 2006
@@ -28,6 +28,8 @@
 
 import javax.naming.directory.Attributes;
 
+import org.apache.directory.shared.ldap.ldif.Entry;
+
 
 /**
  * A utility class that provides common functionality while validating configuration.
@@ -105,13 +107,14 @@
     /**
      * Returns the deep clone of the specified {@link Attributes} list.
      */
-    public static List getClonedAttributesList( List list )
+    public static List getClonedAttributesList( List list ) throws CloneNotSupportedException
     {
         List newList = new ArrayList();
         Iterator i = list.iterator();
+        
         while ( i.hasNext() )
         {
-            newList.add( ( ( Attributes ) i.next() ).clone() );
+            newList.add( ( ( Entry ) i.next() ).clone() );
         }
         return newList;
     }

Modified: directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java (original)
+++ directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java Sat May 13 07:25:54 2006
@@ -44,6 +44,7 @@
 import org.apache.directory.server.core.schema.bootstrap.*;
 import org.apache.directory.server.core.subtree.SubentryService;
 import org.apache.directory.server.core.trigger.TriggerService;
+import org.apache.directory.shared.ldap.ldif.Entry;
 
 
 /**
@@ -372,7 +373,14 @@
      */
     public List getTestEntries()
     {
-        return ConfigurationUtil.getClonedAttributesList( testEntries );
+    	try
+    	{
+    		return ConfigurationUtil.getClonedAttributesList( testEntries );
+    	}
+    	catch ( CloneNotSupportedException cnse )
+    	{
+    		return null;
+    	}
     }
 
 
@@ -382,20 +390,17 @@
      */
     protected void setTestEntries( List testEntries )
     {
-        testEntries = ConfigurationUtil.getClonedAttributesList( ConfigurationUtil.getTypeSafeList( testEntries,
-            Attributes.class ) );
-
-        Iterator i = testEntries.iterator();
-        while ( i.hasNext() )
-        {
-            Attributes entry = ( Attributes ) i.next();
-            if ( entry.get( "dn" ) == null )
-            {
-                throw new ConfigurationException( "Test entries must have DN attributes" );
-            }
-        }
-
-        this.testEntries = testEntries;
+    	try
+    	{
+	        testEntries = ConfigurationUtil.getClonedAttributesList( ConfigurationUtil.getTypeSafeList( testEntries,
+	            Entry.class ) );
+	
+	        this.testEntries = testEntries;
+    	}
+    	catch ( CloneNotSupportedException cnse )
+    	{
+    		this.testEntries = null;
+    	}
     }
 
 

Modified: directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java (original)
+++ directory/branches/elecharny/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java Sat May 13 07:25:54 2006
@@ -26,7 +26,6 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
-import java.io.IOException;
 import java.math.BigInteger;
 import java.util.HashMap;
 import java.util.Hashtable;
@@ -67,11 +66,9 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
-import org.apache.directory.shared.ldap.ldif.LdifIterator;
-import org.apache.directory.shared.ldap.ldif.LdifParser;
-import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
+import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.message.DerefAliasesEnum;
-import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapName;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -427,8 +424,6 @@
     public void doImport()
     {
         FileReader in = null;
-        LdifIterator list = null;
-        LdifParser parser = new LdifParserImpl();
         JFileChooser chooser = new JFileChooser();
         int choice = chooser.showOpenDialog( this );
         File selected = chooser.getSelectedFile();
@@ -441,16 +436,15 @@
         try
         {
             in = new FileReader( selected );
-            list = new LdifIterator( in );
+            Iterator list = new LdifReader( in );
 
             while ( list.hasNext() )
             {
-                String dif = ( String ) list.next();
-                LockableAttributesImpl attrs = new LockableAttributesImpl();
-                parser.parse( attrs, dif );
-                String updn = ( String ) attrs.get( "dn" ).get();
+                Entry entry = ( Entry ) list.next();
+                String updn = entry.getDn();
+                Attributes attrs = entry.getAttributes();
+                
                 LdapName ndn = new LdapName( StringTools.deepTrimToLower( updn ) );
-                attrs.remove( "dn" );
 
                 if ( null == partition.getEntryId( ndn.toString() ) )
                 {
@@ -466,12 +460,6 @@
             return;
         }
         catch ( FileNotFoundException e )
-        {
-            // @todo display popup with error here!
-            e.printStackTrace();
-            return;
-        }
-        catch ( IOException e )
         {
             // @todo display popup with error here!
             e.printStackTrace();

Modified: directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java (original)
+++ directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java Sat May 13 07:25:54 2006
@@ -26,6 +26,7 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.Properties;
 import java.util.Set;
 
@@ -56,9 +57,8 @@
 import org.apache.directory.server.core.schema.bootstrap.Krb5kdcSchema;
 import org.apache.directory.server.core.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.protocol.shared.store.KerberosAttribute;
-import org.apache.directory.shared.ldap.ldif.LdifIterator;
-import org.apache.directory.shared.ldap.ldif.LdifParser;
-import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
+import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.slf4j.Logger;
@@ -298,18 +298,14 @@
         {
             InputStream in = getLdifStream( ldifPath );
 
-            LdifIterator iterator = new LdifIterator( in );
-
-            LdifParser ldifParser = new LdifParserImpl();
+            Iterator iterator = new LdifReader( in );
 
             while ( iterator.hasNext() )
             {
-                String ldif = ( String ) iterator.next();
-
-                Attributes attributes = new LockableAttributesImpl();
-                ldifParser.parse( attributes, ldif );
+                Entry entry = ( Entry ) iterator.next();
 
-                String dn = ( String ) attributes.remove( "dn" ).get();
+                String dn = entry.getDn();
+                Attributes attributes = entry.getAttributes();
 
                 if ( attributes.get( "objectClass" ).contains( "krb5KDCEntry" ) )
                 {
@@ -347,11 +343,6 @@
             log.error( "LDIF file does not exist." );
             return;
         }
-        catch ( IOException ioe )
-        {
-            log.error( "Failed to import LDIF into backing store.", ioe );
-            return;
-        }
         catch ( NamingException ne )
         {
             log.error( "Failed to import LDIF into backing store.", ne );
@@ -362,19 +353,13 @@
         {
             InputStream in = getLdifStream( ldifPath );
 
-            LdifIterator iterator = new LdifIterator( in );
-
-            LdifParser ldifParser = new LdifParserImpl();
+            Iterator iterator = new LdifReader( in );
 
             while ( iterator.hasNext() )
             {
-                String ldif = ( String ) iterator.next();
-
-                Attributes attributes = new LockableAttributesImpl();
-
-                ldifParser.parse( attributes, ldif );
+                Entry entry = ( Entry ) iterator.next();
 
-                String dn = ( String ) attributes.remove( "dn" ).get();
+                String dn = entry.getDn();
 
                 rdn = getRelativeName( ctx.getNameInNamespace(), dn );
 

Modified: directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java (original)
+++ directory/branches/elecharny/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java Sat May 13 07:25:54 2006
@@ -17,10 +17,12 @@
 package org.apache.directory.server.protocol.shared.store;
 
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
@@ -31,10 +33,9 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 
-import org.apache.directory.shared.ldap.ldif.LdifIterator;
-import org.apache.directory.shared.ldap.ldif.LdifParser;
-import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
-import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
+import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,7 +44,6 @@
  * Support for commands to load an LDIF file into a DirContext.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
  */
 public class LdifFileLoader
 {
@@ -146,16 +146,21 @@
         try
         {
             in = getLdifStream();
-            LdifIterator iterator = new LdifIterator( in );
-            LdifParser ldifParser = new LdifParserImpl();
+            LdifReader ldifIterator = new LdifReader( new BufferedReader( new InputStreamReader( in ) ) );
 
-            while ( iterator.hasNext() )
+            while ( ldifIterator.hasNext() )
             {
-                String ldif = ( String ) iterator.next();
-                Attributes attributes = new LockableAttributesImpl();
-                ldifParser.parse( attributes, ldif );
-                String dn = ( String ) attributes.remove( "dn" ).get();
+                Entry entry = ( Entry ) ldifIterator.next();
+                
+                String dn = entry.getDn();
+                
+                if ( entry.isEntry() == false)
+                {
+                	// If the entry is a modification, just skip it
+                	continue;
+                }
 
+                Attributes attributes = entry.getAttributes();
                 boolean filterAccepted = applyFilters( dn, attributes );
 
                 if ( !filterAccepted )

Modified: directory/branches/elecharny/apacheds/server-main/log4j.properties
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/server-main/log4j.properties?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/server-main/log4j.properties (original)
+++ directory/branches/elecharny/apacheds/server-main/log4j.properties Sat May 13 07:25:54 2006
@@ -1,12 +1,11 @@
-log4j.rootCategory=WARN, stdout
+log4j.rootCategory=DEBUG, stdout
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
 # with these we'll not get innundated when switching to DEBUG
-log4j.logger.org.apache.directory.shared.ldap.name=WARN
+#log4j.logger.org.apache.directory.shared.ldap.name=WARN
 log4j.logger.org.springframework=WARN
-log4j.logger.org.apache.directory.shared.codec=WARN
-log4j.logger.org.apache.directory.shared.asn1=WARN
+log4j.logger.org.apache.directory.shared.ldap.codec.TwixDecoder=DEBUG
 

Modified: directory/branches/elecharny/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original)
+++ directory/branches/elecharny/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Sat May 13 07:25:54 2006
@@ -21,12 +21,12 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Hashtable;
+import java.util.Iterator;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.Name;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
 
@@ -37,10 +37,8 @@
 import org.apache.directory.server.core.configuration.ShutdownConfiguration;
 import org.apache.directory.server.jndi.ServerContextFactory;
 import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
-import org.apache.directory.shared.ldap.ldif.LdifIterator;
-import org.apache.directory.shared.ldap.ldif.LdifParser;
-import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
-import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
+import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.name.LdapName;
 import org.apache.mina.util.AvailablePortFinder;
 
@@ -181,19 +179,19 @@
         Hashtable env = new Hashtable();
         env.putAll( sysRoot.getEnvironment() );
         LdapContext ctx = new InitialLdapContext( env, null );
-        LdifParser parser = new LdifParserImpl();
 
         try
         {
-            LdifIterator iterator = new LdifIterator( in );
+            Iterator iterator = new LdifReader( in );
+            
             while ( iterator.hasNext() )
             {
-                Attributes attributes = new LockableAttributesImpl();
-                String ldif = ( String ) iterator.next();
-                parser.parse( attributes, ldif );
-                Name dn = new LdapName( ( String ) attributes.remove( "dn" ).get() );
+                Entry entry = ( Entry) iterator.next();
+
+                Name dn = new LdapName( entry.getDn() );
                 dn.remove( 0 );
-                ctx.createSubcontext( dn, attributes );
+
+                ctx.createSubcontext( dn, entry.getAttributes() );
             }
         }
         catch ( Exception e )

Modified: directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java (original)
+++ directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java Sat May 13 07:25:54 2006
@@ -62,6 +62,7 @@
     public void decode( Object encoded ) throws DecoderException
     {
         ByteBuffer buf;
+        int position = 0;
 
         if ( encoded instanceof ByteBuffer )
         {
@@ -77,42 +78,47 @@
                 + encoded.getClass() );
         }
 
-        if ( log.isDebugEnabled() )
+        while ( buf.hasRemaining() )
         {
-            log.debug( "Decoding the PDU : " );
 
-            if ( buf.hasArray() )
-            {
-                log.debug( StringTools.dumpBytes( buf.array() ) );
-            }
-            else
-            {
-                byte[] array = new byte[buf.capacity()];
-                int i = 0;
+            ldapDecoder.decode( buf, ldapMessageContainer );
 
-                while ( buf.hasRemaining() )
-                {
-                    array[i++] = buf.get();
-                }
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( "Decoding the PDU : " );
 
+                int size = buf.position();
                 buf.flip();
+                
+            	byte[] array = new byte[ size - position ];
+            	
+            	for ( int i = position; i < size; i++ )
+            	{
+            		array[ i ] = buf.get();
+            	}
+
+                position = size;
+                
                 log.debug( StringTools.dumpBytes( array ) );
             }
-        }
-
-        while ( buf.hasRemaining() )
-        {
-            ldapDecoder.decode( buf, ldapMessageContainer );
-
+            
             if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
             {
                 if ( log.isDebugEnabled() )
                 {
                     log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage() );
+                    buf.mark();
                 }
 
                 decoderCallback.decodeOccurred( null, ldapMessageContainer.getLdapMessage() );
                 ldapMessageContainer.clean();
+            }
+            else
+            {
+            	if ( log.isDebugEnabled() )
+            	{
+            		
+            	}
             }
         }
     }

Modified: directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/Entry.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/Entry.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/Entry.java (original)
+++ directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/Entry.java Sat May 13 07:25:54 2006
@@ -20,12 +20,15 @@
 
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.ModificationItem;
@@ -44,7 +47,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class Entry
+public class Entry implements Cloneable
 {
     /** the version of the ldif */
     private int version;
@@ -353,6 +356,22 @@
     	
   		return attributeList.get( attributeId );
     }
+    
+    /**
+     * Get the entry's attributes 
+     * @return An Attributes
+     */
+    public Attributes getAttributes()
+    {
+    	if ( isEntry() )
+    	{
+    		return attributeList;
+    	}
+    	else
+    	{
+    		return null;
+    	}
+    }
 
     /**
      * @return True, if the old RDN should be deleted.
@@ -444,6 +463,11 @@
 	{
 		return changeType == MODIFY;
 	}
+	
+	public boolean isEntry()
+	{
+		return changeType == ADD; 
+	}
 
 	/**
 	 * @return The associated control, if any
@@ -460,5 +484,74 @@
 	public void setControl( Control control ) 
 	{
 		this.control = control;
+	}
+	
+	/**
+	 * Clone method
+	 */
+	public Object clone() throws CloneNotSupportedException
+	{
+		Entry clone = (Entry)super.clone();
+		
+		if ( modificationList != null )
+		{
+			for ( Iterator iter = modificationList.iterator(); iter.hasNext(); )
+			{
+				ModificationItem modif = (ModificationItem)(iter.next());
+				ModificationItem modifClone = new ModificationItem( modif.getModificationOp(), (Attribute)modif.getAttribute().clone() ) ;
+				clone.modificationList.add( modifClone );
+			}
+		}
+		
+		if ( modificationItems != null )
+		{
+			for ( Iterator iter = modificationItems.entrySet().iterator(); iter.hasNext(); )
+			{
+				Object key = iter.next();
+				ModificationItem modif = (ModificationItem)(modificationItems.get( key ));
+				ModificationItem modifClone = new ModificationItem( modif.getModificationOp(), (Attribute)modif.getAttribute().clone() ) ;
+				clone.modificationItems.put( key, modifClone );
+			}
+			
+		}
+		
+		if ( attributeList != null )
+		{
+			try
+			{
+				NamingEnumeration attrs = attributeList.getAll();
+				
+				while ( attrs.hasMore() )
+				{
+					Attribute attribute = (BasicAttribute)attrs.nextElement();
+					Attribute attrClone = new BasicAttribute( attribute.getID() );
+					
+					for ( NamingEnumeration iter = attribute.getAll(); iter.hasMoreElements();)
+					{
+						Object value = iter.next();
+						
+						if ( value instanceof String )
+						{
+							attrClone.add( value );
+						}
+						else if ( value instanceof byte[] )
+						{
+							int length = ((byte[])value).length;
+							byte[] valueClone = new byte[ length ];
+							System.arraycopy( value, 0, valueClone, 0, length );
+							attrClone.add( valueClone );
+						}
+					}
+					
+					clone.attributeList.put( attrClone );
+				}
+			}
+			catch ( NamingException ne )
+			{
+				throw new CloneNotSupportedException( ne.getMessage() );
+			}
+		}
+		
+		return clone;
 	}
 }

Modified: directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java (original)
+++ directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java Sat May 13 07:25:54 2006
@@ -54,77 +54,77 @@
      *            the multi map of single and multivalued attributes.
      * @return the LDIF as a String.
      */
-    public String compose( MultiMap a_attrHash )
+    public String compose( MultiMap attrHash )
     {
-        Object l_val = null;
-        String l_key = null;
-        Iterator l_keys = a_attrHash.keySet().iterator();
-        Iterator l_values = null;
-        Collection l_valueCol = null;
-        StringWriter l_sw = new StringWriter();
-        PrintWriter l_out = new PrintWriter( l_sw );
+        Object val = null;
+        String key = null;
+        Iterator keys = attrHash.keySet().iterator();
+        Iterator values = null;
+        Collection valueCol = null;
+        StringWriter sw = new StringWriter();
+        PrintWriter out = new PrintWriter( sw );
 
-        while ( l_keys.hasNext() )
+        while ( keys.hasNext() )
         {
-            l_key = ( String ) l_keys.next();
-            l_valueCol = ( Collection ) a_attrHash.get( l_key );
-            l_values = l_valueCol.iterator();
+            key = ( String ) keys.next();
+            valueCol = ( Collection ) attrHash.get( key );
+            values = valueCol.iterator();
 
-            if ( l_valueCol.isEmpty() )
+            if ( valueCol.isEmpty() )
             {
                 continue;
             }
-            else if ( l_valueCol.size() == 1 )
+            else if ( valueCol.size() == 1 )
             {
-                l_out.print( l_key );
-                l_out.print( ':' );
-                l_val = l_values.next();
+                out.print( key );
+                out.print( ':' );
+                val = values.next();
 
-                if ( l_val.getClass().isArray() )
+                if ( val.getClass().isArray() )
                 {
-                    l_out.print( ": " );
-                    l_out.println( base64encode( ( byte[] ) l_val ) );
+                    out.print( ": " );
+                    out.println( base64encode( ( byte[] ) val ) );
                 }
                 else
                 {
-                    l_out.print( ' ' );
-                    l_out.println( l_val );
+                    out.print( ' ' );
+                    out.println( val );
                 }
                 continue;
             }
 
-            while ( l_values.hasNext() )
+            while ( values.hasNext() )
             {
-                l_out.print( l_key );
-                l_out.print( ':' );
-                l_val = l_values.next();
+                out.print( key );
+                out.print( ':' );
+                val = values.next();
 
-                if ( l_val.getClass().isArray() )
+                if ( val.getClass().isArray() )
                 {
-                    l_out.print( ": " );
-                    l_out.println( base64encode( ( byte[] ) l_val ) );
+                    out.print( ": " );
+                    out.println( base64encode( ( byte[] ) val ) );
                 }
                 else
                 {
-                    l_out.print( ' ' );
-                    l_out.println( l_val );
+                    out.print( ' ' );
+                    out.println( val );
                 }
             }
         }
 
-        return l_sw.getBuffer().toString();
+        return sw.getBuffer().toString();
     }
 
 
     /**
      * Encodes an binary data into a base64 String.
      * 
-     * @param a_byteArray
+     * @param byteArray
      *            the value of a binary attribute.
      * @return the encoded binary data as a char array.
      */
-    public char[] base64encode( byte[] a_byteArray )
+    public char[] base64encode( byte[] byteArray )
     {
-        return Base64.encode( a_byteArray );
+        return Base64.encode( byteArray );
     }
 }

Modified: directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java (original)
+++ directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java Sat May 13 07:25:54 2006
@@ -5,7 +5,9 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringReader;
@@ -187,6 +189,37 @@
 	}
 
 	/**
+	 * Constructors
+	 */
+	public LdifReader( BufferedReader in )  throws NamingException
+	{
+		this.in = in;
+		lines = new ArrayList();
+		position = new Position();
+		version = DEFAULT_VERSION;
+		
+		// First get the version - if any -
+		version = parseVersion();
+		prefetched = parseEntry();
+	}
+
+	/**
+	 * Constructors
+	 */
+	public LdifReader( Reader in )  throws NamingException
+	{
+		this( new BufferedReader( in ) );
+	}
+
+	/**
+	 * Constructors
+	 */
+	public LdifReader( InputStream in )  throws NamingException
+	{
+		this( new BufferedReader( new InputStreamReader( in ) ) );
+	}
+
+	/**
 	 * @return The ldif file version
 	 */
 	public int getVersion() 
@@ -922,7 +955,7 @@
     {
 		if ( ( lines == null ) || ( lines.size() == 0 ) )
 		{
-			log.warn( "The entry is empty : end of ldif file ???" );
+			log.debug( "The entry is empty : end of ldif file" );
 			return null;
 		}
 		
@@ -1249,7 +1282,7 @@
 	 * A method which parses a ldif string and returns a list of entries.
 	 * 
 	 * @param ldif The ldif string
-	 * @return A list of entries
+	 * @return A list of entries, or an empty List
 	 * @throws NamingException If something went wrong
 	 */
 	public List parseLdif( String ldif ) throws NamingException
@@ -1258,7 +1291,7 @@
 		
 		if ( StringTools.isEmpty( ldif ) )
 		{
-			return null;
+			return new ArrayList();
 		}
 		
 		StringReader strIn = new StringReader( ldif );

Modified: directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java (original)
+++ directory/branches/elecharny/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java Sat May 13 07:25:54 2006
@@ -23,12 +23,14 @@
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.FileInputStream;
+import java.io.StringReader;
 
 import javax.naming.directory.Attributes;
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.NotImplementedException;
-import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
+import org.apache.directory.shared.ldap.ldif.Entry;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 
 
@@ -689,13 +691,16 @@
             return values;
         }
 
-        if ( values == null )
+        String ldif = props.getProperty( key ).trim().replace( '*', '\n' );
+        
+        LdifReader ldifReader = new LdifReader( new StringReader( ldif ) );
+        
+        Entry entry = (Entry)ldifReader.next();
+        
+        if ( entry != null )
         {
-            values = new LockableAttributesImpl();
+        	values = entry.getAttributes();
         }
-
-        String ldif = props.getProperty( key ).trim().replace( '*', '\n' );
-        ( new LdifParserImpl() ).parse( values, ldif );
         return values;
     }
 }

Modified: directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java?rev=406112&r1=406104&r2=406112&view=diff
==============================================================================
--- directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java (original)
+++ directory/branches/elecharny/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java Sat May 13 07:25:54 2006
@@ -74,7 +74,7 @@
         LdifReader reader = new LdifReader();
         List entries = reader.parseLdif( ldif );
         
-        assertNull( entries );
+        assertEquals( 0, entries.size() );
 	}
 	
 	public void testLdifEmpty() throws NamingException
@@ -84,7 +84,7 @@
         LdifReader reader = new LdifReader();
         List entries = reader.parseLdif( ldif );
 
-        assertNull( entries );
+        assertEquals( 0, entries.size() );
 	}
 	
 	public void testLdifEmptyLines() throws NamingException
@@ -532,6 +532,57 @@
 		    " IGlzIGJhc2UtNjQtZW5jb2RlZCBiZWNhdXNlIGl0IGhhcyBhIGNvbnRyb2wgY2hhcmFjdG\n" +
 		    " VyIGluIGl0IChhIENSKS4NICBCeSB0aGUgd2F5LCB5b3Ugc2hvdWxkIHJlYWxseSBnZXQg\n" +
 		    " b3V0IG1vcmUu";
+
+        LdifReader reader = new LdifReader();
+        List entries = reader.parseLdif( ldif );
+
+        assertEquals( 1, entries.size() );
+        
+        // Entry 1
+        Entry entry = (Entry)entries.get(0);
+        assertTrue( entry.isChangeAdd() );
+        	
+        assertEquals( "cn=Gern Jensen, ou=Product Testing, dc=airius, dc=com", entry.getDn() );
+        
+        Attribute attr = entry.get( "objectclass" );
+        assertTrue( attr.contains( "top" ) );
+        assertTrue( attr.contains( "person" ) );
+        assertTrue( attr.contains( "organizationalPerson" ) );
+
+        attr = entry.get( "cn" );
+        assertTrue( attr.contains( "Gern Jensen" ) );
+        assertTrue( attr.contains( "Gern O Jensen" ) );
+
+        attr = entry.get( "sn" );
+        assertTrue( attr.contains( "Jensen" ) );
+
+        attr = entry.get( "uid" );
+        assertTrue( attr.contains( "gernj" ) );
+
+        attr = entry.get( "telephonenumber" );
+        assertTrue( attr.contains( "+1 408 555 1212" ) );
+        
+        attr = entry.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" ) ) );
+    }
+
+    public void testLdifParserRFC2849Sample3VariousSpacing() throws NamingException, Exception
+    {
+        String ldif = 
+		    "version:1\n" +
+		    "dn:cn=Gern Jensen, ou=Product Testing, dc=airius, dc=com  \n" +
+		    "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  ";
 
         LdifReader reader = new LdifReader();
         List entries = reader.parseLdif( ldif );