directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r686511 - in /directory: apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/ apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ apacheds/branches/bigbang/core/src/test/java/or...
Date Sat, 16 Aug 2008 15:23:02 GMT
Author: elecharny
Date: Sat Aug 16 08:23:02 2008
New Revision: 686511

URL: http://svn.apache.org/viewvc?rev=686511&view=rev
Log:
o Prepared the ChangeLog mechanism to accept more than one revert LdifEntry

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
    directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Sat Aug 16 08:23:02 2008
@@ -744,40 +744,43 @@
             while ( cursor.previous() ) // apply ldifs in reverse order
             {
                 ChangeLogEvent event = cursor.get();
-                LdifEntry reverse = event.getReverseLdif();
+                List<LdifEntry> reverses = event.getReverseLdifs();
                 
-                switch( reverse.getChangeType().getChangeType() )
+                for ( LdifEntry reverse:reverses )
                 {
-                    case( ChangeType.ADD_ORDINAL ):
-                        adminSession.add( 
-                            new DefaultServerEntry( registries, reverse.getEntry() ) ); 
-                        break;
-                        
-                    case( ChangeType.DELETE_ORDINAL ):
-                        adminSession.delete( reverse.getDn() );
-                        break;
-                        
-                    case( ChangeType.MODIFY_ORDINAL ):
-                        List<Modification> mods = reverse.getModificationItems();
-
-                        adminSession.modify( reverse.getDn(), mods );
-                        break;
-                        
-                    case( ChangeType.MODDN_ORDINAL ):
-                        // NO BREAK - both ModDN and ModRDN handling is the same
-                    
-                    case( ChangeType.MODRDN_ORDINAL ):
-                        LdapDN forwardDn = event.getForwardLdif().getDn();
-                        LdapDN reverseDn = event.getReverseLdif().getDn();
-                        
-                        moddn( reverseDn, forwardDn, reverse.isDeleteOldRdn() );
-
-                        break;
+                    switch( reverse.getChangeType().getChangeType() )
+                    {
+                        case( ChangeType.ADD_ORDINAL ):
+                            adminSession.add( 
+                                new DefaultServerEntry( registries, reverse.getEntry() )
); 
+                            break;
+                            
+                        case( ChangeType.DELETE_ORDINAL ):
+                            adminSession.delete( reverse.getDn() );
+                            break;
+                            
+                        case( ChangeType.MODIFY_ORDINAL ):
+                            List<Modification> mods = reverse.getModificationItems();
+    
+                            adminSession.modify( reverse.getDn(), mods );
+                            break;
+                            
+                        case( ChangeType.MODDN_ORDINAL ):
+                            // NO BREAK - both ModDN and ModRDN handling is the same
                         
-                    default:
-                        LOG.error( "ChangeType unknown" );
-                        throw new NotImplementedException( "Reverts of change type " + reverse.getChangeType()
-                                + " has not yet been implemented!");
+                        case( ChangeType.MODRDN_ORDINAL ):
+                            LdapDN forwardDn = event.getForwardLdif().getDn();
+                            LdapDN reverseDn = reverse.getDn();
+                            
+                            moddn( reverseDn, forwardDn, reverse.isDeleteOldRdn() );
+    
+                            break;
+                            
+                        default:
+                            LOG.error( "ChangeType unknown" );
+                            throw new NotImplementedException( "Reverts of change type "
+ reverse.getChangeType()
+                                    + " has not yet been implemented!");
+                    }
                 }
             }
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLog.java
Sat Aug 16 08:23:02 2008
@@ -20,6 +20,8 @@
 package org.apache.directory.server.core.changelog;
 
 
+import java.util.List;
+
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
@@ -75,6 +77,19 @@
 
 
     /**
+     * Records a change as a forward LDIF, some reverse changes to revert the change and
+     * the authorized principal triggering the revertable change event.
+     *
+     * @param principal the authorized LDAP principal triggering the change
+     * @param forward LDIF of the change going to the next state
+     * @param reverses LDIF (anti-operation): the changes required to revert this change
+     * @return the new revision reached after having applied the forward LDIF
+     * @throws Exception if there are problems logging the change
+     */
+    ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry>
reverses ) throws Exception;
+
+
+    /**
      * Returns whether or not this ChangeLogService supports searching for changes.
      *
      * @return true if log searching is supported, false otherwise

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java
Sat Aug 16 08:23:02 2008
@@ -24,6 +24,8 @@
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -42,7 +44,9 @@
     private String zuluTime;
     private long revision;
     private LdifEntry forwardLdif;
-    private LdifEntry reverseLdif;
+    
+    /** The revert changes. Can contain more than one single change */
+    private List<LdifEntry> reverseLdifs;
     private LdapPrincipal committer;
 
 
