@Test
public void testLdifMoveAndRenameWithDeletingOldRDN() throws Exception
{
SingleFileLdifPartition partition = injectEntries();
Dn childDn1 = new Dn( schemaManager, "dc=child1,ou=test,ou=system" );
Dn childDn2 = new Dn( schemaManager, "dc=child2,ou=test,ou=system" );
Rdn newRdn = new Rdn( SchemaConstants.DC_AT + "=" + "movedChild1" );
MoveAndRenameOperationContext moveAndRenameOpCtx = new MoveAndRenameOperationContext( mockSession, childDn1,
childDn2, newRdn, true );
partition.moveAndRename( moveAndRenameOpCtx );
partition = reloadPartition();
childDn1 = new Dn( schemaManager, "dc=movedChild1,dc=child2,ou=test,ou=system" );
Entry entry = partition.lookup( new LookupOperationContext( mockSession, childDn1 ) );
assertNotNull( entry );
Attribute dc = entry.get( "dc" );
assertFalse( dc.contains( "child1" ) );
assertTrue( dc.contains( "movedChild1" ) );