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

coulbeck
15.53.2006 c9cb0e89dadb2872d6d76e657ea8a76ce105bc14
Add a @AfterSuite annotated method to the DirectoryServerTestCase to shut down the server after tests have been run.  This eleiminates a problem running tests from within IDEA where the test process had to be stopped manually after the tests had completed.
2 files modified
21 ■■■■■ changed files
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/DirectoryServerTestCase.java 7 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java 14 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/DirectoryServerTestCase.java
@@ -26,7 +26,7 @@
 */
package org.opends.server;
import org.testng.annotations.Test;
import org.testng.annotations.AfterSuite;
import java.io.PrintStream;
@@ -41,6 +41,11 @@
  // The print stream to use for printing error messages.
  private PrintStream errorStream;
  @AfterSuite
  public final void shutdownServer() {
    TestCaseUtils.shutdownServer("The current test suite has finished.");
  }
  /**
   * Creates a new instance of this test case with the provided name.
   */
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -48,7 +48,6 @@
import org.opends.server.loggers.Error;
import org.opends.server.loggers.Debug;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -162,6 +161,19 @@
  }
  /**
   * Shut down the server, if it has been started.
   * @param reason The reason for the shutdown.
   */
  public static void shutdownServer(String reason)
  {
    if (SERVER_STARTED)
    {
      DirectoryServer.shutDown("org.opends.server.TestCaseUtils", reason);
      SERVER_STARTED = false;
    }
  }
  /**
   * Initializes a memory-based backend that may be used to perform operations
   * while testing the server.  This will ensure that the memory backend is
   * created in the server if it does not yet exist, and that it is empty.  Note