org.apache.directory.api.ldap.model.name.Rdn Java Examples

The following examples show how to use org.apache.directory.api.ldap.model.name.Rdn. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestDnNode.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
@Test
public void testHasParentDN() throws Exception
{
    DnNode<Dn> tree = new DnNode<Dn>();
    Dn dn1 = new Dn( "dc=c,dc=b,dc=a" );
    tree.add( dn1, dn1 );

    Dn dn2 = new Dn( "dc=e,dc=a" );
    tree.add( dn2, dn2 );

    assertFalse( tree.hasParent( Dn.EMPTY_DN ) );

    DnNode<Dn> child = tree.getChild( new Rdn( "dc=a" ) );
    assertTrue( tree.hasParent( new Dn( "dc=a" ) ) );

    child = child.getChild( new Rdn( "dc=b" ) );
    assertTrue( tree.hasParent( new Dn( "dc=b,dc=a" ) ) );

    child = child.getChild( new Rdn( "dc=c" ) );
    assertTrue( tree.hasParent( new Dn( "dc=c,dc=b,dc=a" ) ) );

    assertTrue( tree.hasParent( new Dn( "dc=f,dc=e,dc=c,dc=b,dc=a" ) ) );
}
 
Example #2
Source File: TestDnNode.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetParent() throws Exception
{
    DnNode<Dn> tree = new DnNode<Dn>();
    Dn dn = new Dn( "dc=c,dc=b,dc=a" );
    tree.add( dn, dn );

    assertNull( tree.getParent() );

    DnNode<Dn> child = tree.getChild( new Rdn( "dc=a" ) );
    assertEquals( tree, child.getParent() );

    DnNode<Dn> child1 = child.getChild( new Rdn( "dc=b" ) );
    assertEquals( child, child1.getParent() );

    child = child1.getChild( new Rdn( "dc=c" ) );
    assertEquals( child1, child.getParent() );
}
 
Example #3
Source File: DnNode.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * rename the DnNode's Dn
 * 
 * @param newRdn the new Rdn of this node
 * @throws LdapException If the rename failed
 */
public synchronized void rename( Rdn newRdn ) throws LdapException
{
    Dn temp = nodeDn.getParent();
    temp = temp.add( newRdn );

    Rdn oldRdn = nodeRdn;

    nodeRdn = temp.getRdn();
    nodeDn = temp;

    if ( parent != null )
    {
        parent.children.remove( oldRdn.getNormName() );
        parent.children.put( nodeRdn.getNormName(), this );
    }

    updateAfterModDn( nodeDn );
}
 
Example #4
Source File: Runner.java    From aws-iam-ldap-bridge with Apache License 2.0 6 votes vote down vote up
public void createStructure() throws Exception {
    String rootDN = AWSIAMAuthenticator.getConfig().rootDN;
    Dn dnIAM = service.getDnFactory().create(rootDN);
    if (!utils.exists(dnIAM)) {
        IAM_LOG.info("Creating partition " + rootDN);
        Partition iamPartition = utils.addPartition("iam", rootDN, service.getDnFactory());

        // Index some attributes on the apache partition
        utils.addIndex(iamPartition, "objectClass", "ou", "uid", "gidNumber", "uidNumber", "cn");

        if (!utils.exists(dnIAM)) {
            IAM_LOG.info("Creating root node " + rootDN);
            Rdn rdn = dnIAM.getRdn(0);
            Entry entryIAM = new DefaultEntry(service.getSchemaManager(), dnIAM, "objectClass: top", "objectClass: domain",
                    "entryCsn: " + service.getCSN(), SchemaConstants.ENTRY_UUID_AT + ": " + UUID.randomUUID().toString(),
                    rdn.getType() + ": " + rdn.getValue());
            service.getAdminSession().add(entryIAM);
            checkErrors();
        }
    }
    service.sync();
}
 
