From 232d13d704160f8b3f8a7a3acfabee33d5349fc1 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 18 Jul 2007 23:32:04 +0000
Subject: [PATCH] In order to be coherent with the graphical UI and because it is more intuitive option, substitute the "noWindowsService" option of the CLI setup by "enableWindowsService" option.  The WIKI has been updated to reflect these changes.

---
 opends/src/server/org/opends/server/tools/InstallDS.java                           |   16 ++++++++--------
 opends/src/server/org/opends/server/messages/ToolMessages.java                     |    8 ++++----
 opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java |    8 +-------
 opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java         |   10 +++++-----
 opends/tests/functional-tests/shared/functions/dsadm.xml                           |    8 ++++----
 opends/tests/functional-tests/shared/functions/topology.xml                        |    6 +++---
 6 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
index dbed47c..2426473 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
@@ -141,7 +141,7 @@
     BooleanArgument   showUsage;
     BooleanArgument   silentInstall;
     BooleanArgument   skipPortCheck;
-    BooleanArgument   noWindowsService;
+    BooleanArgument   enableWindowsService;
     FileBasedArgument rootPWFile;
     IntegerArgument   ldapPort;
     IntegerArgument   jmxPort;
@@ -225,12 +225,12 @@
           null, null, MSGID_INSTALLDS_DESCRIPTION_ROOTPWFILE);
       argParser.addArgument(rootPWFile);
 
