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

fguigues
20.34.2008 2e2410712c7a0cbc20122f05c728e4f07dd1fdda
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -135,7 +135,13 @@
   * cases that depend on this specific value of "o=test".
   */
  public static final String TEST_ROOT_DN_STRING = "o=test";
  /**
   * The string representation of the OpenDMK jar file location
   * that will be used as base to determine if snmp is included or not
   */
  public static final String PROPERTY_OPENDMK_LOCATION =
          "org.opends.server.snmp.opendmk";
  /**
   * The test text writer for the Debug Logger
@@ -254,13 +260,20 @@
      File testBinDir       = new File(testRoot, "bin");
      
      // Snmp resource
      String opendmkJarFileLocation =
              System.getProperty(PROPERTY_OPENDMK_LOCATION);
      File opendmkJar = new File(opendmkJarFileLocation, "jdmkrt.jar");
      File   snmpResourceDir = new File(buildRoot + File.separator + "src" +
                                    File.separator + "snmp" + File.separator +
                                    "resource");
      
      File snmpConfigDir = new File(snmpResourceDir, "config");
      File testSnmpResourceDir = new File (testConfigDir + File.separator +
                                    "snmp");
      if (Boolean.getBoolean(PROPERTY_COPY_CLASSES_TO_TEST_PKG)) {
        copyDirectory(serverClassesDir, testClassesDir);
        copyDirectory(unitClassesDir, testClassesDir);
@@ -287,6 +300,11 @@
               new File(testConfigDir, "server-cert.p12"));
      copyFile(new File(testResourceDir, "client-cert.p12"),
               new File(testConfigDir, "client-cert.p12"));
      if (opendmkJar.exists()) {
          appendFile(new File(snmpConfigDir, "config.snmp.ldif"),
               new File(testConfigDir,"config.ldif"));
      }
      for (File f : testBinDir.listFiles())
      {
@@ -814,6 +832,21 @@
    in.close();
    out.close();
  }
  public static void appendFile(File src, File dst) throws IOException {
    InputStream in = new FileInputStream(src);
    OutputStream out = new FileOutputStream(dst, true);
    // Transfer bytes from in to out
    byte[] buf = new byte[8192];
    int len;
    while ((len = in.read(buf)) > 0) {
      out.write(buf, 0, len);
    }
    in.close();
    out.close();
  }
  /**
   * Get the LDAP port the test environment Directory Server instance is