directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1060418 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/codec/controls/ main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/ main/java/org/apache/directory/shared/ldap/codec/controls/replicat...
Date Tue, 18 Jan 2011 15:34:21 GMT
Author: elecharny
Date: Tue Jan 18 15:34:21 2011
New Revision: 1060418

URL: http://svn.apache.org/viewvc?rev=1060418&view=rev
Log:
o Added equals() methods to controls
o Fixed some ignored LdifUtil test
o Modified the LdifEntry interface for addAttribute and addControl to use ellipsis notation

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
Tue Jan 18 15:34:21 2011
@@ -57,11 +57,9 @@ public abstract class AbstractControl ex
     /** The control length */
     private int controlLength;
     
+    /** The control decoder */
     protected ControlDecoder decoder;
 
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
     /**
      * Default constructor.
      */
@@ -213,10 +211,49 @@ public abstract class AbstractControl ex
     }
     
     
+    /**
+     * {@inheritDoc}
+     */
     public ControlDecoder getDecoder()
     {
         return decoder;
     }
+    
+    
+    /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object o )
+    {
+        if ( o == this )
+        {
+            return true;
+        }
+
+        if ( o == null )
+        {
+            return false;
+        }
+
+        if ( !( o instanceof Control ) )
+        {
+            return false;
+        }
+
+        Control otherControl = ( Control ) o;
+        
+        if ( !oid.equalsIgnoreCase( otherControl.getOid() ) )
+        {
+            return false;
+        }
+        
+        if ( criticality != otherControl.isCritical() )
+        {
+            return false;
+        }
+
+        return hasValue() == otherControl.hasValue();
+    }
 
 
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeControl.java
Tue Jan 18 15:34:21 2011
@@ -20,9 +20,8 @@
 package org.apache.directory.shared.ldap.codec.controls;
 
 
-
-
 /**
+ * The Cascade control
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyRequestControl.java
Tue Jan 18 15:34:21 2011
@@ -45,5 +45,4 @@ public class PasswordPolicyRequestContro
     {
         return super.computeLength( 0 );
     }
-
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java
Tue Jan 18 15:34:21 2011
@@ -21,6 +21,7 @@ package org.apache.directory.shared.ldap
 
 
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
@@ -215,6 +216,22 @@ public class SyncDoneValueControl extend
 
 
     /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        SyncDoneValueControl otherControl = ( SyncDoneValueControl ) o;
+
+        return ( refreshDeletes == otherControl.refreshDeletes ) && ( Arrays.equals(
cookie, otherControl.cookie ) );
+    }
+
+
+   /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java
Tue Jan 18 15:34:21 2011
@@ -108,7 +108,7 @@ public class SyncInfoValueControl extend
         this.type = type;
 
         // Initialize the arrayList if needed
-        if ( type == SynchronizationInfoEnum.SYNC_ID_SET && syncUUIDs == null )
+        if ( ( type == SynchronizationInfoEnum.SYNC_ID_SET ) && ( syncUUIDs == null
) )
         {
             syncUUIDs = new ArrayList<byte[]>();
         }
@@ -531,6 +531,47 @@ public class SyncInfoValueControl extend
 
     
     /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        SyncInfoValueControl otherControl = ( SyncInfoValueControl ) o;
+
+        if ( syncUUIDs != null )
+        {
+            if ( otherControl.syncUUIDs == null )
+            {
+                return false;
+            }
+            
+            // @TODO : check the UUIDs
+            for ( byte[] syncUuid : syncUUIDs )
+            {
+            }
+        }
+        else
+        {
+            if ( otherControl.syncUUIDs != null )
+            {
+                return false;
+            }
+        }
+        
+        return ( refreshDeletes == otherControl.refreshDeletes ) &&
+            ( refreshDone == otherControl.refreshDone ) &&
+            ( type == otherControl.type ) &&
+            ( Arrays.equals( cookie, otherControl.cookie ) );
+    }
+
+
+
+    
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java
Tue Jan 18 15:34:21 2011
@@ -21,6 +21,7 @@ package org.apache.directory.shared.ldap
 
 
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
@@ -235,6 +236,24 @@ public class SyncStateValueControl  exte
 
 
     /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        SyncStateValueControl otherControl = ( SyncStateValueControl ) o;
+        
+        return ( syncStateType == otherControl.syncStateType ) && 
+            ( Arrays.equals( entryUUID, otherControl.entryUUID ) ) &&
+            ( Arrays.equals( cookie, otherControl.cookie ) );
+    }
+
+
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
Tue Jan 18 15:34:21 2011
@@ -308,6 +308,54 @@ public class SyncModifyDnControl extends
 
 
     /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        SyncModifyDnControl otherControl = ( SyncModifyDnControl ) o;
+        
+        if ( newRdn != null )
+        {
+            if ( newRdn.equals( otherControl.newRdn ) )
+            {
+                return false;
+            }
+        }
+        else
+        {
+            if ( otherControl.newRdn != null )
+            {
+                return false;
+            }
+        }
+        
+        if ( newSuperiorDn != null )
+        {
+            if ( newSuperiorDn.equals( otherControl.newSuperiorDn ) )
+            {
+                return false;
+            }
+        }
+        else
+        {
+            if ( otherControl.newSuperiorDn != null )
+            {
+                return false;
+            }
+        }
+        
+        return ( deleteOldRdn == otherControl.deleteOldRdn ) && 
+            ( modDnType == otherControl.modDnType ) &&
+            ( entryDn.equals( otherControl.entryDn ) );
+    }
+
+
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
Tue Jan 18 15:34:21 2011
@@ -277,6 +277,24 @@ public class EntryChangeControl extends 
 
 
     /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        EntryChangeControl otherControl = ( EntryChangeControl ) o;
+
+        return ( changeNumber == otherControl.changeNumber ) &&
+             ( changeType == otherControl.changeType ) &&
+             ( previousDn.equals( otherControl.previousDn ) );
+    }
+
+    
+    /**
      * Return a String representing this EntryChangeControl.
      */
     public String toString()

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java
Tue Jan 18 15:34:21 2011
@@ -21,6 +21,7 @@ package org.apache.directory.shared.ldap
 
 
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
@@ -263,6 +264,22 @@ public class PagedResultsControl extends
 
 
     /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        PagedResultsControl otherControl = ( PagedResultsControl ) o;
