td.rootCtx.createSubcontext( "ou=deep" );
Attributes ouAttrs = new BasicAttributes( "objectClass", "top", true ); ouAttrs.get( "objectClass" ).add( "organizationalUnit" ); ouAttrs.put( "ou", "deep" ); td.rootCtx.createSubcontext( "ou=deep", ouAttrs );
    public void createDeepLocalUser() throws Exception    {        LdapContext userCtx = null;        Attributes referral = new BasicAttributes( "objectClass", "top", true );        referral.get( "objectClass" ).add( "person" );        referral.put( "cn", "akarasulu" );        referral.put( "sn", "karasulu" );        try        {            td.rootCtx.destroySubcontext( "uid=akarasulu,ou=deep" );        }        catch ( NameNotFoundException e )        {        }        try        {            td.rootCtx.destroySubcontext( "ou=deep" );        }        catch ( NameNotFoundException e )        {        }        try        {            td.rootCtx.createSubcontext( "ou=deep" );            userCtx = ( LdapContext ) td.rootCtx.createSubcontext( "cn=akarasulu,ou=deep", referral );        }        catch ( NameAlreadyBoundException e )        {            td.refCtx = ( LdapContext ) td.rootCtx.lookup( "cn=akarasulu,ou=deep" );        }        referral = userCtx.getAttributes( "" );        assertTrue( referral.get( "cn" ).contains( "akarasulu" ) );        assertTrue( referral.get( "sn" ).contains( "karasulu" ) );    }