From 6b1e5bb8307072f97456360ef7d07409cbabd557 Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Fri, 15 Sep 2006 16:53:05 +0000
Subject: [PATCH] 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.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index 4a5695f..45733f5 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/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

--
Gitblit v1.10.0