List<Modification> modifications = new ArrayList<Modification>();
// First, inject the 'ou'
Modification mod = new DefaultModification(
ModificationOperation.ADD_ATTRIBUTE, new DefaultEntryAttribute( "ou", "BigCompany inc." ) );
modifications.add( mod );
// Remove the 'l'
mod = new DefaultModification(
ModificationOperation.REMOVE_ATTRIBUTE, new DefaultEntryAttribute( "l" ) );
modifications.add( mod );
// Add 'l=FR'
mod = new DefaultModification(
ModificationOperation.ADD_ATTRIBUTE, new DefaultEntryAttribute( "l", "FR" ) );
modifications.add( mod );
// Replace it with 'l=USA'
mod = new DefaultModification(
ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute( "l", "USA" ) );
modifications.add( mod );
// Replace the ou value
mod = new DefaultModification(
ModificationOperation.REPLACE_ATTRIBUTE, new DefaultEntryAttribute( "ou", "apache" ) );
modifications.add( mod );
LdifEntry reversedEntry = LdifRevertor.reverseModify( dn, modifications, initialEntry.getEntry() );
String expectedEntryLdif =