Search in sources :

Example 1 with LDAPServer

use of com.emc.storageos.api.ldap.ldapserver.LDAPServer in project coprhd-controller by CoprHD.

the class ApiTestAuthnProviderUtils method startLdapServer.

public void startLdapServer(final String listenerName) throws LDIFException, LDAPException, IOException, FileOperationFailedException, GeneralSecurityException, DirectoryOrFileNotFoundException, InterruptedException {
    if (ldapServer == null) {
        ldapServer = new LDAPServer();
    }
    if (ldapServer.isRunning()) {
        ldapServer.stop();
    }
    ldapServer.setListenerName(listenerName);
    boolean started = false;
    int iteration = RETRY_START_COUNT;
    while (started != true && iteration < MAX_START_RETRIES) {
        try {
            ldapServer.start();
            started = true;
        } catch (LDAPException ex) {
            _log.error("Caught bind exception {}", ex.getCause());
            _log.info("Retry count {} and waiting for {}secs before next retry.", iteration, RETRY_WAIT_TIME);
            iteration++;
            Thread.sleep(iteration * RETRY_WAIT_TIME * MILLI_SECOND_MULTIPLIER);
        }
    }
}
Also used : LDAPException(com.unboundid.ldap.sdk.LDAPException) LDAPServer(com.emc.storageos.api.ldap.ldapserver.LDAPServer)

Aggregations

LDAPServer (com.emc.storageos.api.ldap.ldapserver.LDAPServer)1 LDAPException (com.unboundid.ldap.sdk.LDAPException)1