opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSIntegrationTests.java
@@ -32,11 +32,8 @@ import org.opends.server.tools.LDAPSearch; /** * This class defines a base test case that should be subclassed by all * unit tests used by the Directory Server. * <p> * This class adds the ability to print error messages and automatically * have them include the class name. * This class defines an abstract test case that should be subclassed by all * integration tests used by OpenDS. */ public abstract class OpenDSIntegrationTests { // The print stream to use for printing error messages. @@ -85,6 +82,12 @@ this.errorStream = errorStream; } /** * Compares the return code from an ldap operation with the expected value. * * @param retCode The return code received from the ldap operation. * @param expCode The expected value for the return code. */ public void compareExitCode(int retCode, int expCode) { System.out.println("Return code is " + Integer.toString(retCode) + ", expecting " + Integer.toString(expCode)); @@ -92,11 +95,16 @@ { if (retCode == 999) System.out.println("OpenDS could not restart"); // throw a fail in the testng framewok // throw a fail in the testng framework assert retCode==expCode; } } /** * Converts a string array of ldap paramters to a string. * * @param cmd[] The string array of ldap parameters */ public String cmdArrayToString(String cmd[]) { String outStr = cmd[0]; @@ -108,6 +116,20 @@ return outStr; } /** * Starts OpenDS * * @param dsee_home The home directory for the OpenDS * installation. * @param hostname The hostname for the server where OpenDS * is installed. * @param port The port number for OpenDS. * @param bindDN The bind DN. * @param bindPW The password for the bind DN. * @param logDir The directory for the log files that are * * @return 0 if OpenDS started successfully, 1 if not. */ public int startOpenDS(String dsee_home, String hostname, String port, String bindDN, String bindPW, String logDir) throws Exception { int isAliveCounter = 0; @@ -145,6 +167,13 @@ return 0; } /** * Stops OpenDS * * @param dsee_home The home directory for the OpenDS * installation. * @param port The port number for OpenDS. */ public void stopOpenDS(String dsee_home, String port) throws Exception { String myArgs[] = {"-p", port}; @@ -153,6 +182,17 @@ System.out.println("OpenDS has stopped."); } /** * Tests OpenDS to see if it has started. * * @param hostname The hostname for the server where OpenDS * is installed. * @param port The port number for OpenDS. * @param bindDN The bind DN. * @param bindPW The password for the bind DN. * * @return 0 if OpenDS has started, 1 if not. */ public int isAlive(String hostname, String port, String bindDN, String bindPW) { String isAlive_args[] = {"-h", hostname, "-p", port, "-D", bindDN, "-w", bindPW, "-b", "", "-s", "base", "(objectclass=*)"}; opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSMgr.java
@@ -29,18 +29,28 @@ import java.io.*; import org.opends.server.tools.StopDS; /** * This class manages the starting and stopping OpenDS. * This class is used for the Integration Tests on Windows platforms. */ public class OpenDSMgr extends Thread { private String dsee_home; private String port; /** * Creates a new OpenDSMgr.. */ public OpenDSMgr(String in_dsee_home, String in_port) { dsee_home = in_dsee_home; port = in_port; } /** * Starts a new thread to start OpenDS. */ public void run() { try @@ -53,6 +63,9 @@ } } /** * Starts OpenDS in a new thread. */ public void startDS() throws Exception { String osName = new String(System.getProperty("os.name")); @@ -61,7 +74,6 @@ if (osName.indexOf("Windows") >= 0) // For Windows { exec_cmd = "CMD /C " + dsee_home + "\\bin\\start-ds"; System.out.println(exec_cmd); } else { opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSTestListener.java
@@ -33,32 +33,51 @@ import org.opends.server.tools.*; /** * This class contains the TestNG tests for the Schema startup. * This class contains the listener classes for TestNG. */ @Test public class OpenDSTestListener extends TestListenerAdapter { private int m_counter = 0; /** * Writes the string, "FAIL," to the test output. * * @param tr Object of the class, ITestResult */ @Override public void onTestFailure(ITestResult tr) { log("FAIL"); } /** * Writes the string, "SKIPPED," to the test output. * * @param tr Object of the class, ITestResult */ @Override public void onTestSkipped(ITestResult tr) { log("SKIPPED"); } /** * Writes the string, "PASS," to the test output. * * @param tr Object of the class, ITestResult */ @Override public void onTestSuccess(ITestResult tr) { log("PASS"); } /** * Writes the a string to standard out. * * @param str String to send to standard out. */ private void log(String str) { System.out.print(str + "\n"); opends/tests/integration-tests-testng/src/server/org/opends/server/OpenDSTestOutput.java
@@ -29,18 +29,30 @@ import java.io.*; import junit.framework.*; /** * This class manages the redirection of the output. */ public class OpenDSTestOutput { private PrintStream std_out; private PrintStream std_err; private PrintStream ps; /** * Creates a new OpenDSTestOutput. */ public OpenDSTestOutput() { std_out = System.out; std_err = System.out; } /** * Redirects standard out and standard error to a file. * * @param dirname Directory * @param filename Filename */ public void redirectOutput(String dirname, String filename) throws Exception { ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(new File(dirname, filename)))); @@ -48,6 +60,9 @@ System.setOut(ps); } /** * Resets output streams to standard out and standard error. */ public void resetOutput() { if((ps != null) && (std_err != null) && (std_out != null)) opends/tests/integration-tests-testng/src/server/org/opends/server/integration/backend/ImportTests13.java
@@ -37,7 +37,8 @@ public class ImportTests13 extends BackendTests { /** * Add a new branch when importing data. * Import data to OpenDS with one --excludeAttribute, one --includeFilter, and * one --excludeBranch parameter. * * @param hostname The hostname for the server where OpenDS * is installed. opends/tests/integration-tests-testng/src/server/org/opends/server/integration/backend/ImportTests9.java
@@ -37,7 +37,7 @@ public class ImportTests9 extends BackendTests { /** * Import data to OpenDS with three --excludeAttribute parameters. * Import data to OpenDS with three --excludeFilters parameters. * * @param hostname The hostname for the server where OpenDS * is installed. opends/tests/integration-tests-testng/src/server/org/opends/server/integration/schema/SchemaRFCTests.java
@@ -248,7 +248,7 @@ } /** * Add an entry that is covered by rfc 2978. * Add an entry that is covered by rfc 2798. * * @param hostname The hostname for the server where OpenDS * is installed.