From 5f07bc83859cd08452f124b111619a167d173eb5 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 22 Sep 2006 04:01:20 +0000
Subject: [PATCH] Update the TestCaseUtils.startServer method to copy the bin directory as part of the process of creating the server instance.  This will make it easier to start the server instance used for the test cases after they have completed.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 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 15ae925..6e48877 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
@@ -44,6 +44,8 @@
 import org.opends.server.loggers.Error;
 import org.opends.server.loggers.Debug;
 import org.opends.server.types.DN;
+import org.opends.server.types.FilePermission;
+import org.opends.server.types.OperatingSystem;
 
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -130,8 +132,9 @@
     }
     testRoot.mkdirs();
 
-    String[] subDirectories = { "bak", "changelogDb", "classes", "config", "db",
-                                "ldif", "lib", "locks", "logs" };
+    String[] subDirectories = { "bak", "bin", "changelogDb", "classes",
+                                "config", "db", "ldif", "lib", "locks",
+                                "logs" };
     for (String s : subDirectories)
     {
       new File(testRoot, s).mkdir();
@@ -143,7 +146,9 @@
     File resourceDir   = new File(buildRoot, "resource");
     File testResourceDir = new File(testSrcRoot, "resource");
     File testConfigDir = new File(testRoot, "config");
+    File testBinDir = new File(testRoot, "bin");
 
+    copyDirectory(new File(resourceDir, "bin"), testBinDir);
     copyDirectory(new File(resourceDir, "config"), testConfigDir);
     copyDirectory(new File(resourceDir, "schema"),
                   new File(testConfigDir, "schema"));
@@ -152,6 +157,26 @@
     copyFile(new File(testResourceDir, "jmxkeystore"),
              new File(testRoot, "jmxkeystore"));
 
+
+    // Make the shell scripts in the bin directory executable, if possible.
+    OperatingSystem os = DirectoryServer.getOperatingSystem();
+    if ((os != null) && OperatingSystem.isUNIXBased(os) &&
+        FilePermission.canSetPermissions())
+    {
+      try
+      {
+        FilePermission perm = FilePermission.decodeUNIXMode("755");
+        for (File f : testBinDir.listFiles())
+        {
+          if (f.getName().endsWith(".sh"))
+          {
+            FilePermission.setPermissions(f, perm);
+          }
+        }
+      } catch (Exception e) {}
+    }
+
+
     // Find some free ports for the listeners and write them to the
     // config-chamges.ldif file.
     ServerSocket serverLdapSocket  = null;

--
Gitblit v1.10.0