| | |
| | | * cases that depend on this specific value of "o=test". |
| | | */ |
| | | public static final String TEST_ROOT_DN_STRING = "o=test"; |
| | | |
| | | |
| | | /** |
| | | * The backend if for the test backend |
| | | */ |
| | |
| | | * 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 = |
| | | public static final String PROPERTY_OPENDMK_LOCATION = |
| | | "org.opends.server.snmp.opendmk"; |
| | | |
| | | /** |
| | |
| | | testInstallRoot.mkdirs(); |
| | | testInstanceRoot.mkdirs(); |
| | | } |
| | | |
| | | |
| | | File testInstanceSchema = |
| | | new File (testInstanceRoot, "config" + File.separator + "schema"); |
| | | testInstanceSchema.mkdirs(); |
| | |
| | | File testClassesDir = new File(testInstanceRoot, "classes"); |
| | | File testLibDir = new File(testInstallRoot, "lib"); |
| | | File testBinDir = new File(testInstallRoot, "bin"); |
| | | |
| | | |
| | | // Snmp resource |
| | | String opendmkJarFileLocation = |
| | | 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); |
| | | } |
| | | |
| | | |
| | | if (installedRoot != null) |
| | | { |
| | | copyDirectory(new File(installedRoot), testInstallRoot); |
| | | |
| | | |
| | | // Get the instance location |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | DirectoryEnvironmentConfig config = new DirectoryEnvironmentConfig(); |
| | | config.setServerRoot(testInstallRoot); |
| | | config.setInstanceRoot(testInstanceRoot); |
| | | |
| | | |
| | | config.setForceDaemonThreads(true); |
| | | config.setConfigClass(ConfigFileHandler.class); |
| | | config.setConfigFile(new File(testConfigDir, "config.ldif")); |
| | |
| | | if (testConfigDir == null) { |
| | | throw new RuntimeException("The testConfigDir variable is not set yet!"); |
| | | } |
| | | |
| | | |
| | | return (testConfigDir); |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | in.close(); |
| | | out.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the LDAP port the test environment Directory Server instance is |
| | |
| | | |
| | | |
| | | /** |
| | | * Adds the provided entry to the Directory Server using an internal |
| | | * operation. |
| | | * |
| | | * @param lines The lines that make up the entry to be added. |
| | | * |
| | | * @return result code for this operation. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | public static ResultCode addEntryOperation(String... lines) |
| | | throws Exception |
| | | { |
| | | Entry entry = makeEntry(lines); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry.getDN(), |
| | | entry.getObjectClasses(), |
| | | entry.getUserAttributes(), |
| | | entry.getOperationalAttributes()); |
| | | return addOperation.getResultCode(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Adds the provided set of entries to the Directory Server using internal |
| | | * operations. |
| | | * |
| | |
| | | "-a", |
| | | "-f", path |
| | | }; |
| | | |
| | | |
| | | if (useAdminPort) { |
| | | return LDAPModify.mainModify(adminArgs, false, null, null); |
| | | } else { |
| | |
| | | } catch (Exception e) { |
| | | hostName="Unknown (" + e + ")"; |
| | | } |
| | | |
| | | |
| | | String[] fullArgs = new String[args.length + 11]; |
| | | fullArgs[0] = "-h"; |
| | | fullArgs[1] = hostName; |