From f02d8697c431d4d8ef0910bfc1807e314be5dae6 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 09 Dec 2013 17:46:34 +0000
Subject: [PATCH] Reset the configuration after the server is stopped, not before.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 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 32dad53..08587de 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
@@ -545,18 +545,11 @@
 
       clearLoggersContents();
 
-      clearJEBackends();
+      EmbeddedUtils.stopServer(null, null);
       restoreServerConfigLdif();
-      // We need it to be recreated and reregistered
-      MemoryBackend memoryBackend =
-        (MemoryBackend) DirectoryServer.getBackend(TEST_BACKEND_ID);
-      if (memoryBackend != null)
-      {
-        memoryBackend.finalizeBackend();
-        DirectoryServer.deregisterBackend(memoryBackend);
-      }
+      EmbeddedUtils.startServer(DirectoryServer.getEnvironmentConfig());
 
-      EmbeddedUtils.restartServer(null, null, DirectoryServer.getEnvironmentConfig());
+      clearJEBackends();
       initializeTestBackend(true);
 
       // This generates too much noise, so it's disabled by default.
@@ -756,11 +749,16 @@
     DirectoryServer.setSchema(schemaBeforeStartingFakeServer);
   }
 
+
+
   /**
-   * Shut down the server, if it has been started.
-   * @param reason The reason for the shutdown.
+   * Shut down the server. This should only be called at the end of the test
+   * suite and not by any unit tests.
+   *
+   * @param reason
+   *          The reason for the shutdown.
    */
-  public static void shutdownServer(Message reason)
+  static void shutdownServer(Message reason)
   {
     if (SERVER_STARTED)
     {

--
Gitblit v1.10.0