From 4ac356097dcac43d825439af057c1480167842b4 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Tue, 24 Mar 2015 11:13:48 +0000
Subject: [PATCH] OPENDJ-1886: Remove short option for testonly arg

---
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java |    7 ++++++-
 opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java                |    3 +++
 opendj-sdk/opendj-server-legacy/resource/bin/_script-util.sh                                       |   10 +++++-----
 opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java                  |   17 -----------------
 opendj-sdk/opendj-server-legacy/resource/bin/_script-util.bat                                      |    6 +++---
 opendj-sdk/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat                           |    4 ++--
 opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/tool.properties                   |    2 ++
 opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties                   |    2 --
 8 files changed, 21 insertions(+), 30 deletions(-)

diff --git a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java
index 86f7723..371b980 100644
--- a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java
+++ b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java
@@ -405,6 +405,9 @@
     /** Value for the restart option long form. */
     public static final String OPTION_LONG_RESTART = "restart";
 
+    /** The value for the hidden testonly argument. */
+    public static final String OPTION_LONG_TESTONLY_ARGUMENT = "testOnly";
+
     /** Prevent instantiation. */
     private ArgumentConstants() {
     }
diff --git a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java
index a7ffe93..12c7a9d 100644
--- a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java
+++ b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java
@@ -304,23 +304,6 @@
     }
 
     /**
-     * Returns the "testonly" boolean argument.
-     * <br><i> N.B : the 't' short option is also used by targetldif, timelimit,
-     * trustmanagerproviderdn, stoptime, start(dateTime)</i>
-     *
-     * @return The "testonly" argument.
-     * @throws ArgumentException
-     *             If there is a problem with any of the parameters used to create this argument.
-     */
-    public static BooleanArgument getTestOnly() throws ArgumentException {
-        final BooleanArgument testOnly = new BooleanArgument("testOnly".toLowerCase(), 't', "testOnly",
-                INFO_ARGUMENT_DESCRIPTION_TESTONLY.get());
-        testOnly.setHidden(true);
-        testOnly.setPropertyName("testOnly");
-        return testOnly;
-    }
-
-    /**
      * Returns the "trustAll" boolean argument.
      *
      * @return The "trustAll" argument.
diff --git a/opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties b/opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties
index 2bcfc1c..444d981 100755
--- a/opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties
+++ b/opendj-sdk/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties
@@ -570,8 +570,6 @@
 #
 INFO_SETUP_TITLE=OPENDJ3 Setup tool
 INFO_SETUP_DESCRIPTION=This utility can be used to setup the Directory Server
-INFO_ARGUMENT_DESCRIPTION_TESTONLY=Just verify that the JVM can be \
- started properly
 INFO_ARGUMENT_DESCRIPTION_CLI=Use the command line install. \
  If not specified the graphical interface will be launched.  The rest of the \
  options (excluding help and version) will only be taken into account if this \
diff --git a/opendj-sdk/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat b/opendj-sdk/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
index 576bb81..8cb983b 100755
--- a/opendj-sdk/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
+++ b/opendj-sdk/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
@@ -23,7 +23,7 @@
 rem
 rem
 rem      Copyright 2008-2009 Sun Microsystems, Inc.
-rem      Portions copyright 2013 ForgeRock AS.
+rem      Portions copyright 2013-2015 ForgeRock AS.
 
 set SET_JAVA_HOME_AND_ARGS_DONE=false
 set SET_ENVIRONMENT_VARS_DONE=false
@@ -159,7 +159,7 @@
 :notSupportedJavaHome
 rem We get here when the java version is 5 (or up) but not supported.  We run
 rem InstallDS again to see a localized message.
-"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opendj.server.tools.InstallDS -t
+"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opendj.server.tools.InstallDS --testonly
 pause
 exit /B 1
 
diff --git a/opendj-sdk/opendj-server-legacy/resource/bin/_script-util.bat b/opendj-sdk/opendj-server-legacy/resource/bin/_script-util.bat
index 866cfa2..cc3c2c7 100644
--- a/opendj-sdk/opendj-server-legacy/resource/bin/_script-util.bat
+++ b/opendj-sdk/opendj-server-legacy/resource/bin/_script-util.bat
@@ -22,7 +22,7 @@
 rem
 rem
 rem      Copyright 2008-2010 Sun Microsystems, Inc.
-rem      Portions Copyright 2011-2014 ForgeRock AS
+rem      Portions Copyright 2011-2015 ForgeRock AS
 
 set SET_JAVA_HOME_AND_ARGS_DONE=false
 set SET_ENVIRONMENT_VARS_DONE=false
@@ -182,7 +182,7 @@
 :testJava
 if "%OPENDJ_JAVA_ARGS%" == "" goto checkLegacyArgs
 :continueTestJava
-"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opends.server.tools.InstallDS -t > NUL 2>&1
+"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opends.server.tools.InstallDS --testonly > NUL 2>&1
 set RESULT_CODE=%errorlevel%
 if %RESULT_CODE% == 13 goto notSupportedJavaHome
 if not %RESULT_CODE% == 0 goto noValidJavaHome
@@ -215,7 +215,7 @@
 :notSupportedJavaHome
 rem We get here when the java version is 6 (or up) but not supported.  We run
 rem InstallDS again to see a localized message.
-"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opends.server.tools.InstallDS -t
+"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opends.server.tools.InstallDS --testonly
 pause
 exit /B 1
 
diff --git a/opendj-sdk/opendj-server-legacy/resource/bin/_script-util.sh b/opendj-sdk/opendj-server-legacy/resource/bin/_script-util.sh
index a4668fb..1d1024e 100644
--- a/opendj-sdk/opendj-server-legacy/resource/bin/_script-util.sh
+++ b/opendj-sdk/opendj-server-legacy/resource/bin/_script-util.sh
@@ -23,7 +23,7 @@
 #
 #
 #      Copyright 2008-2010 Sun Microsystems, Inc.
-#      Portions Copyright 2010-2014 ForgeRock AS
+#      Portions Copyright 2010-2015 ForgeRock AS
 
 #
 # Display an error message
@@ -177,13 +177,13 @@
 test_java() {
   if test -z "${OPENDJ_JAVA_ARGS}"
   then
-    "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
+    "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS --testonly 2> /dev/null
     RESULT_CODE=${?}
     if test ${RESULT_CODE} -eq 13
     then
       # This is a particular error code that means that the Java version is 6
       # but not supported.  Let InstallDS to display the localized error message
-      "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS -t
+      "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS --testonly
       exit 1
     elif test ${RESULT_CODE} -ne 0
     then
@@ -204,13 +204,13 @@
       exit 1
     fi
   else
-    "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
+    "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} org.opends.server.tools.InstallDS --testonly 2> /dev/null
     RESULT_CODE=${?}
     if test ${RESULT_CODE} -eq 13
     then
       # This is a particular error code that means that the Java version is 6
       # but not supported.  Let InstallDS to display the localized error message
-      "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS -t
+      "${OPENDJ_JAVA_BIN}" org.opends.server.tools.InstallDS --testonly
       exit 1
     elif test ${RESULT_CODE} -ne 0
     then
diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java
index 37e29fb..395523d 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java
@@ -125,7 +125,12 @@
    */
   public void initializeArguments() throws ArgumentException
   {
-    testOnlyArg = CommonArguments.getTestOnly();
+    testOnlyArg = new BooleanArgument(
+            OPTION_LONG_TESTONLY_ARGUMENT.toLowerCase(), null,
+            OPTION_LONG_TESTONLY_ARGUMENT,
+            INFO_ARGUMENT_DESCRIPTION_TESTONLY.get());
+    testOnlyArg.setHidden(true);
+    testOnlyArg.setPropertyName(OPTION_LONG_TESTONLY_ARGUMENT);
     addArgument(testOnlyArg);
 
     cliArg = CommonArguments.getCLI();
diff --git a/opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/tool.properties b/opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/tool.properties
index b87ec2e..0d31c5e 100644
--- a/opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/tool.properties
+++ b/opendj-sdk/opendj-server-legacy/src/messages/org/opends/messages/tool.properties
@@ -3038,3 +3038,5 @@
     After upgrading, see the resulting <filename>upgrade.log</filename> file       \
     for a full list of operations performed.                                       \
    </para>
+INFO_ARGUMENT_DESCRIPTION_TESTONLY_20005=Just verify that the JVM can be \
+ started properly

--
Gitblit v1.10.0