From e74242ccd53b5525ab7337c9e289a1af196b7b18 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 28 May 2010 14:04:26 +0000
Subject: [PATCH] Fix issue #2934. RootDSEWorkflowTopology now takes into account the ds-cfg-subordinate-base-dn.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java | 40 +++++++++++++++++++++++++++++++++++++---
1 files changed, 37 insertions(+), 3 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 b09417f..ed41bf4 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
@@ -789,9 +789,32 @@
throws IOException, InitializationException, ConfigException,
DirectoryException
{
+ initializeMemoryBackend(
+ TEST_BACKEND_ID, TEST_ROOT_DN_STRING, createBaseEntry);
+ }
+
+ /**
+ * 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.
+ *
+ * @param backendID the ID of the backend to create
+ * @param namingContext the naming context to create in the backend
+ * @param createBaseEntry Indicate whether to automatically create the base
+ * entry and add it to the backend.
+ *
+ * @throws Exception If an unexpected problem occurs.
+ */
+ public static void initializeMemoryBackend(
+ String backendID,
+ String namingContext,
+ boolean createBaseEntry
+ ) throws IOException, InitializationException, ConfigException,
+ DirectoryException
+ {
startServer();
- DN baseDN = DN.decode(TEST_ROOT_DN_STRING);
+ DN baseDN = DN.decode(namingContext);
// Retrieve backend. Warning: it is important to perform this each time,
// because a test may have disabled then enabled the backend (i.e a test
@@ -800,12 +823,12 @@
// to memory backend must be invalidated. So to prevent this problem, we
// retrieve the memory backend reference each time before cleaning it.
MemoryBackend memoryBackend =
- (MemoryBackend)DirectoryServer.getBackend(TEST_BACKEND_ID);
+ (MemoryBackend)DirectoryServer.getBackend(backendID);
if (memoryBackend == null)
{
memoryBackend = new MemoryBackend();
- memoryBackend.setBackendID(TEST_BACKEND_ID);
+ memoryBackend.setBackendID(backendID);
memoryBackend.setBaseDNs(new DN[] {baseDN});
memoryBackend.initializeBackend();
DirectoryServer.registerBackend(memoryBackend);
@@ -821,6 +844,17 @@
}
/**
+ * Clears a memory-based backend.
+ */
+ public static void clearMemoryBackend(String backendID) throws Exception
+ {
+ MemoryBackend memoryBackend =
+ (MemoryBackend) DirectoryServer.getBackend(backendID);
+ if (memoryBackend != null)
+ memoryBackend.clearMemoryBackend();
+ }
+
+ /**
* Clears all the entries from the JE backend determined by the
* be id passed into the method.
--
Gitblit v1.10.0