mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
08.01.2015 b531af710f30dbd69732f9803a55dd2c91f9d055
OPENDJ-1607 Merge HeartBeatConnectionFactory and AuthenticatedConnectionFactory into LDAPConnectionFactory

Consequences of merger and use of Options for configuraiton.
2 files modified
23 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java 17 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
@@ -71,6 +71,7 @@
import org.forgerock.opendj.ldap.SSLContextBuilder;
import org.forgerock.opendj.ldap.TrustManagers;
import org.forgerock.util.Options;
import org.forgerock.util.time.Duration;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor;
@@ -1174,8 +1175,7 @@
    // This connection should always be secure. useSSL = true.
    Connection connection = null;
    final Options options = Options.defaultOptions();
    options.set(CONNECT_TIMEOUT_IN_MILLISECONDS,
        TimeUnit.MILLISECONDS.toMillis((long) ci.getConnectTimeout()));
    options.set(CONNECT_TIMEOUT, new Duration((long) ci.getConnectTimeout(), TimeUnit.MILLISECONDS));
    LDAPConnectionFactory factory = null;
    while (true)
    {
@@ -1184,7 +1184,7 @@
        final SSLContextBuilder sslBuilder = new SSLContextBuilder();
        sslBuilder.setTrustManager(trustManager == null ? TrustManagers.trustAll() : trustManager);
        sslBuilder.setKeyManager(keyManager);
        options.set(USE_STARTTLS, ci.useStartTLS());
        options.set(SSL_USE_STARTTLS, ci.useStartTLS());
        options.set(SSL_CONTEXT, sslBuilder.getSSLContext());
        factory = new LDAPConnectionFactory(hostName, portNumber, options);
opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/AdaptersTestCase.java
@@ -26,6 +26,8 @@
package org.forgerock.opendj.adapter.server3x;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.LDAPConnectionFactory.AUTHN_BIND_REQUEST;
import static org.forgerock.opendj.ldap.requests.Requests.newSimpleBindRequest;
import java.security.GeneralSecurityException;
import java.util.NoSuchElementException;
@@ -71,6 +73,7 @@
import org.forgerock.opendj.ldap.responses.SearchResultEntry;
import org.forgerock.opendj.ldap.responses.WhoAmIExtendedResult;
import org.forgerock.opendj.ldif.ConnectionEntryReader;
import org.forgerock.util.Options;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.testng.annotations.AfterClass;
@@ -111,18 +114,20 @@
    @DataProvider
    public Object[][] rootConnectionFactories() {
        return new Object[][] {
            { Connections.newAuthenticatedConnectionFactory(
                   new LDAPConnectionFactory("localhost", getServerLdapPort()),
                   Requests.newSimpleBindRequest("cn=directory manager", "password".toCharArray())) },
            { new LDAPConnectionFactory("localhost",
                                        getServerLdapPort(),
                                        Options.defaultOptions()
                                               .set(AUTHN_BIND_REQUEST,
                                                    newSimpleBindRequest("cn=directory manager",
                                                                                  "password".toCharArray()))) },
            { Adapters.newConnectionFactoryForUser(DN.valueOf("cn=directory manager")) } };
    }
    /**
     * Launched before the tests, this function starts the server and
     * adds data.
     * Launched before the tests, this function starts the server and adds data.
     *
     * @throws Exception
     *             If the server could not be initialized.
     *         If the server could not be initialized.
     */
    @BeforeClass
    public void startServer() throws Exception {