Example #5
Source File: TestDnNode.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
@Test
public void testHasElement() throws Exception
{
    DnNode<Dn> tree = new DnNode<Dn>();
    Dn dn = new Dn( "dc=c,dc=b,dc=a" );
    tree.add( dn, dn );

    assertFalse( tree.hasElement() );

    DnNode<Dn> child = tree.getChild( new Rdn( "dc=a" ) );
    assertFalse( child.hasElement() );

    child = child.getChild( new Rdn( "dc=b" ) );
    assertFalse( child.hasElement() );

    child = child.getChild( new Rdn( "dc=c" ) );
    assertTrue( child.hasElement() );
}
 
Example #6
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * test a composite Rdn with or without spaces: a=b, a =b, a= b, a = b, a =
 * b
 * 
 * @throws LdapException
 */
@Test
public void testRdnCompositeWithSpace() throws LdapException
{
    assertEquals( "a=b", new Rdn( "a", "b" ).getName() );
    assertEquals( " a=b", new Rdn( " a", "b" ).getName() );
    assertEquals( "a =b", new Rdn( "a ", "b" ).getName() );
    assertEquals( "a= b", new Rdn( "a", " b" ).getName() );
    assertEquals( "a=b ", new Rdn( "a", "b " ).getName() );
    assertEquals( " a =b", new Rdn( " a ", "b" ).getName() );
    assertEquals( " a= b", new Rdn( " a", " b" ).getName() );
    assertEquals( " a=b ", new Rdn( " a", "b " ).getName() );
    assertEquals( "a = b", new Rdn( "a ", " b" ).getName() );
    assertEquals( "a =b ", new Rdn( "a ", "b " ).getName() );
    assertEquals( "a= b ", new Rdn( "a", " b " ).getName() );
    assertEquals( " a = b", new Rdn( " a ", " b" ).getName() );
    assertEquals( " a =b ", new Rdn( " a ", "b " ).getName() );
    assertEquals( " a= b ", new Rdn( " a", " b " ).getName() );
    assertEquals( "a = b ", new Rdn( "a ", " b " ).getName() );
    assertEquals( " a = b ", new Rdn( " a ", " b " ).getName() );
}
 
Example #7
Source File: LdifRevertorTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Test a reversed rename ModifyDN, where the Rdn are both simple, not overlapping,
 * with deleteOldRdn = true, and the Ava not present in the initial entry
 * 
 * Covers case 2.1 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * sn: This is a test
 * 
 * new Rdn : cn=joe
 *
 * @throws LdapException on error
 */
