Example usage for javax.naming.directory InitialDirContext unbind

List of usage examples for javax.naming.directory InitialDirContext unbind

Introduction

In this page you can find the example usage for javax.naming.directory InitialDirContext unbind.

Prototype

public void unbind(String name) throws NamingException 

Source Link

Usage

From source file:org.apache.archiva.redback.authentication.ldap.LdapBindAuthenticatorTest.java

@After
public void tearDown() throws Exception {
    // clear the cache
    ldapCacheService.removeAllLdapUserDn();

    InitialDirContext context = apacheDs.getAdminContext();

    context.unbind(createDn("jesse"));

    context.unbind(createDn("joakim"));

    context.unbind(createDn("brent"));

    if (!apacheDs.isStopped()) {
        apacheDs.stopServer();// w  w w.  j  av  a 2 s  .c om
    }

    super.tearDown();
}

From source file:org.apache.archiva.redback.rest.services.LdapGroupMappingServiceTest.java

@Override
public void stopServer() throws Exception {

    // cleanup ldap entries
    InitialDirContext context = apacheDs.getAdminContext();

    for (String group : this.groups) {
        context.unbind(createGroupDn(group));
    }/*from   w  w w  . j av  a 2  s .  co  m*/

    context.unbind(suffix);

    context.close();

    apacheDs.stopServer();

    super.stopServer();
}

From source file:org.apache.archiva.redback.users.ldap.LdapUserManagerTest.java

@After
public void tearDown() throws Exception {
    // clear cache
    ldapCacheService.removeAllUsers();//from   w  w w.j  a v  a2s  .  c om

    InitialDirContext context = apacheDs.getAdminContext();

    context.unbind(createDn("jesse"));

    context.unbind(createDn("joakim"));

    apacheDs.stopServer();

    super.tearDown();
}

From source file:org.apache.archiva.redback.common.ldap.role.TestLdapRoleMapper.java

@After
public void tearDown() throws Exception {
    // clear cache
    //ldapCacheService.removeAllUsers();

    InitialDirContext context = apacheDs.getAdminContext();

    for (String uid : users) {
        context.unbind(createDn(uid));
    }//from w  ww.  j  a  v a  2  s.c  om

    for (Map.Entry<String, List<String>> group : usersPerGroup.entrySet()) {
        context.unbind(createGroupDn(group.getKey()));
    }

    context.unbind(suffix);

    context.close();

    ldapConnection.close();

    apacheDs.stopServer();

    super.tearDown();
}

From source file:org.apache.archiva.redback.users.ldap.LdapUserManagerTest.java

private void clearManyUsers() throws Exception {
    InitialDirContext context = apacheDs.getAdminContext();

    for (int i = 0; i < 10000; i++) {
        String cn = "user" + i;
        try {/* www  . jav a  2s.  c  om*/
            context.unbind(createDn(cn));
        } catch (NamingException e) {
            // OK lets try with next one
        }
    }

}

From source file:org.apache.archiva.redback.rbac.ldap.LdapRbacManagerTest.java

@After
public void tearDown() throws Exception {

    InitialDirContext context = apacheDs.getAdminContext();
    /*// www.  j  a v a 2  s  . c  om
    for ( String uid : users )
    {
    context.unbind( createDn( uid ) );
    }
            
    for ( Map.Entry<String, List<String>> group : usersPerGroup.entrySet() )
    {
    context.unbind( createGroupDn( group.getKey() ) );
    }
    */
    context.unbind(suffix);

    apacheDs.stopServer();

    super.tearDown();
}