mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
22.01.2006 5f07bc83859cd08452f124b111619a167d173eb5
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.
1 files modified
29 ■■■■■ changed files
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java 29 ●●●●● patch | view | raw | blame | history
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;