From 89ae8bcf6fecee466e91f6484553be7ef25a2a3f Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Fri, 04 Jul 2014 08:18:20 +0000
Subject: [PATCH] OPENDJ-1505 (CR-3946) OpenDJ SDK tools prompt for user credentials even when none are needed * ConnectionFactoryProvider.java DSConfig.java ** Refactoring code by removing unused constructor and fields ** Perform anonymous connection by default * src/main[..]/ldap/tools/*.java ** Making tools not interactive * src/test[..]/ldap/tools/*.java ** Adding some basic integration tests cases to ensure that general tools behavior is ok * pom.xml ** Update and clean dependencies

---
 opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java |   30 ++++--------------------------
 1 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java
index dcabc64..f7eae61 100644
--- a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java
+++ b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java
@@ -155,9 +155,6 @@
     /** The console application linked to this connection in interactive mode. */
     private final ConsoleApplication app;
 
-    /** The LDAP options for this connection. */
-    private LDAPOptions options;
-
     /** If this connection should be an admin connection. */
     private boolean isAdminConnection = false;
 
@@ -174,25 +171,7 @@
      */
     public ConnectionFactoryProvider(final ArgumentParser argumentParser,
             final ConsoleApplication app) throws ArgumentException {
-        this(argumentParser, app, CliConstants.DEFAULT_ROOT_USER_DN, DEFAULT_LDAP_PORT, false, null);
-    }
-
-    /**
-     * Default constructor to create a connection factory designed for use with command line tools,
-     * adding basic LDAP connection arguments to the specified parser (e.g: hostname, bindname...etc).
-     *
-     * @param argumentParser
-     *            The argument parser.
-     * @param app
-     *            The console application linked to this connection factory.
-     * @param options
-     *            The common options for this LDAP client connection.
-     * @throws ArgumentException
-     *             If an error occurs during parsing the arguments.
-     */
-    public ConnectionFactoryProvider(final ArgumentParser argumentParser, final ConsoleApplication app,
-            final LDAPOptions options) throws ArgumentException {
-        this(argumentParser, app, CliConstants.DEFAULT_ROOT_USER_DN, DEFAULT_LDAP_PORT, false, options);
+        this(argumentParser, app, "", DEFAULT_LDAP_PORT, false);
     }
 
     /**
@@ -209,16 +188,13 @@
      *            The LDAP port default's value.
      * @param alwaysSSL
      *            {@code true} if this connection should be used with SSL.
-     * @param options
-     *            The LDAP options of this connection factory.
      * @throws ArgumentException
      *             If an error occurs during parsing the elements.
      */
     public ConnectionFactoryProvider(final ArgumentParser argumentParser,
             final ConsoleApplication app, final String defaultBindDN, final int defaultPort,
-            final boolean alwaysSSL, final LDAPOptions options) throws ArgumentException {
+            final boolean alwaysSSL) throws ArgumentException {
         this.app = app;
-        this.options = options == null ? new LDAPOptions() : options;
         useSSLArg = CommonArguments.getUseSSL();
 
         if (!alwaysSSL) {
@@ -450,6 +426,8 @@
                         e);
             }
 
+            LDAPOptions options = new LDAPOptions();
+
             if (sslContext != null) {
                 options.setSSLContext(sslContext).setUseStartTLS(useStartTLSArg.isPresent());
             }

--
Gitblit v1.10.0