From 7c1607d6b7e3cdc3094072425c3ed9641c28731e Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 12 Jul 2013 07:54:55 +0000
Subject: [PATCH] Fixing the build.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 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 e0c51d3..6d3561d 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
@@ -221,6 +221,13 @@
public static boolean SERVER_STARTED = false;
/**
+ * This is used to store the schema as it was before starting the fake server
+ * (for example, it could have been the real schema) so test tearDown can set
+ * it back.
+ */
+ private static Schema schemaBeforeStartingFakeServer;
+
+ /**
* The LDAP port the server is bound to on start.
*/
private static int serverLdapPort;
@@ -256,9 +263,13 @@
* <p>
* This method is trying hard to provide sensible defaults and core data you
* would expect from a normal install, including AttributeTypes, etc.
+ *
+ * @see #shutdownFakeServer() Matching method that must be called in the test
+ * tear down.
*/
public static void startFakeServer()
{
+ schemaBeforeStartingFakeServer = DirectoryServer.getSchema();
DirectoryServer.setSchema(initializeInMemory(new Schema()));
}
@@ -822,6 +833,16 @@
}
/**
+ * Undo all the setup done by #startFakeServer().
+ *
+ * @see #startFakeServer() Matching method that starts the fake server
+ */
+ public static void shutdownFakeServer()
+ {
+ DirectoryServer.setSchema(schemaBeforeStartingFakeServer);
+ }
+
+ /**
* Shut down the server, if it has been started.
* @param reason The reason for the shutdown.
*/
--
Gitblit v1.10.0