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/Installation.java |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/Installation.java b/opends/src/quicksetup/org/opends/quicksetup/Installation.java
index 8762705..74bab38 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Installation.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -263,6 +263,29 @@
     }
   }
 
+  static private Installation local;
+
+  /**
+   * Obtains the installation by reading the classpath of the running
+   * JVM to determine the location of the jars and determine the
+   * installation root.
+   * @return Installation obtained by reading the classpath
+   */
+  static public Installation getLocal() {
+    if (local == null) {
+
+      // This allows testing of configuration components when the OpenDS.jar
+      // in the classpath does not necessarily point to the server's
+      String installRoot = System.getProperty("org.opends.quicksetup.Root");
+
+      if (installRoot == null) {
+        installRoot = Utils.getInstallPathFromClasspath();
+      }
+      local = new Installation(installRoot);
+    }
+    return local;
+  }
+
   static private final Logger LOG =
           Logger.getLogger(Installation.class.getName());
 
@@ -369,7 +392,7 @@
    */
   public Configuration getCurrentConfiguration() {
     if (configuration == null) {
-      configuration = new Configuration(getCurrentConfigurationFile());
+      configuration = new Configuration(this, getCurrentConfigurationFile());
     }
     return configuration;
   }
@@ -384,7 +407,7 @@
    */
   public Configuration getBaseConfiguration() throws ApplicationException {
     if (baseConfiguration == null) {
-      baseConfiguration = new Configuration(getBaseConfigurationFile());
+      baseConfiguration = new Configuration(this, getBaseConfigurationFile());
     }
     return baseConfiguration;
   }

--
Gitblit v1.10.0