From 2250643bd27e47583d10cb33964693c6b44450d9 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 04 Apr 2016 13:38:34 +0000
Subject: [PATCH] Fix failing tests and cleanup
---
opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaConstants.java | 3 -
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 56 +++++++++++++--------------
opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationBootstrapper.java | 7 +--
opendj-server-legacy/resource/schema/02-config.ldif | 5 --
opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java | 3 +
opendj-server-legacy/resource/schema/00-core.ldif | 4 +-
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java | 9 +++-
opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/ConfigFileHandlerBackendConfiguration.xml | 5 +-
opendj-server-legacy/resource/config/config.ldif | 10 -----
9 files changed, 45 insertions(+), 57 deletions(-)
diff --git a/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/ConfigFileHandlerBackendConfiguration.xml b/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/ConfigFileHandlerBackendConfiguration.xml
index bbf7bfc..59bd2ed 100644
--- a/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/ConfigFileHandlerBackendConfiguration.xml
+++ b/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/ConfigFileHandlerBackendConfiguration.xml
@@ -13,7 +13,8 @@
information: "Portions Copyright [year] [name of copyright owner]".
Copyright 2007-2008 Sun Microsystems, Inc.
- ! -->
+ Portions Copyright 2016 ForgeRock AS.
+!-->
<adm:managed-object name="config-file-handler-backend"
plural-name="config-file-handler-backends"
package="org.forgerock.opendj.server.config" extends="backend"
@@ -36,7 +37,7 @@
<adm:default-behavior>
<adm:defined>
<adm:value>
- org.opends.server.extensions.ConfigFileHandler
+ org.opends.server.core.ConfigurationBackend
</adm:value>
</adm:defined>
</adm:default-behavior>
diff --git a/opendj-server-legacy/resource/config/config.ldif b/opendj-server-legacy/resource/config/config.ldif
index eecefcc..423bfaa 100644
--- a/opendj-server-legacy/resource/config/config.ldif
+++ b/opendj-server-legacy/resource/config/config.ldif
@@ -198,16 +198,6 @@
ds-cfg-base-dn: cn=backups
ds-cfg-backup-directory: bak
-dn: ds-cfg-backend-id=config,cn=Backends,cn=config
-objectClass: top
-objectClass: ds-cfg-backend
-objectClass: ds-cfg-config-file-handler-backend
-ds-cfg-enabled: true
-ds-cfg-java-class: org.opends.server.extensions.ConfigFileHandler
-ds-cfg-backend-id: config
-ds-cfg-writability-mode: enabled
-ds-cfg-base-dn: cn=config
-
dn: ds-cfg-backend-id=ads-truststore,cn=Backends,cn=config
objectClass: top
objectClass: ds-cfg-backend
diff --git a/opendj-server-legacy/resource/schema/00-core.ldif b/opendj-server-legacy/resource/schema/00-core.ldif
index b5b59fa..045ee1b 100644
--- a/opendj-server-legacy/resource/schema/00-core.ldif
+++ b/opendj-server-legacy/resource/schema/00-core.ldif
@@ -11,7 +11,7 @@
# information: "Portions Copyright [year] [name of copyright owner]".
#
# Copyright 2006-2010 Sun Microsystems, Inc.
-# Portions Copyright 2011-2015 ForgeRock AS.
+# Portions Copyright 2011-2016 ForgeRock AS.
# Portions Copyright 2013-2014 Manuel Gaupp
# This file contains a core set of attribute type and objectlass definitions
@@ -116,7 +116,7 @@
attributeTypes: ( 2.5.4.34 NAME 'seeAlso' SUP distinguishedName
X-ORIGIN 'RFC 4519' )
attributeTypes: ( 2.5.4.35 NAME 'userPassword'
- SYNTAX 1.3.6.1.4.1.26027.1.3.1 X-ORIGIN 'RFC 4519' )
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 X-ORIGIN 'RFC 4519' )
attributeTypes: ( 2.5.4.36 NAME 'userCertificate'
EQUALITY certificateExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.8 X-ORIGIN 'RFC 4523' )
diff --git a/opendj-server-legacy/resource/schema/02-config.ldif b/opendj-server-legacy/resource/schema/02-config.ldif
index 96051fb..9284c0c 100644
--- a/opendj-server-legacy/resource/schema/02-config.ldif
+++ b/opendj-server-legacy/resource/schema/02-config.ldif
@@ -5240,11 +5240,6 @@
SUP ds-cfg-virtual-attribute
STRUCTURAL
X-ORIGIN 'OpenDS Directory Server' )
-objectClasses: ( 1.3.6.1.4.1.26027.1.2.158
- NAME 'ds-cfg-config-file-handler-backend'
- SUP ds-cfg-backend
- STRUCTURAL
- X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.159
NAME 'ds-cfg-subject-equals-dn-certificate-mapper'
SUP ds-cfg-certificate-mapper
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
index 2273259..953d0ac 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -20,6 +20,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.SortedSet;
+import java.util.TreeSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
@@ -1104,8 +1105,12 @@
{
try
{
- final SortedSet<Aci> globalAcis = configuration.getGlobalACI();
- if (globalAcis != null)
+ final SortedSet<Aci> globalAcis = new TreeSet<Aci>();
+ for (String value : configuration.getGlobalACI())
+ {
+ globalAcis.add(Aci.decode(ByteString.valueOfUtf8(value), DN.rootDN()));
+ }
+ if (!globalAcis.isEmpty())
{
aciList.addAci(DN.rootDN(), globalAcis);
logger.debug(INFO_ACI_ADD_LIST_GLOBAL_ACIS, globalAcis.size());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationBootstrapper.java b/opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationBootstrapper.java
index bd9adac..4a1b06e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationBootstrapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationBootstrapper.java
@@ -23,7 +23,6 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.ConfigurationFramework;
import org.forgerock.opendj.config.server.ConfigException;
-import org.forgerock.opendj.config.server.ServerManagementContext;
import org.opends.server.types.InitializationException;
/**
@@ -44,11 +43,11 @@
* The server context.
* @param configClass
* The actual configuration class to use.
- * @return the server management context
+ * @return the configuration handler
* @throws InitializationException
* If an error occurs during bootstrapping.
*/
- public static ServerManagementContext bootstrap(ServerContext serverContext, Class<ConfigurationHandler> configClass)
+ public static ConfigurationHandler bootstrap(ServerContext serverContext, Class<ConfigurationHandler> configClass)
throws InitializationException {
final ConfigurationFramework configFramework = ConfigurationFramework.getInstance();
try
@@ -79,6 +78,6 @@
throw new InitializationException(message, e);
}
configurationHandler.initialize();
- return new ServerManagementContext(configurationHandler);
+ return configurationHandler;
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index ce2e66d..9ce2a03 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -63,6 +63,7 @@
import org.forgerock.opendj.adapter.server3x.Converters;
import org.forgerock.opendj.config.ConfigurationFramework;
import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.config.server.ServerManagementContext;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
@@ -159,10 +160,8 @@
import org.opends.server.types.Schema;
import org.opends.server.types.VirtualAttributeRule;
import org.opends.server.types.WritabilityMode;
-import org.opends.server.util.ActivateOnceNewConfigFrameworkIsUsed;
import org.opends.server.util.ActivateOnceSDKSchemaIsUsed;
import org.opends.server.util.BuildVersion;
-import org.opends.server.util.ModifyOnceSDKSchemaIsUsed;
import org.opends.server.util.MultiOutputStream;
import org.opends.server.util.RuntimeInformation;
import org.opends.server.util.SetupUtils;
@@ -1074,28 +1073,6 @@
initializeConfiguration();
}
- /**
- * Initializes this server.
- * <p>
- * Initialization involves the following steps:
- * <ul>
- * <li>Configuration</li>
- * <li>Schema</li>
- * </ul>
- * @throws InitializationException
- */
- @ActivateOnceNewConfigFrameworkIsUsed("it will need adaptation to be activated before sdk schema is ready")
- @ModifyOnceSDKSchemaIsUsed
- private void initializeNG() throws InitializationException
- {
- //serverManagementContext = ConfigurationBootstrapper.bootstrap(serverContext);
- //initializeSchemaNG();
-
- // TODO : config backend should be initialized later, with the other backends
- //ConfigBackend configBackend = new ConfigBackend();
- //configBackend.initializeConfigBackend(serverContext, configurationHandler);
- }
-
/** Initialize the schema of this server. */
@ActivateOnceSDKSchemaIsUsed
private void initializeSchemaNG() throws InitializationException
@@ -1112,10 +1089,30 @@
}
}
+ /**
+ * Initializes the configuration.
+ * <p>
+ * Creates the configuration handler, the server management context and the configuration backend.
+ *
+ * @throws InitializationException
+ * If an error occurs.
+ */
public void initializeConfiguration() throws InitializationException
{
- this.configClass = environmentConfig.getConfigClass();
- serverManagementContext = ConfigurationBootstrapper.bootstrap(serverContext, configClass);
+ configClass = environmentConfig.getConfigClass();
+ configurationHandler = ConfigurationBootstrapper.bootstrap(serverContext, configClass);
+ serverManagementContext = new ServerManagementContext(configurationHandler);
+
+ final ConfigurationBackend configBackend = new ConfigurationBackend(serverContext, configurationHandler);
+ configBackend.openBackend();
+ try
+ {
+ registerBackend(configBackend);
+ }
+ catch (DirectoryException e)
+ {
+ throw new InitializationException(LocalizableMessage.raw("Unable to register configuration backend", e));
+ }
}
/**
@@ -1280,6 +1277,7 @@
groupManager.performBackendPreInitializationProcessing(configBackend);
AccessControlConfigManager.getInstance().initializeAccessControl(serverContext);
+ initializeAuthenticationPolicyComponents();
// Initialize all the backends and their associated suffixes
// and initialize the workflows when workflow configuration mode is auto.
@@ -1304,7 +1302,6 @@
monitorConfigManager = new MonitorConfigManager(serverContext);
monitorConfigManager.initializeMonitorProviders();
- initializeAuthenticationPolicyComponents();
pluginConfigManager.initializeUserPlugins(null);
@@ -5944,8 +5941,9 @@
}
}
- // Finalize the entry cache.
- EntryCache ec = DirectoryServer.getEntryCache();
+ directoryServer.configurationHandler.finalize();
+
+ EntryCache<?> ec = DirectoryServer.getEntryCache();
if (ec != null)
{
ec.finalizeEntryCache();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaConstants.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaConstants.java
index 6301c08..7062e41 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaConstants.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaConstants.java
@@ -1894,8 +1894,7 @@
/**
* The OID for the user password attribute syntax.
*/
- public static final String SYNTAX_USER_PASSWORD_OID =
- OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".1";
+ public static final String SYNTAX_USER_PASSWORD_OID = "1.3.6.1.4.1.1466.115.121.1.40";
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java b/opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java
index b62d55f..bde41ab 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java
@@ -81,8 +81,9 @@
public ServerContextBuilder withConfigurationBootstrapped()
throws InitializationException
{
- final ServerManagementContext serverManagementContext =
+ final ConfigurationHandler configHandler =
ConfigurationBootstrapper.bootstrap(serverContext, ConfigurationHandler.class);
+ final ServerManagementContext serverManagementContext = new ServerManagementContext(configHandler);
when(serverContext.getServerManagementContext()).thenReturn(serverManagementContext);
return this;
}
--
Gitblit v1.10.0