@Test
public void test21ReverseRenameSimpleSimpleNotOverlappingDeleteOldRdnDontExistInEntry() throws LdapException
{
    Dn dn = new Dn( "cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "cn=test" );
    Rdn newRdn = new Rdn( "cn=joe" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.DELETE_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 1, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "cn=joe,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertTrue( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );
}
 
Example #8
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Test for DIRSHARED-2.
 * The first ATAV is equal, the second or following ATAV differs.
 * 
 * @throws LdapException
 */
@Test
public void testCompareSecondAtav() throws LdapException
{
    // the second ATAV differs
    Rdn rdn1 = new Rdn( " a = b + c = d " );
    Rdn rdn2 = new Rdn( " a = b + c = y " );
    assertFalse( rdn1.equals( rdn2 ) );
    assertFalse( rdn2.equals( rdn1 ) );

    // the third ATAV differs
    Rdn rdn3 = new Rdn( " a = b + c = d + e = f " );
    Rdn rdn4 = new Rdn( " a = b + c = d + e = y " );
    assertFalse( rdn3.equals( rdn4 ) );
    assertFalse( rdn4.equals( rdn3 ) );

    // the second ATAV differs in value only
    Rdn rdn5 = new Rdn( " a = b + b = c " );
    Rdn rdn6 = new Rdn( " a = b + b = y " );
    assertFalse( rdn5.equals( rdn6 ) );
    assertFalse( rdn6.equals( rdn5 ) );
}
 
Example #9
Source File: TestDnNode.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Test the addition of a Dn with three Rdn
 */
@Test
public void testAdd3LevelDN() throws LdapException
{
    DnNode<Dn> tree = new DnNode<Dn>();
    Dn dn = new Dn( "dc=c,dc=b,dc=a" );

    tree.add( dn, dn );

    assertNotNull( tree );

    Map<String, DnNode<Dn>> children = tree.getChildren();
    assertNotNull( children );

    assertEquals( 1, children.size() );
    assertNull( tree.getElement() );

    DnNode<Dn> level1 = children.get( new Rdn( "dc=a" ).getNormName() );
    DnNode<Dn> level2 = level1.getChildren().get( new Rdn( "dc=b" ).getNormName() );
    DnNode<Dn> level3 = level2.getChildren().get( new Rdn( "dc=c" ).getNormName() );

    assertNotNull( level3 );
    assertEquals( dn, level3.getElement() );
}
 
Example #10
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * test an Rdn with escaped comma
 */
@Test
public void testRdnWithEscapedComa() throws LdapException
{
    assertTrue( Rdn.isValid( "a=b\\,c" ) );
    assertEquals( "a=b\\,c", new Rdn( "a=b\\,c" ).getName() );

    assertTrue( Rdn.isValid( "a=\"b,c\"" ) );
    assertEquals( "a=\"b,c\"", new Rdn( "a=\"b,c\"" ).getName() );
    assertEquals( "a=b\\,c", new Rdn( "a=\"b,c\"" ).getEscaped() );
    assertEquals( "a=\"b,c\"", new Rdn( "a=\"b,c\"" ).getName() );

    assertTrue( Rdn.isValid( "a=\"b\\,c\"" ) );
    Rdn rdn = new Rdn( "a=\"b\\,c\"" );
    assertEquals( "a=\"b\\,c\"", rdn.getName() );
    assertEquals( "a=b\\,c", rdn.getEscaped() );
}
 
Example #11
Source File: TestDnNode.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
@Test
public void testHasChildren() throws Exception
{
    DnNode<Dn> tree = new DnNode<Dn>();
    Dn dn1 = new Dn( "dc=b,dc=a" );
    tree.add( dn1 );

    assertTrue( tree.hasChildren() );
    Map<String, DnNode<Dn>> children = tree.getChildren();
    assertNotNull( children );

    DnNode<Dn> child = children.get( new Rdn( "dc=a" ).getNormName() );
    assertTrue( child.hasChildren() );

    children = child.getChildren();
    child = children.get( new Rdn( "dc=b" ).getNormName() );
    assertFalse( child.hasChildren() );
}
 
Example #12
Source File: LdifRevertorTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Test a reversed rename ModifyDN, where the Rdn are both simple, not overlapping,
 * with deleteOldRdn = false, and the Ava not present in the initial entry?
 * 
 * Covers case 1.1 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * sn: This is a test
 * 
 * new Rdn : cn=joe
 *
 * @throws LdapException on error
 */
@Test
public void test11ReverseRenameSimpleSimpleNotOverlappingKeepOldRdnDontExistInEntry() throws LdapException
{
    Dn dn = new Dn( "cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "cn=test" );
    Rdn newRdn = new Rdn( "cn=joe" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.KEEP_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 1, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "cn=joe,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertTrue( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );
}
 
Example #13
Source File: LdifRevertorTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Test a reversed move ModifyDN
 *
 * @throws LdapException on error
 */
@Test
public void testReverseModifyDNMove() throws LdapException
{
    Dn dn = new Dn( "cn=john doe, dc=example, dc=com" );
    Dn newSuperior = new Dn( "ou=system" );
    Rdn rdn = new Rdn( "cn=john doe" );

    LdifEntry reversed = LdifRevertor.reverseMove( newSuperior, dn );

    assertNotNull( reversed );

    assertEquals( "cn=john doe,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModDn, reversed.getChangeType() );
    assertFalse( reversed.isDeleteOldRdn() );
    assertEquals( rdn.getName(), reversed.getNewRdn() );
    assertEquals( "dc=example, dc=com", Strings.trim( reversed.getNewSuperior() ) );
    assertNull( reversed.getEntry() );
}
 
Example #14
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test the creation of a new Rdn
 * 
 * @throws org.apache.directory.api.ldap.model.exception.LdapException
 */
@Test
public void testRDNCreation() throws LdapException
{
    Rdn rdn = new Rdn( "A", "  b  " );
    assertEquals( "A=  b  ", rdn.getName() );
    assertEquals( "A=\\  b \\ ", rdn.getEscaped() );
}
 
Example #15
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
@Test
public void testUnescapeValueStringWithPoundInTheMiddle()
{
    String res = ( String ) Rdn.unescapeValue( "a#b" );

    assertEquals( "a#b", res );
}
 
Example #16
Source File: DnNode.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Get's a child using an rdn string.
 *
 * @param rdn the rdn to use as the node key
 * @return the child node corresponding to the rdn.
 */
public synchronized DnNode<N> getChild( Rdn rdn )
{
    if ( children.containsKey( rdn.getNormName() ) )
    {
        return children.get( rdn.getNormName() );
    }

    return null;
}
 
Example #17
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
@Test
public void testUnescapeValueString()
{
    String res = ( String ) Rdn.unescapeValue( "azerty" );

    assertEquals( "azerty", res );
}
 
Example #18
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Compares a simple NC to a simple NC in UperCase.
 * 
 * @throws LdapException
 */
@Test
public void testRDNCompareToNC2NCUperCase() throws LdapException
{
    Rdn rdn1 = new Rdn( " a = b " );
    Rdn rdn2 = new Rdn( " A = b " );

    assertTrue( rdn1.equals( rdn2 ) );
}
 
Example #19
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Compares a simple NC to a different simple NC.
 * 
 * @throws LdapException
 */
@Test
public void testRDNCompareToNC2NCNotEquals() throws LdapException
{
    Rdn rdn1 = new Rdn( " a = b " );
    Rdn rdn2 = new Rdn( " A = d " );

    assertFalse( rdn1.equals( rdn2 ) );
}
 
Example #20
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * Test the getValue method.
 *
 * @throws LdapException
 */
@Test
public void testGetValue() throws LdapException
{
    Rdn rdn = new Rdn( " a = b + b = f + g = h + c = d " );

    assertEquals( "b", rdn.getValue() );
}
 
Example #21
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * Test the getType method.
 *
 * @throws LdapException
 */
@Test
public void testGetType() throws LdapException
{
    Rdn rdn = new Rdn( " a = b + b = f + g = h + c = d " );

    assertEquals( "a", rdn.getNormType() );
}
 
Example #22
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Compares a composite NCS to a different composite NCS.
 * 
 * @throws LdapException
 */
@Test
public void testRDNCompareToNCS2NCSNotEquals() throws LdapException
{
    Rdn rdn1 = new Rdn( " a = f + g = h + c = d " );
    Rdn rdn2 = new Rdn( " c = d + a = h + g = h " );

    assertFalse( rdn1.equals( rdn2 ) );
    assertFalse( rdn2.equals( rdn1 ) );
}
 
Example #23
Source File: TestDnNode.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test the addition of two DNs not overlapping
 */
@Test
public void testAdd2DistinctDNsNoElem() throws LdapException
{
    DnNode<Dn> tree = new DnNode<Dn>();
    Dn dn1 = new Dn( "dc=b,dc=a" );
    Dn dn2 = new Dn( "dc=f,dc=e" );

    tree.add( dn1 );
    tree.add( dn2 );

    assertNotNull( tree );

    Map<String, DnNode<Dn>> children = tree.getChildren();
    assertNotNull( children );

    assertEquals( 2, children.size() );
    assertNull( tree.getElement() );

    DnNode<Dn> level1 = children.get( new Rdn( "dc=a" ).getNormName() );
    DnNode<Dn> level2 = level1.getChildren().get( new Rdn( "dc=b" ).getNormName() );

    assertNotNull( level2 );
    assertFalse( level2.hasElement() );

    level1 = children.get( new Rdn( "dc=e" ).getNormName() );
    level2 = level1.getChildren().get( new Rdn( "dc=f" ).getNormName() );

    assertNotNull( level2 );
    assertFalse( level2.hasElement() );
}
 
Example #24
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * test exception from illegal hexString attribute value : a=#zz.
 */
@Test
public void testBadRdnHexStringAttributeValue() throws LdapException
{
    try
    {
        new Rdn( "a=#zz" );
        fail();
    }
    catch ( LdapException ine )
    {
        assertTrue( true );
    }
}
 
Example #25
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * test a simple Rdn with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C3\A9"
 * 
 * @throws LdapException
 */
@Test
public void testRdnPairCharAttributeValue() throws LdapException
{
    String rdn = Strings.utf8ToString( new byte[]
        { 'a', '=', '\\', ',', '\\', '=', '\\', '+', '\\', '<', '\\', '>', '#', '\\', ';', '\\', '\\', '\\', '"', '\\',
            'C', '3', '\\', 'A', '9' } );
    assertEquals( "a=\\,\\=\\+\\<\\>#\\;\\\\\\\"\\C3\\A9", new Rdn( rdn ).getName() );
    assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\u00e9", new Rdn( rdn ).getEscaped() );
}
 
Example #26
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * test a composite Rdn with differents separators : a=b+c=d, e=f + g=h +
 * i=j
 * 
 * @throws LdapException
 */
@Test
public void testRdnCompositeMultivaluedAttribute() throws LdapException
{
    Rdn rdn = new Rdn( "a =b+c=d + e=f + g  =h + i =j " );

    // NameComponent are not ordered
    assertEquals( "b", rdn.getValue( "a" ) );
    assertEquals( "d", rdn.getValue( "c" ) );
    assertEquals( "f", rdn.getValue( "  E  " ) );
    assertEquals( "h", rdn.getValue( "g" ) );
    assertEquals( "j", rdn.getValue( "i" ) );
}
 
Example #27
Source File: RdnTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * test a simple Rdn with differents separators : a = b + c = d
 * 
 * @throws LdapException
 */
@Test
public void testRdnSimpleMultivaluedAttribute() throws LdapException
{
    String result = new Rdn( "a = b + c = d" ).getName();
    assertEquals( "a = b + c = d", result );
}
 
Example #28
Source File: DefaultCoreSession.java    From MyVirtualDirectory with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void moveAndRename( Dn dn, Dn newSuperiorDn, Rdn newRdn, boolean deleteOldRdn, LogChange log )
    throws LdapException
{
    MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn,
        newSuperiorDn, newRdn, deleteOldRdn );

    moveAndRenameContext.setLogChange( log );

    OperationManager operationManager = directoryService.getOperationManager();
    operationManager.moveAndRename( moveAndRenameContext );
}
 
Example #29
Source File: FastRdnParserTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * test that a RDN can have an attributeType twice
 */
@Test
public void testAvaConstructorRdnAtUsedTwice() throws LdapException
{
    Rdn rdn = new Rdn( new Ava( "A", "b" ), new Ava( "A", "d" ) );

    assertEquals( "A=b+A=d", rdn.getName() );
}
 
Example #30
Source File: LdifRevertorTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test a reversed rename ModifyDN, where the initial Rdn is composite,
 * the new Rdn is composite, they are overlapping, with deleteOldRdn = true, and
 * some of the new values exists in the entry.
 * 
 * Covers case 13.1 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: sn=small+cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * sn: small
 * sn: big
 * sn: This is a test
 * 
 * new Rdn : sn=big+cn=test
 *
 * @throws LdapException on error
 */
@Test
public void test132ReverseRenameCompositeCompositeOverlappingDeleteOldRdnExistInEntry() throws LdapException
{
    Dn dn = new Dn( "sn=small+cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "sn=small+cn=test" );
    Rdn newRdn = new Rdn( "sn=big+cn=test" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "sn: small",
        "sn: big",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.DELETE_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 1, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "sn=big+cn=test,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertFalse( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );
}