@Test
public void testMove() throws Exception
{
Dn childDn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co." );
Entry childEntry = new DefaultEntry( schemaManager, childDn,
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"ou", "Engineering",
"cn", "Private Ryan",
"entryCSN", new CsnFactory( 1 ).newInstance().toString(),
"entryUUID", UUID.randomUUID().toString() );
AddOperationContext addContext = new AddOperationContext( null, childEntry );
store.add( addContext );
Dn parentDn = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
Rdn rdn = new Rdn( "cn=Ryan" );
store.moveAndRename( childDn, parentDn, rdn, childEntry, true );
// to drop the alias indices
childDn = new Dn( schemaManager, "commonName=Jim Bean,ou=Apache,ou=Board of Directors,o=Good Times Co." );
parentDn = new Dn( schemaManager, "ou=Engineering,o=Good Times Co." );
assertEquals( 3, store.getSubAliasIndex().count() );
Dn newDn = parentDn.add( childDn.getRdn() );
store.move( childDn, parentDn, newDn, null );
assertEquals( 3, store.getSubAliasIndex().count() );
}