@@ -67,7 +71,28 @@
         this.zuluTime = zuluTime;
         this.revision = revision;
         this.forwardLdif = forwardLdif;
-        this.reverseLdif = reverseLdif;
+        this.reverseLdifs = new ArrayList<LdifEntry>(1);
+        reverseLdifs.add( reverseLdif );
+        this.committer = committer;
+    }
+
+
+    /**
+     * Creates a new instance of ChangeLogEvent.
+     *
+     * @param revision the revision number for the change
+     * @param zuluTime the timestamp for when the change occurred in generalizedTime format
+     * @param committer the user who did the modification
+     * @param forwardLdif the original operation
+     * @param reverseLdifs the reverted operations
+     */
+    public ChangeLogEvent( long revision, String zuluTime, LdapPrincipal committer, LdifEntry
forwardLdif,
+                           List<LdifEntry> reverseLdifs )
+    {
+        this.zuluTime = zuluTime;
+        this.revision = revision;
+        this.forwardLdif = forwardLdif;
+        this.reverseLdifs = reverseLdifs;
         this.committer = committer;
     }
 
@@ -84,9 +109,9 @@
     /**
      * @return the reverseLdif
      */
-    public LdifEntry getReverseLdif()
+    public List<LdifEntry> getReverseLdifs()
     {
-        return reverseLdif;
+        return reverseLdifs;
     }
 
 
@@ -158,12 +183,18 @@
             forwardLdif = (LdifEntry)in.readObject();
         }
         
-        // Read the reverse LDIF
-        boolean hasReverseLdif = in.readBoolean();
+        // Read the reverse LDIF number
+        int nbReverseLdif = in.readInt();
         
-        if ( hasReverseLdif )
+        if ( nbReverseLdif > 0 )
         {
-            reverseLdif = (LdifEntry)in.readObject();
+            // Read each reverse ldif
+            reverseLdifs = new ArrayList<LdifEntry>(nbReverseLdif);
+            
+            for ( int i = 0; i < nbReverseLdif; i++ )
+            {
+                reverseLdifs.add( (LdifEntry)in.readObject() ); 
+            }
         }
     }
 
@@ -207,10 +238,15 @@
         }
         
         // write the reverse LDIF
-        if ( reverseLdif != null )
+        if ( reverseLdifs != null )
         {
-            out.writeBoolean( true );
-            out.writeObject( reverseLdif );
+            out.writeInt( reverseLdifs.size() );
+            
+            // write each reverse
+            for ( LdifEntry reverseLdif:reverseLdifs )
+            {
+                out.writeObject( reverseLdif );
+            }
         }
         else
         {
@@ -244,8 +280,17 @@
         .append( getForwardLdif() )
         .append( ", " );
         
-        sb.append( "\nreverseLdif=" )
-        .append( getReverseLdif() );
+        if ( reverseLdifs != null )
+        {
+            sb.append( "\nreverseLdif number=" ).append( reverseLdifs.size() );
+            int i = 0;
+            
+            for ( LdifEntry reverseLdif:reverseLdifs )
+            {
+                sb.append( "\nReverse[" ).append( i++ ).append( "] :\n" );
+                sb.append( reverseLdif );
+            }
+        }
         
         sb.append( " }" );
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
Sat Aug 16 08:23:02 2008
@@ -299,10 +299,10 @@
         forward.setNewRdn( renameContext.getNewRdn().getUpName() );
         forward.setDeleteOldRdn( renameContext.getDelOldDn() );
 
-        LdifEntry reverse = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl(
serverEntry ), 
+        List<LdifEntry> reverses = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl(
serverEntry ), 
             null, renameContext.getDn(), new Rdn( renameContext.getNewRdn() ) );
         
-        renameContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse
) );
+        renameContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverses
) );
     }
 
 
@@ -331,9 +331,9 @@
         forward.setNewRdn( opCtx.getNewRdn().getUpName() );
         forward.setNewSuperior( opCtx.getParent().getUpName() );
 
-        LdifEntry reverse = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl(
serverEntry ), 
+        List<LdifEntry> reverses = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl(
serverEntry ), 
             opCtx.getParent(), opCtx.getDn(), new Rdn( opCtx.getNewRdn() ) );
-        opCtx.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
+        opCtx.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverses ) );
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogStore.java
Sat Aug 16 08:23:02 2008
@@ -20,6 +20,8 @@
 package org.apache.directory.server.core.changelog;
 
 