+
+        return ( size == otherControl.size ) && Arrays.equals( cookie, otherControl.cookie
);
+    }
+
+
+    /**
      * Return a String representing this PagedSearchControl.
      */
     public String toString()

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java
Tue Jan 18 15:34:21 2011
@@ -144,6 +144,22 @@ public class SubentriesControl extends A
 
 
     /**
+     * @see Object#equals(Object)
+     */
+    public boolean equals( Object o )
+    {
+        if ( !super.equals( o ) )
+        {
+            return false;
+        }
+
+        SubentriesControl otherControl = ( SubentriesControl ) o;
+
+        return ( visibility == otherControl.visibility );
+    }
+
+
+    /**
      * Return a String representing this EntryChangeControl.
      */
     public String toString()

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
Tue Jan 18 15:34:21 2011
@@ -265,18 +265,28 @@ public class LdifEntry implements Clonea
      * 
      * @param id The attribute ID
      * 
-     * @param value The attribute value
+     * @param values The attribute values
      * @throws LdapException if something went wrong
      */
-    public void addAttribute( String id, Object value ) throws LdapException
+    public void addAttribute( String id, Object... values ) throws LdapException
     {
-        if ( value instanceof String )
+        if ( values != null )
         {
-            entry.add( id, ( String ) value );
+            for ( Object value : values )
+            {
+                if ( value instanceof String )
+                {
+                    entry.add( id, ( String ) value );
+                }
+                else
+                {
+                    entry.add( id, ( byte[] ) value );
+                }
+            }
         }
         else
         {
-            entry.add( id, ( byte[] ) value );
+            entry.add( id, (Value<?>)null );
         }
     }
 
@@ -584,26 +594,29 @@ public class LdifEntry implements Clonea
     /**
      * Add a control to the entry
      * 
-     * @param control The added control
+     * @param controls The added controls
      */
