From 70d3c6a9d98e5b002fda985a8ac0a60c0cb79026 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 04 Oct 2006 21:47:08 +0000
Subject: [PATCH] Add a new org.opends.server.types.DirectoryConfig class that can be used to expose a number of the methods from the DirectoryServer class as part of the public interface while reducing the need for extensions to reference code in the org.opends.server.core package.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java
index cf73a1f..7bee751 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java
@@ -51,6 +51,7 @@
import org.opends.server.types.AttributeValue;
import org.opends.server.types.AuthenticationInfo;
import org.opends.server.types.Control;
+import org.opends.server.types.DirectoryConfig;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.Modification;
@@ -162,12 +163,11 @@
ConfigEntry parentEntry =
- DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+ DirectoryConfig.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
LastModPlugin plugin = new LastModPlugin();
- plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
- configEntry);
+ plugin.initializePlugin(pluginTypes, configEntry);
}
@@ -184,10 +184,14 @@
public void testInitializeWithValidConfigsWithoutSchema(Entry e)
throws Exception
{
- AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp");
- AttributeType cnType = DirectoryServer.getAttributeType("creatorsname");
- AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp");
- AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+ AttributeType ctType = DirectoryConfig.getAttributeType("createtimestamp",
+ false);
+ AttributeType cnType = DirectoryConfig.getAttributeType("creatorsname",
+ false);
+ AttributeType mtType = DirectoryConfig.getAttributeType("modifytimestamp",
+ false);
+ AttributeType mnType = DirectoryConfig.getAttributeType("modifiersname",
+ false);
DirectoryServer.deregisterAttributeType(ctType);
DirectoryServer.deregisterAttributeType(cnType);
@@ -207,12 +211,11 @@
ConfigEntry parentEntry =
- DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+ DirectoryConfig.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
LastModPlugin plugin = new LastModPlugin();
- plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
- configEntry);
+ plugin.initializePlugin(pluginTypes, configEntry);
DirectoryServer.registerAttributeType(ctType, false);
@@ -289,12 +292,11 @@
ConfigEntry parentEntry =
- DirectoryServer.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
+ DirectoryConfig.getConfigEntry(DN.decode("cn=Plugins,cn=config"));
ConfigEntry configEntry = new ConfigEntry(e, parentEntry);
LastModPlugin plugin = new LastModPlugin();
- plugin.initializePlugin(DirectoryServer.getInstance(), pluginTypes,
- configEntry);
+ plugin.initializePlugin(pluginTypes, configEntry);
}
@@ -322,7 +324,7 @@
e.getOperationalAttributes());
assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
- e = DirectoryServer.getEntry(e.getDN());
+ e = DirectoryConfig.getEntry(e.getDN());
assertNotNull(e);
assertNotNull(e.getAttribute("creatorsname"));
assertNotNull(e.getAttribute("createtimestamp"));
@@ -351,7 +353,7 @@
conn.processModify(DN.decode("o=test"), mods);
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
- Entry e = DirectoryServer.getEntry(DN.decode("o=test"));
+ Entry e = DirectoryConfig.getEntry(DN.decode("o=test"));
assertNotNull(e);
assertNotNull(e.getAttribute("modifiersname"));
assertNotNull(e.getAttribute("modifytimestamp"));
@@ -387,7 +389,7 @@
conn.processModifyDN(e.getDN(), RDN.decode("cn=test2"), false);
assertEquals(modifyDNOperation.getResultCode(), ResultCode.SUCCESS);
- e = DirectoryServer.getEntry(DN.decode("cn=test2,o=test"));
+ e = DirectoryConfig.getEntry(DN.decode("cn=test2,o=test"));
assertNotNull(e);
assertNotNull(e.getAttribute("modifiersname"));
assertNotNull(e.getAttribute("modifytimestamp"));
--
Gitblit v1.10.0