+import java.util.List;
+
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.DirectoryService;
@@ -67,6 +69,19 @@
 
     
     /**
+     * Records a change as a forward LDIF, some reverse changes to revert the change and
+     * the authorized principal triggering the revertable change event.
+     *
+     * @param principal the authorized LDAP principal triggering the change
+     * @param forward LDIF of the change going to the next state
+     * @param reverses LDIF (anti-operation): the changes required to revert this change
+     * @return the new revision reached after having applied the forward LDIF
+     * @throws Exception if there are problems logging the change
+     */
+    ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry>
reverses ) throws Exception;
+
+    
+    /**
      * Looks up the ChangeLogEvent for a revision.
      *
      * @param revision to get a ChangeLogEvent for

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java
Sat Aug 16 08:23:02 2008
@@ -19,6 +19,8 @@
 package org.apache.directory.server.core.changelog;
 
 
+import java.util.List;
+
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.partition.Partition;
@@ -65,6 +67,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse
) throws Exception
     {
         if ( !enabled )
@@ -76,6 +81,20 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry>
reverses ) throws Exception
+    {
+        if ( !enabled )
+        {
+            throw new IllegalStateException( "The ChangeLog has not been enabled." );
+        }
+
+        return store.log( principal, forward, reverses );
+    }
+
+
     public boolean isLogSearchSupported()
     {
         return store instanceof SearchableChangeLogStore;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
Sat Aug 16 08:23:02 2008
@@ -412,6 +412,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse
) throws Exception
     {
         currentRevision++;
@@ -422,6 +425,19 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry>
reverses ) throws Exception
+    {
+        currentRevision++;
+        ChangeLogEvent event = new ChangeLogEvent( currentRevision, DateUtils.getGeneralizedTime(),

+                principal, forward, reverses );
+        events.add( event );
+        return event;
+    }
+
+
     public ChangeLogEvent lookup( long revision ) throws Exception
     {
         if ( revision < 0 )

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
Sat Aug 16 08:23:02 2008
@@ -151,6 +151,6 @@
         assertEquals( zuluTime, read.getZuluTime() );
         assertEquals( revision, read.getRevision() );
         assertEquals( forward, read.getForwardLdif() );
-        assertEquals( reverse, read.getReverseLdif() );
+        assertEquals( reverse, read.getReverseLdifs().get( 0 ) );
     }
 }

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
Sat Aug 16 08:23:02 2008
@@ -624,7 +624,7 @@
      * @return A new LDIF entry with a reverted DN
      * @throws NamingException If the name reverting failed
      */
-    public static LdifEntry reverseRename( Attributes t0, LdapDN t0_dn, Rdn t1_rdn ) throws
NamingException
+    public static List<LdifEntry> reverseRename( Attributes t0, LdapDN t0_dn, Rdn t1_rdn
) throws NamingException
     {
         LdifEntry entry = new LdifEntry();
         LdapDN parent = null;
@@ -651,11 +651,15 @@
         newDn = ( LdapDN ) parent.clone();
         newDn.add( t1_rdn );
 
+        List<LdifEntry> entries = new ArrayList<LdifEntry>(1);
+        
         entry.setChangeType( ChangeType.ModRdn );
         entry.setDeleteOldRdn( reverseDoDeleteOldRdn( t0, t1_rdn ) );
         entry.setDn( newDn );
         entry.setNewRdn( t0_dn.getRdn().getUpName() );
-        return entry;
+        
+        entries.add( entry );
+        return entries;
     }
 
 
@@ -668,10 +672,10 @@
      * @param t1_parentDn the new superior dn if this is a move, otherwise null
      * @param t0_dn the dn of the entry being modified
      * @param t1_rdn the new rdn to use
-     * @return A reverse LDIF
+     * @return A reverse LDIF, with potentially more than one reverse operation 
      * @throws NamingException If something went wrong
      */