-      noWindowsService = new BooleanArgument("nowindowsservice", 'n',
-          "noWindowsService",
-          MSGID_INSTALLDS_DESCRIPTION_NO_WINDOWS_SERVICE);
+      enableWindowsService = new BooleanArgument("enablewindowsservice", 'e',
+          "enableWindowsService",
+          MSGID_INSTALLDS_DESCRIPTION_ENABLE_WINDOWS_SERVICE);
       if (SetupUtils.isWindows())
       {
-        argParser.addArgument(noWindowsService);
+        argParser.addArgument(enableWindowsService);
       }
 
       showUsage = new BooleanArgument("help", OPTION_SHORT_HELP,
diff --git a/opends/src/server/org/opends/server/messages/ToolMessages.java b/opends/src/server/org/opends/server/messages/ToolMessages.java
index 64d2990..0e76f19 100644
--- a/opends/src/server/org/opends/server/messages/ToolMessages.java
+++ b/opends/src/server/org/opends/server/messages/ToolMessages.java
@@ -6676,10 +6676,10 @@
        CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 842;
 
   /**
-   * The message ID for the message for the description of the No Windows
+   * The message ID for the message for the description of the Enable Windows
    * service.  This does not take any argument.
    */
-  public static final int MSGID_INSTALLDS_DESCRIPTION_NO_WINDOWS_SERVICE =
+  public static final int MSGID_INSTALLDS_DESCRIPTION_ENABLE_WINDOWS_SERVICE =
       CATEGORY_MASK_TOOLS | SEVERITY_MASK_INFORMATIONAL | 843;
 
 
@@ -10442,8 +10442,8 @@
     registerMessage(MSGID_INSTALLDS_DESCRIPTION_ROOTPWFILE,
                     "Specifies the path to a file containing the password " +
                     "for the initial root user for the Directory Server");
-    registerMessage(MSGID_INSTALLDS_DESCRIPTION_NO_WINDOWS_SERVICE,
-                    "Do not enable OpenDS to run as a Windows Service");
+    registerMessage(MSGID_INSTALLDS_DESCRIPTION_ENABLE_WINDOWS_SERVICE,
+                    "Enable OpenDS to run as a Windows Service");
     registerMessage(MSGID_INSTALLDS_DESCRIPTION_HELP,
                     "Display this usage information");
     registerMessage(MSGID_INSTALLDS_NO_CONFIG_FILE,
diff --git a/opends/src/server/org/opends/server/tools/InstallDS.java b/opends/src/server/org/opends/server/tools/InstallDS.java
index 41b7fb4..fcfbf8c 100644
--- a/opends/src/server/org/opends/server/tools/InstallDS.java
+++ b/opends/src/server/org/opends/server/tools/InstallDS.java
@@ -178,7 +178,7 @@
     BooleanArgument   showUsage;
     BooleanArgument   silentInstall;
     BooleanArgument   skipPortCheck;
-    BooleanArgument   noWindowsService;
+    BooleanArgument   enableWindowsService;
     FileBasedArgument rootPWFile;
     IntegerArgument   ldapPort;
     IntegerArgument   jmxPort;
@@ -292,12 +292,12 @@
                             null, null, MSGID_INSTALLDS_DESCRIPTION_ROOTPWFILE);
       argParser.addArgument(rootPWFile);
 
-      noWindowsService = new BooleanArgument("nowindowsservice", 'n',
-                                "noWindowsService",
-                                MSGID_INSTALLDS_DESCRIPTION_NO_WINDOWS_SERVICE);
+      enableWindowsService = new BooleanArgument("enablewindowsservice", 'e',
+                            "enableWindowsService",
+                            MSGID_INSTALLDS_DESCRIPTION_ENABLE_WINDOWS_SERVICE);
       if (SetupUtils.isWindows())
       {
-        argParser.addArgument(noWindowsService);
+        argParser.addArgument(enableWindowsService);
       }
 
       showUsage = new BooleanArgument("help", OPTION_SHORT_HELP,
@@ -823,11 +823,11 @@
     {
       if (silentInstall.isPresent())
       {
-        enableService = !noWindowsService.isPresent();
+        enableService = enableWindowsService.isPresent();
       }
-      else if (noWindowsService.isPresent())
+      else if (enableWindowsService.isPresent())
       {
-        enableService = false;
+        enableService = true;
       }
       else
       {
diff --git a/opends/tests/functional-tests/shared/functions/dsadm.xml b/opends/tests/functional-tests/shared/functions/dsadm.xml
index 58ed49f..15aeb3b 100755
--- a/opends/tests/functional-tests/shared/functions/dsadm.xml
+++ b/opends/tests/functional-tests/shared/functions/dsadm.xml
@@ -81,9 +81,9 @@
         </function-arg-description>
         <function-arg-property name="type" value="filename"/>
       </function-arg-def>
-      <function-arg-def name="dsNoWindowsService" type="optional">
+      <function-arg-def name="dsEnableWindowsService" type="optional">
         <function-arg-description>
-          Do not enable as a Windows Service
+          Enable as a Windows Service
         </function-arg-description>
         <function-arg-property name="type" value="boolean"/>
       </function-arg-def>            
@@ -125,8 +125,8 @@
         if dsBindPwdFile:
           STAFCmdParamsList.append('-j "%s"' % dsBindPwdFile)
 
-        if dsNoWindowsService:
-          STAFCmdParamsList.append('-n')
+        if dsEnableWindowsService:
+          STAFCmdParamsList.append('-e')
         
         if dsHelp:
           STAFCmdParamsList.append('-H')
diff --git a/opends/tests/functional-tests/shared/functions/topology.xml b/opends/tests/functional-tests/shared/functions/topology.xml
index 9869481..32efcc3 100755
--- a/opends/tests/functional-tests/shared/functions/topology.xml
+++ b/opends/tests/functional-tests/shared/functions/topology.xml
@@ -404,13 +404,13 @@
       <if expr="isWindows">
 
         <script>
-          noWindowsService='true'
+          enableWindowsService=''
         </script>
              
       <else>
       
         <script>
-          noWindowsService=''
+          enableWindowsService=''
         </script>
         
       </else>
@@ -429,7 +429,7 @@
           'dsBindDN'  : dsBindDN,
           'dsBindPwd' : dsBindPwd,
           'dsBaseDN'  : dsBaseDN,
-          'dsNoWindowsService' : noWindowsService }
+          'dsEnableWindowsService' : enableWindowsService}
       </call>
                 		
       <call function="'checkRC'">
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
index 895efc7..0178ced 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
@@ -103,9 +103,7 @@
     args.add(Integer.toString(jmxPort));
     args.add("-w");
     args.add(DIRECTORY_MANAGER_PASSWORD);
-    if (isWindows()) {
-      args.add("-n"); // don't install Windows service
-    }
+
     ProcessBuilder pb = new ProcessBuilder(args);
     Process p = pb.start();
     if (p.waitFor() != 0) {
@@ -151,8 +149,4 @@
   static public File getQuickSetupTestServerRootDir() {
     return new File(getQuickSetupTestWorkspace(), "OpenDS");
   }
-
-  static public boolean isWindows() {
-    return File.separator.equals("\\");
-  }
 }

--
Gitblit v1.10.0