-    public void addControl( Control control )
+    public void addControl( Control... controls )
     {
-        if ( control == null )
+        if ( controls == null )
         {
             throw new IllegalArgumentException( "The added control must not be null" );
         }
 
-        if ( changeType == ChangeType.None )
-        {
-            changeType = ChangeType.Add;
-        }
-
-        if ( controls == null )
+        for ( Control control : controls )
         {
-            controls = new ConcurrentHashMap<String, Control>();
+            if ( changeType == ChangeType.None )
+            {
+                changeType = ChangeType.Add;
+            }
+    
+            if ( this.controls == null )
+            {
+                this.controls = new ConcurrentHashMap<String, Control>();
+            }
+    
+            this.controls.put( control.getOid(), control );
         }
-
-        controls.put( control.getOid(), control );
     }
 
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java?rev=1060418&r1=1060417&r2=1060418&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
Tue Jan 18 15:34:21 2011
@@ -38,15 +38,12 @@ import org.apache.directory.junit.tools.
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControl;
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
-import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
 import org.apache.directory.shared.ldap.entry.Entry;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.util.StringTools;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -350,11 +347,7 @@ public class LdifUtilsTest
         entry.setDn( "cn=Saarbr\u00FCcken, dc=example, dc=com" );
         entry.setChangeType( ChangeType.Add );
         
-        EntryAttribute oc = new DefaultEntryAttribute( "objectClass" );
-        oc.add( "top", "person", "inetorgPerson" );
-        
-        entry.addAttribute( oc );
-        
+        entry.addAttribute( "objectClass", "top", "person", "inetorgPerson" );
         entry.addAttribute( "cn", "Saarbr\u00FCcken" );
         entry.addAttribute( "sn", "test" );
 
@@ -487,9 +480,10 @@ public class LdifUtilsTest
     
     
     @Test
-    @Ignore("The attributes are not printed in the same order in Java5 and Java6")
     public void testConvertEntryNoControls() throws Exception 
     {
+        LdifReader reader = new LdifReader();
+
         String expected = 
             "dn: ou=test\n" +
             "ObjectClass: top\n" +
@@ -498,28 +492,34 @@ public class LdifUtilsTest
             "m-oid: 1.2.3.4\n" +
             "m-description: description\n\n";
         
+        List<LdifEntry> entries = reader.parseLdif( expected );
+        LdifEntry expectedEntry = entries.get( 0 );
+
         LdifEntry entry = new LdifEntry();
         
         entry.setDn( "ou=test" );
-        entry.addAttribute( "ObjectClass", "top" );
-        entry.addAttribute( "ObjectClass", "metaTop" );
-        entry.addAttribute( "ObjectClass", "metaSyntax" );
+        entry.addAttribute( "ObjectClass", "top", "metaTop", "metaSyntax" );
         entry.addAttribute( "m-oid", "1.2.3.4" );
         entry.addAttribute( "m-description", "description" );
         
         String converted = LdifUtils.convertToLdif( entry );
         
         assertNotNull( converted );
-        assertEquals( expected, converted );
+        
+        entries = reader.parseLdif( converted );
+        LdifEntry convertedEntry = entries.get( 0 );
+
+        assertEquals( expectedEntry, convertedEntry );
     }
 
 
     
     
     @Test
-    @Ignore("The attributes are not printed in the same order in Java5 and Java6")
     public void testConvertEntryOneControl() throws Exception 
     {
+        LdifReader reader = new LdifReader();
+
         String expected = 
             "dn: ou=test\n" +
             "control: 2.16.840.1.113730.3.4.2 false\n" +
@@ -529,13 +529,14 @@ public class LdifUtilsTest
             "ObjectClass: metaSyntax\n" +
             "m-oid: 1.2.3.4\n" +
             "m-description: description\n\n";
-        
+
+        List<LdifEntry> entries = reader.parseLdif( expected );
+        LdifEntry expectedEntry = entries.get( 0 );
+
         LdifEntry entry = new LdifEntry();
         
         entry.setDn( "ou=test" );
-        entry.addAttribute( "ObjectClass", "top" );
-        entry.addAttribute( "ObjectClass", "metaTop" );
-        entry.addAttribute( "ObjectClass", "metaSyntax" );
+        entry.addAttribute( "ObjectClass", "top", "metaTop", "metaSyntax" );
         entry.addAttribute( "m-oid", "1.2.3.4" );
         entry.addAttribute( "m-description", "description" );
         
@@ -546,6 +547,10 @@ public class LdifUtilsTest
         String converted = LdifUtils.convertToLdif( entry );
         
         assertNotNull( converted );
-        assertEquals( expected, converted );
+        
+        entries = reader.parseLdif( converted );
+        LdifEntry convertedEntry = entries.get( 0 );
+
+        assertEquals( expectedEntry, convertedEntry );
     }
 }



Mime
View raw message