-    public static LdifEntry reverseModifyRdn( Attributes t0, LdapDN t1_parentDn, LdapDN t0_dn,
Rdn t1_rdn )
+    public static List<LdifEntry> reverseModifyRdn( Attributes t0, LdapDN t1_parentDn,
LdapDN t0_dn, Rdn t1_rdn )
             throws NamingException
     {
         if ( t0_dn == null )
@@ -686,6 +690,8 @@
 
         // if there is no new superior in the picture then this is a rename
         // operation where the parent is retained and only the rdn is changed
+        // We still have to take care that the entry attributes are correctly
+        // restored if the new RDN has more than one AVAs
         if ( t1_parentDn == null )
         {
             return reverseRename( t0, t0_dn, t1_rdn );
@@ -695,7 +701,11 @@
         // a name change, we can delegate this to a simpler method
         if ( t1_rdn == null )
         {
-            return reverseModifyDn( t1_parentDn, t0_dn );
+            List<LdifEntry> entries = new ArrayList<LdifEntry>(1);
+            LdifEntry entry = reverseModifyDn( t1_parentDn, t0_dn );
+            entries.add( entry );
+            
+            return entries;
         }
 
         // -------------------------------------------------------------------
@@ -728,7 +738,9 @@
         reverse.setChangeType( ChangeType.ModRdn );
         reverse.setDeleteOldRdn( reverseDoDeleteOldRdn( t0, t1_rdn ) );
 
-        return reverse;
+        List<LdifEntry> entries = new ArrayList<LdifEntry>(1);
+        entries.add( reverse );
+        return entries;
     }
 
 

Modified: directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java?rev=686511&r1=686510&r2=686511&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
Sat Aug 16 08:23:02 2008
@@ -481,9 +481,12 @@
         attrs.put( "sn", "doe" );
         attrs.put( "uid", "jdoe" );
 
-        LdifEntry reversed = LdifUtils.reverseModifyRdn( attrs, null, dn, new Rdn( "cn=jack
doe" ) );
+        List<LdifEntry> reverseds = LdifUtils.reverseModifyRdn( attrs, null, dn, new
Rdn( "cn=jack doe" ) );
 
-        assertNotNull( reversed );
+        assertNotNull( reverseds );
+        assertEquals( 1, reverseds.size() );
+        
+        LdifEntry reversed = reverseds.get( 0 );
         assertEquals( "cn=jack doe, dc=example, dc=com", reversed.getDn().getUpName() );
         assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
         assertTrue( reversed.isDeleteOldRdn() );
@@ -512,9 +515,12 @@
         attrs.put( "sn", "doe" );
         attrs.put( "uid", "jdoe" );
 
-        LdifEntry reversed = LdifUtils.reverseModifyRdn( attrs, null, dn, new Rdn( "cn=jack
doe" ) );
+        List<LdifEntry> reverseds = LdifUtils.reverseModifyRdn( attrs, null, dn, new
Rdn( "cn=jack doe" ) );
 
-        assertNotNull( reversed );
+        assertNotNull( reverseds );
+        assertEquals( 1, reverseds.size() );
+        
+        LdifEntry reversed = reverseds.get( 0 );
         assertEquals( "cn=jack doe, dc=example, dc=com", reversed.getDn().getUpName() );
         assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
         assertFalse( reversed.isDeleteOldRdn() );
@@ -550,9 +556,12 @@
         attrs.put( "sn", "doe" );
         attrs.put( "uid", "jdoe" );
 
-        LdifEntry reversed = LdifUtils.reverseModifyRdn( attrs, newSuperior, dn, new Rdn(
"cn=jack doe" ) );
+        List<LdifEntry> reverseds = LdifUtils.reverseModifyRdn( attrs, newSuperior,
dn, new Rdn( "cn=jack doe" ) );
 
-        assertNotNull( reversed );
+        assertNotNull( reverseds );
+        assertEquals( 1, reverseds.size() );
+        
+        LdifEntry reversed = reverseds.get( 0 );
         assertEquals( "cn=jack doe,ou=system", reversed.getDn().getUpName() );
         assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
         assertFalse( reversed.isDeleteOldRdn() );
@@ -580,9 +589,12 @@
         attrs.put( "sn", "doe" );
         attrs.put( "uid", "jdoe" );
 
-        LdifEntry reversed = LdifUtils.reverseModifyRdn( attrs, newSuperior, dn, null );
+        List<LdifEntry> reverseds = LdifUtils.reverseModifyRdn( attrs, newSuperior,
dn, null );
 
-        assertNotNull( reversed );
+        assertNotNull( reverseds );
+        assertEquals( 1, reverseds.size() );
+        
+        LdifEntry reversed = reverseds.get( 0 );
         assertEquals( "cn=john doe,ou=system", reversed.getDn().getUpName() );
         assertEquals( ChangeType.ModDn, reversed.getChangeType() );
         assertFalse( reversed.isDeleteOldRdn() );
@@ -609,9 +621,12 @@
         attrs.put( "sn", "doe" );
         attrs.put( "uid", "jdoe" );
 
-        LdifEntry reversed = LdifUtils.reverseModifyRdn( attrs, newSuperior, dn, new Rdn(
"cn=jack doe" ) );
+        List<LdifEntry> reverseds = LdifUtils.reverseModifyRdn( attrs, newSuperior,
dn, new Rdn( "cn=jack doe" ) );
 
-        assertNotNull( reversed );
+        assertNotNull( reverseds );
+        assertEquals( 1, reverseds.size() );
+        
+        LdifEntry reversed = reverseds.get( 0 );
         assertEquals( "cn=jack doe,ou=system", reversed.getDn().getUpName() );
         assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
         assertTrue( reversed.isDeleteOldRdn() );



Mime
View raw message