From b9af8f181b7495cb343c280db4ce8979a04bfc91 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Tue, 12 Sep 2006 23:12:27 +0000
Subject: [PATCH] This commit changes several aspects of the unit test infrastructure:

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index e71b669..de5af8e 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -86,6 +86,8 @@
     File   testRoot  = new File(buildRoot + File.separator + "build" +
                                 File.separator + "unit-tests" + File.separator +
                                 "package");
+    File   testSrcRoot = new File(buildRoot + File.separator + "tests" +
+                                  File.separator + "unit-tests-testng");
 
     if (testRoot.exists())
     {
@@ -104,6 +106,7 @@
     // Copy the configuration, schema, and MakeLDIF resources into the
     // appropriate place under the test package.
     File resourceDir   = new File(buildRoot, "resource");
+    File testResourceDir = new File(testSrcRoot, "resource");
     File testConfigDir = new File(testRoot, "config");
 
     copyDirectory(new File(resourceDir, "config"), testConfigDir);
@@ -111,7 +114,8 @@
                   new File(testConfigDir, "schema"));
     copyDirectory(new File(resourceDir, "MakeLDIF"),
                   new File(testConfigDir, "MakeLDIF"));
-    // FIXME -- Copy the config-changes.ldif file into place when we have one.
+    copyFile     (new File(testResourceDir, "config-changes.ldif"),
+                  new File(testConfigDir, "config-changes.ldif"));
 
 
     // Actually start the server and set a variable that will prevent us from
@@ -228,6 +232,43 @@
   }
 
   /**
+   * Get the LDAP port the test environment Directory Server instance is
+   * running on.
+   *
+   * @return The port number.
+   */
+  public static long getServerLdapPort()
+  {
+    return 32389;
+  }
+
+  /**
+   * Get the JMX port the test environment Directory Server instance is
+   * running on.
+   *
+   * @return The port number.
+   */
+  public static long getServerJmxPort()
+  {
+    return 33689;
+  }
+
+  /**
+   * Method for getting a file from the test resources directory.
+   *
+   * @return The directory as a File
+   */
+  public static File getTestResource(String filename)
+  {
+    String buildRoot = System.getProperty(PROPERTY_BUILD_ROOT);
+    File   testResourceDir = new File(buildRoot + File.separator + "tests" +
+                                      File.separator + "unit-tests-testng" +
+                                      File.separator + "resource");
+
+    return new File(testResourceDir, filename);
+  }
+
+  /**
    * Prevent instantiation.
    */
   private TestCaseUtils() {

--
Gitblit v1.10.0