@Test
public void testAddAndRemove() throws Exception
{
Partition partition = new JdbmPartition();
partition.setId( "removable" );
partition.setSuffix( "ou=removable" );
// Test AddContextPartition
service.addPartition( partition );
LdapDN suffixDn = new LdapDN( "ou=removable" );
suffixDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
ServerEntry ctxEntry = new DefaultServerEntry( service.getRegistries(), suffixDn );
ctxEntry.put( "objectClass", "top" );
ctxEntry.get( "objectClass" ).add( "organizationalUnit" );
ctxEntry.put( "ou", "removable" );
ctxEntry.put( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
ctxEntry.put( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
partition.add( new AddOperationContext( service.getAdminSession(), ctxEntry ) );
Hashtable<String,Object> env = new Hashtable<String,Object>();
env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
env.put( DirectoryService.JNDI_KEY, service );
env.put( Context.SECURITY_CREDENTIALS, "secret" );