From 883c4b7810dcabba4ebe2924ca0757485f5312da Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Fri, 15 Jun 2007 21:55:02 +0000
Subject: [PATCH] - Add a few more unit tests for important classes.  This also includes some plumbing for getting the quicksetup tests' workspace server configured enough so that it is startable and stoppable  for testing.

---
 opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallCliHelper.java |   56 +++++++++++++++++++++++++++-----------------------------
 1 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallCliHelper.java b/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallCliHelper.java
index 04b295e..341ee00 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallCliHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallCliHelper.java
@@ -33,6 +33,10 @@
 
 import java.util.HashSet;
 import java.util.Set;
+import java.util.Collections;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.io.IOException;
 
 /**
  * The class used to provide some CLI interface in the uninstall.
@@ -46,6 +50,9 @@
  */
 class UninstallCliHelper extends CliApplicationHelper {
 
+  static private final Logger LOG =
+          Logger.getLogger(UninstallCliHelper.class.getName());
+
   static private String FORMAT_KEY = "cli-uninstall-confirm-prompt";
 
   /**
@@ -83,8 +90,23 @@
     /* Step 2: If this is not a silent install ask for confirmation to delete
      * the different parts of the installation
      */
-    Set<String> outsideDbs = getOutsideDbs(installStatus);
-    Set<String> outsideLogs = getOutsideLogs(installStatus);
+    Set<String> outsideDbs;
+    Set<String> outsideLogs;
+    Configuration config =
+            Installation.getLocal().getCurrentConfiguration();
+    try {
+      outsideDbs = config.getOutsideDbs();
+    } catch (IOException ioe) {
+      outsideDbs = Collections.emptySet();
+      LOG.log(Level.INFO, "error determining outside databases", ioe);
+    }
+
+    try {
+      outsideLogs = config.getOutsideLogs();
+    } catch (IOException ioe) {
+      outsideLogs = Collections.emptySet();
+      LOG.log(Level.INFO, "error determining outside logs", ioe);
+    }
 
     if (silentUninstall)
     {
@@ -121,30 +143,6 @@
   }
 
   /**
-   * Returns a Set of relative paths containing the db paths outside the
-   * installation.
-   * @param installStatus the Current Install Status object.
-   * @return a Set of relative paths containing the db paths outside the
-   * installation.
-   */
-  private Set<String> getOutsideDbs(CurrentInstallStatus installStatus)
-  {
-    return Utils.getOutsideDbs(installStatus);
-  }
-
-  /**
-   * Returns a Set of relative paths containing the log paths outside the
-   * installation.
-   * @param installStatus the Current Install Status object.
-   * @return a Set of relative paths containing the log paths outside the
-   * installation.
-   */
-  private Set<String> getOutsideLogs(CurrentInstallStatus installStatus)
-  {
-    return Utils.getOutsideLogs(installStatus);
-  }
-
-  /**
    * Commodity method used to ask the user to confirm the deletion of certain
    * parts of the server.  It updates the provided UserData object
    * accordingly.  Returns <CODE>true</CODE> if the user cancels and <CODE>
@@ -325,8 +323,8 @@
   throws UserDataException
   {
     boolean cancelled = false;
-
-    if (CurrentInstallStatus.isServerRunning())
+    Status status = Installation.getLocal().getStatus();
+    if (status.isServerRunning())
     {
         if (!silentUninstall)
         {
@@ -337,7 +335,7 @@
         if (!cancelled)
         {
             /* During all the confirmations, the server might be stopped. */
-            userData.setStopServer(CurrentInstallStatus.isServerRunning());
+            userData.setStopServer(status.isServerRunning());
         }
     }
     else

--
Gitblit v1.10.0