* the ManageDsaIt flag.
*/
@Test
public void testRenameExistingReferralCoreAPIWithManageDsaIt() throws Exception
{
CoreSession session = service.getAdminSession();
DN dnRoles = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );
DN dnGroups = new DN( "ou=Groups,o=MNN,c=WW,ou=system" );
RDN newRdn = new RDN( "ou=Groups" );
// First check that the object exists
ServerEntry renamed = session.lookup( dnRoles );
assertNotNull( renamed );
// Also check that the new entry does not exist
try
{
renamed = session.lookup( dnGroups );
fail();
}
catch ( NameNotFoundException nnfe )
{
assertTrue( true );
}
// Now renames the referral
session.rename( dnRoles, newRdn, false, true );
// It should not be there anymore
try
{
renamed = session.lookup( dnRoles );
fail();
}
catch ( NameNotFoundException nnfe )
{
assertTrue( true );
}
// But the new one should be there
renamed = session.lookup( dnGroups );
assertNotNull( renamed );
}