From ec6fcea7eb3b1013db8b26ff65327d3ab24077c9 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 09 Sep 2016 09:45:26 +0000
Subject: [PATCH] OPENDJ-3089 Several minor fixes from the PR

---
 opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java                             |    4 
 opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java                      |   12 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java          |   30 --
 opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java                   |   12 
 opendj-server-legacy/src/messages/org/opends/messages/task.properties                               |    4 
 opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java |   15 
 opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java                          |   30 +
 opendj-server-legacy/resource/schema/02-config.ldif                                                 |    8 
 opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java            |  269 ++++++++++++++++---
 opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaHandler.java                      |  113 ++------
 /dev/null                                                                                           |   83 ------
 opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java                 |   10 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java    |   15 -
 opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java                          |   51 +++
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java        |    2 
 opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaFilesWriter.java                  |   20 
 opendj-server-legacy/src/messages/org/opends/messages/config.properties                             |   10 
 opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java           |    5 
 opendj-server-legacy/src/test/java/org/opends/server/schema/GeneralizedTimeSyntaxTest.java          |    2 
 opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java                   |    2 
 opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java               |   15 
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java  |    2 
 opendj-server-legacy/src/messages/org/opends/messages/tool.properties                               |    3 
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java                |    4 
 24 files changed, 373 insertions(+), 348 deletions(-)

diff --git a/opendj-server-legacy/resource/schema/02-config.ldif b/opendj-server-legacy/resource/schema/02-config.ldif
index e31fb56..e31b684 100644
--- a/opendj-server-legacy/resource/schema/02-config.ldif
+++ b/opendj-server-legacy/resource/schema/02-config.ldif
@@ -5781,10 +5781,10 @@
         ds-cfg-disabled-matching-rule $
         ds-cfg-strict-format-country-string $
         ds-cfg-allow-zero-length-values-directory-string $
-        ds-cfg-strip-syntax-min-upper-bound-attribute-type-description 
-        ds-cfg-strict-format-jpeg-photos
-        ds-cfg-strict-format-certificates
-        ds-cfg-strict-format-telephone-numbers
+        ds-cfg-strip-syntax-min-upper-bound-attribute-type-description $
+        ds-cfg-strict-format-jpeg-photos $
+        ds-cfg-strict-format-certificates $
+        ds-cfg-strict-format-telephone-numbers $
         ds-cfg-allow-attribute-types-with-no-sup-or-syntax )
   X-ORIGIN 'OpenDJ Directory Server' )
 objectClasses: ( 1.3.6.1.4.1.36733.2.1.2.21
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java
index 624d7ec..fdd6400 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromConnection.java
@@ -317,7 +317,7 @@
         {
           // Update the schema: so that when we call the server code the
           // latest schema read on the server we are managing is used.
-          DirectoryServer.setSchema(schema);
+          DirectoryServer.getInstance().getServerContext().getSchemaHandler().updateSchema(schema);
         }
       }
       catch (OpenDsException oe)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
index bdec4ca..5d96bad 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
@@ -138,7 +138,7 @@
         {
           // Update the schema: so that when we call the server code the
           // latest schema read on the server we are managing is used.
-          DirectoryServer.setSchema(schema);
+          DirectoryServer.getInstance().getServerContext().getSchemaHandler().updateSchema(schema);
         }
       }
       catch (final OpenDsException oe)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
index 4f3bce1..d823166 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
@@ -34,7 +34,6 @@
 import org.forgerock.opendj.ldap.LdapException;
 import org.forgerock.opendj.ldap.requests.SearchRequest;
 import org.forgerock.opendj.ldap.responses.SearchResultEntry;
-import org.forgerock.opendj.ldap.schema.MatchingRuleImpl;
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.forgerock.opendj.ldap.schema.SchemaBuilder;
 import org.opends.admin.ads.util.ConnectionWrapper;
@@ -96,20 +95,6 @@
 
   }
 
-  private void addMatchingRuleIfMissing(SchemaBuilder schemaBuilder, Schema baseSchema, final String oid,
-      final String name, final String syntaxOID, final MatchingRuleImpl impl) throws InitializationException,
-      ConfigException, DirectoryException
-  {
-    if (!baseSchema.hasMatchingRule(name))
-    {
-      schemaBuilder.buildMatchingRule(oid)
-        .names(name)
-        .syntaxOID(syntaxOID)
-        .implementation(impl)
-        .addToSchema();
-    }
-  }
-
   private void removeNonOpenDjOrOpenDsSyntaxes(final SearchResultEntry entry) throws DirectoryException
   {
     Attribute attribute = entry.getAttribute(AttributeDescription.create(getLDAPSyntaxesAttributeType()));
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java
index 0cfe573..6b17709 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java
@@ -17,12 +17,10 @@
 package org.opends.guitools.controlpanel.util;
 
 import static org.opends.messages.SchemaMessages.ERR_SCHEMA_HAS_WARNINGS;
-import static org.opends.messages.ConfigMessages.*;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -43,6 +41,8 @@
 import org.opends.server.schema.SchemaHandler;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.InitializationException;
+import org.opends.server.util.SchemaUtils;
+import org.opends.server.util.StaticUtils;
 
 /** Class used to retrieve the schema from the schema files. */
 public class SchemaLoader
@@ -106,7 +106,7 @@
   {
     SchemaHandler schemaHandler = serverContext.getSchemaHandler();
     final File schemaDir = schemaHandler.getSchemaDirectoryPath();
-    final List<String> fileNames = getSchemaFileNames(schemaDir);
+    final List<String> fileNames = StaticUtils.getFileNames(SchemaUtils.getSchemaFiles(schemaDir));
 
     // build the schema from schema files
     Schema baseSchema = getBaseSchema();
@@ -130,30 +130,6 @@
     return schema;
   }
 
-  private List<String> getSchemaFileNames(final File schemaDir)
-      throws InitializationException
-  {
-    final List<String> fileNames;
-    try
-    {
-      File[] schemaFiles = schemaDir.listFiles(new SchemaHandler.SchemaFileFilter());
-      fileNames = new ArrayList<>(schemaFiles.length);
-      for (File f : schemaFiles)
-      {
-        if (f.isFile())
-        {
-          fileNames.add(f.getName());
-        }
-      }
-      Collections.sort(fileNames);
-      return fileNames;
-    }
-    catch (Exception e)
-    {
-      throw new InitializationException(ERR_CONFIG_SCHEMA_CANNOT_LIST_FILES.get(schemaDir, e.getMessage()), e);
-    }
-  }
-
   /**
    * Returns a basic version of the schema. The schema is created and contains
    * enough definitions for the schema to be loaded.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java
index f091e8f..c4c1a52 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java
@@ -96,7 +96,6 @@
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.LDIFExportConfig;
 import org.opends.server.types.LDIFImportConfig;
-import org.opends.server.util.ActivateOnceSDKSchemaIsUsed;
 import org.opends.server.util.LDIFException;
 import org.opends.server.util.LDIFReader;
 import org.opends.server.util.LDIFWriter;
@@ -588,7 +587,6 @@
    * @throws DirectoryException
    *           If a problem occurs while trying to replace the entry.
    */
-  @ActivateOnceSDKSchemaIsUsed("uncomment code down below in this method")
   public void replaceEntry(final Entry oldEntry, final Entry newEntry) throws DirectoryException
   {
     final DN newEntryDN = newEntry.getName();
@@ -598,13 +596,12 @@
           ERR_CONFIG_FILE_MODIFY_NO_SUCH_ENTRY.get(oldEntry), getMatchedDN(newEntryDN), null);
     }
 
-    // TODO : add objectclass and attribute to the config schema in order to get this code run
-    // if (!Entries.getStructuralObjectClass(oldEntry, configEnabledSchema)
-    // .equals(Entries.getStructuralObjectClass(newEntry, configEnabledSchema)))
-    // {
-    // throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
-    // ERR_CONFIG_FILE_MODIFY_STRUCTURAL_CHANGE_NOT_ALLOWED.get(entryDN));
-    // }
+    if (!Entries.getStructuralObjectClass(oldEntry, serverContext.getSchema()).equals(
+        Entries.getStructuralObjectClass(newEntry, serverContext.getSchema())))
+    {
+      throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
+          ERR_CONFIG_FILE_MODIFY_STRUCTURAL_CHANGE_NOT_ALLOWED.get(oldEntry.getName()));
+    }
 
     // Iterate through change listeners to make sure the change is acceptable.
     final List<ConfigChangeListener> changeListeners = getChangeListeners(newEntryDN);
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 102fbe3..118a269 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
@@ -2185,18 +2185,6 @@
   }
 
   /**
-   * Replaces the Directory Server schema with the provided schema.
-   *
-   * @param  newSchema  The new schema to use for the Directory Server.
-   * @throws DirectoryException
-   *            If the new schema contains warnings.
-   */
-  public static void setSchema(Schema newSchema) throws DirectoryException
-  {
-    directoryServer.schemaHandler.updateSchema(newSchema);
-  }
-
-  /**
    * Retrieves the set of virtual attribute rules registered with the Directory
    * Server.
    *
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java
index c632fb8..3808506 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -276,11 +276,7 @@
     }
 
     // If any schema changes were made with the server offline, then handle them now.
-    List<Modification> offlineSchemaChanges = serverContext.getSchemaHandler().getOfflineSchemaModifications();
-    if (offlineSchemaChanges != null && !offlineSchemaChanges.isEmpty())
-    {
-      processSchemaChange(offlineSchemaChanges);
-    }
+    processSchemaChange(serverContext.getSchemaHandler().getOfflineSchemaModifications());
 
     DirectoryServer.registerBackupTaskListener(this);
     DirectoryServer.registerRestoreTaskListener(this);
@@ -580,10 +576,13 @@
   @Override
   public void processSchemaChange(List<Modification> modifications)
   {
-    LDAPReplicationDomain domain = findDomain(DirectoryServer.getSchemaDN(), null);
-    if (domain != null)
+    if (!modifications.isEmpty())
     {
-      domain.synchronizeSchemaModifications(modifications);
+      LDAPReplicationDomain domain = findDomain(DirectoryServer.getSchemaDN(), null);
+      if (domain != null)
+      {
+        domain.synchronizeSchemaModifications(modifications);
+      }
     }
   }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java
index 106c0dd..f2459b6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java
@@ -25,13 +25,16 @@
 import org.forgerock.opendj.config.server.ConfigurationChangeListener;
 import org.forgerock.opendj.ldap.schema.SchemaBuilder;
 import org.forgerock.opendj.server.config.server.CoreSchemaCfg;
+import org.opends.messages.ConfigMessages;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ServerContext;
 import org.opends.server.schema.SchemaHandler.SchemaUpdater;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.InitializationException;
 
-/** Provides the core schema, which includes core matching rules and syntaxes. */
+/**
+ * Provides the core schema, which includes core matching rules and syntaxes.
+ */
 public class CoreSchemaProvider implements SchemaProvider<CoreSchemaCfg>,
   ConfigurationChangeListener<CoreSchemaCfg>
 {
@@ -100,7 +103,6 @@
   public boolean isConfigurationAcceptable(final CoreSchemaCfg configuration,
       final List<LocalizableMessage> unacceptableReasons)
   {
-    // TODO : check that elements to disable are present in the schema ?
     return true;
   }
 
@@ -110,11 +112,9 @@
   {
     if (!configuration.isEnabled())
     {
-      // TODO : fix message
-      unacceptableReasons.add(LocalizableMessage.raw("The core schema must always be enabled"));
+      unacceptableReasons.add(ConfigMessages.ERR_CONFIG_CORE_SCHEMA_PROVIDER_DISABLED.get(configuration.dn()));
       return false;
     }
-    // TODO : check that elements to disable are present in the schema ?
     return true;
   }
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaFilesWriter.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaFilesWriter.java
index 351111d..89a2677 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaFilesWriter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaFilesWriter.java
@@ -130,10 +130,11 @@
       TreeSet<String> modifiedSchemaFiles, AlertGenerator alertGenerator)
           throws DirectoryException
   {
-    // We'll re-write all
-    // impacted schema files by first creating them in a temporary location
-    // and then replacing the existing schema files with the new versions.
-    // If all that goes successfully, then activate the new schema.
+    /*
+     * We'll re-write all impacted schema files by first creating them in a temporary location
+     * and then replacing the existing schema files with the new versions.
+     * If all that goes successfully, then activate the new schema.
+     */
     HashMap<String, File> tempSchemaFiles = new HashMap<>();
     try
     {
@@ -270,7 +271,10 @@
       File tempFile = new File(concatFilePath + ".tmp");
       try (BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile, false)))
       {
-        writeLines(writer, "dn: " + DirectoryServer.getSchemaDN(), "objectClass: top", "objectClass: ldapSubentry",
+        writeLines(writer,
+            "dn: " + DirectoryServer.getSchemaDN(),
+            "objectClass: top",
+            "objectClass: ldapSubentry",
             "objectClass: subschema");
 
         writeLines(writer, ATTR_ATTRIBUTE_TYPES, attributeTypes);
@@ -330,7 +334,7 @@
     TreeSet<File> schemaFiles = new TreeSet<>();
     String schemaDirectory = getSchemaDirectoryPath();
 
-    final FilenameFilter filter = new SchemaHandler.SchemaFileFilter();
+    final FilenameFilter filter = new SchemaUtils.SchemaFileFilter();
     for (File f : new File(schemaDirectory).listFiles(filter))
     {
       if (f.isFile())
@@ -541,9 +545,7 @@
   private File getUpgradeDirectory()
   {
     File configFile = serverContext.getEnvironment().getConfigFile();
-    File configDirectory = configFile.getParentFile();
-    File upgradeDirectory = new File(configDirectory, "upgrade");
-    return upgradeDirectory;
+    return new File(configFile.getParentFile(), "upgrade");
   }
 
   private File getConcatenatedSchemaFile() throws InitializationException
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaHandler.java
index 06f9aa1..21603a1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaHandler.java
@@ -16,7 +16,6 @@
 package org.opends.server.schema;
 
 import static java.util.Collections.emptyList;
-import static org.forgerock.util.Utils.closeSilently;
 import static org.opends.messages.ConfigMessages.*;
 import static org.opends.messages.SchemaMessages.*;
 import static org.opends.server.util.SchemaUtils.getElementSchemaFile;
@@ -28,7 +27,6 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
-import java.io.FilenameFilter;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -84,8 +82,6 @@
 import org.opends.server.util.SchemaUtils;
 import org.opends.server.util.StaticUtils;
 
-import com.forgerock.opendj.util.OperatingSystem;
-
 /**
  * Responsible for access to the server's schema.
  * <p>
@@ -153,7 +149,7 @@
   /** Guards updates to the schema. */
   private final Lock exclusiveLock = new ReentrantLock();
 
-  /** The oldest modification time for any schema configuration file, as a byte string. */
+  /** The oldest modification time for any schema configuration file. */
   private long oldestModificationTime;
 
   /** The youngest modification time for any schema configuration file. */
@@ -209,9 +205,6 @@
     this.serverContext = serverContext;
     this.schemaWriter = new SchemaFilesWriter(serverContext);
 
-    exclusiveLock.lock();
-    try
-    {
       // Start from the core schema
       final SchemaBuilder schemaBuilder = new SchemaBuilder(Schema.getCoreSchema());
 
@@ -223,18 +216,12 @@
 
       try
       {
-        switchSchema(schemaBuilder.toSchema());
+        updateSchema(schemaBuilder.toSchema());
       }
       catch (DirectoryException e)
       {
         throw new ConfigException(e.getMessageObject(), e);
       }
-
-    }
-    finally
-    {
-      exclusiveLock.unlock();
-    }
   }
 
   /**
@@ -319,7 +306,7 @@
    */
   public void detectChangesOnInitialization() throws InitializationException
   {
-    offlineSchemaModifications = schemaWriter.updateConcatenatedSchemaIfChangesDetected();
+    offlineSchemaModifications = Collections.unmodifiableList(schemaWriter.updateConcatenatedSchemaIfChangesDetected());
   }
 
   /**
@@ -365,11 +352,13 @@
    */
   public List<Modification> getOfflineSchemaModifications()
   {
-    return Collections.unmodifiableList(offlineSchemaModifications);
+    return offlineSchemaModifications;
   }
 
   /**
    * Updates the schema using the provided schema updater.
+   * <p>
+   * The schema files are not updated.
    *
    * @param updater
    *          the updater that performs modifications on the schema builder
@@ -392,6 +381,8 @@
 
   /**
    * Replaces the schema with the provided schema.
+   * <p>
+   * The schema files are not updated.
    *
    * @param schema
    *          the new schema to use
@@ -412,7 +403,9 @@
   }
 
   /**
-   * Replaces the schema with the provided schema and update provided schema files.
+   * Replaces the schema with the provided schema and updates the provided set of schema files.
+   * <p>
+   * The concatenated schema file is updated as well.
    *
    * @param newSchema
    *            The new schema to use
@@ -443,14 +436,14 @@
   }
 
   /**
-   * Replaces the schema with the provided schema and update the concatened schema files.
+   * Replaces the schema with the provided schema and update the concatenated schema file.
    *
    * @param newSchema
    *            The new schema to use
    * @throws DirectoryException
    *            If an error occurs during update of schema or schema files
    */
-  public void updateSchemaAndConcatenatedSchemaFiles(Schema newSchema) throws DirectoryException
+  public void updateSchemaAndConcatenatedSchemaFile(Schema newSchema) throws DirectoryException
   {
     exclusiveLock.lock();
     try
@@ -809,8 +802,8 @@
       throws ConfigException, InitializationException
   {
     final File schemaDirectory = getSchemaDirectoryPath();
-    final File[] schemaFiles = getSchemaFiles(schemaDirectory);
-    final List<String> schemaFileNames = getSchemaFileNames(schemaFiles);
+    final File[] schemaFiles = SchemaUtils.getSchemaFiles(schemaDirectory);
+    final List<String> schemaFileNames = StaticUtils.getFileNames(schemaFiles);
     updateModificationTimes(schemaFiles);
 
     for (String schemaFile : schemaFileNames)
@@ -819,35 +812,6 @@
     }
   }
 
-  private File[] getSchemaFiles(File schemaDirectory) throws InitializationException
-  {
-    try
-    {
-      return schemaDirectory.listFiles(new SchemaFileFilter());
-    }
-    catch (Exception e)
-    {
-      logger.traceException(e);
-      throw new InitializationException(
-          ERR_CONFIG_SCHEMA_CANNOT_LIST_FILES.get(schemaDirectory, getExceptionMessage(e)), e);
-    }
-  }
-
-  /** Returns the sorted list of names of schema files contained in the provided directory. */
-  private List<String> getSchemaFileNames(final File[] schemaFiles)
-  {
-    final List<String> schemaFileNames = new ArrayList<>(schemaFiles.length);
-    for (final File f : schemaFiles)
-    {
-      if (f.isFile())
-      {
-        schemaFileNames.add(f.getName());
-      }
-    }
-    Collections.sort(schemaFileNames);
-    return schemaFileNames;
-  }
-
   private void updateModificationTimes(final File[] schemaFiles)
   {
     for (final File file : schemaFiles)
@@ -880,8 +844,9 @@
   }
 
   /** Returns the schema entry from the provided reader, which may be {@code null} if file is empty. */
-  private Entry readSchemaEntry(final EntryReader reader, final File schemaFile) throws InitializationException {
-    try
+  private Entry readSchemaEntry(final File schemaFile, final Schema readSchema) throws InitializationException
+  {
+    try (EntryReader reader = getLDIFReader(schemaFile, readSchema))
     {
       if (!reader.hasNext())
       {
@@ -897,17 +862,15 @@
     }
     catch (IOException e)
     {
-      throw new InitializationException(WARN_CONFIG_SCHEMA_CANNOT_READ_LDIF_ENTRY.get(
-              schemaFile.getPath(), schemaFile.getParent(), getExceptionMessage(e)), e);
-    }
-    finally
-    {
-      closeSilently(reader);
+      throw new InitializationException(WARN_CONFIG_SCHEMA_CANNOT_READ_LDIF_ENTRY.get(schemaFile.getPath(), schemaFile
+          .getParent(), getExceptionMessage(e)), e);
     }
   }
 
   /**
    * Loads the contents of the provided schema file into the provided schema builder.
+   * <p>
+   * This method has no effect on the current schema.
    *
    * @param schemaFile
    *            The schema file to load.
@@ -929,6 +892,8 @@
   /**
    * Loads the contents of the provided schema file into the provided schema builder and returns the list
    * of modifications.
+   * <p>
+   * This method has no effect on the current schema.
    *
    * @param schemaFile
    *          The schema file to load.
@@ -998,20 +963,13 @@
       boolean failOnError)
          throws InitializationException, ConfigException
   {
-    EntryReader reader = null;
-    try
+    final Entry entry = readSchemaEntry(schemaFile, readSchema);
+    if (entry != null)
     {
-      reader = getLDIFReader(schemaFile, readSchema);
-      final Entry entry = readSchemaEntry(reader, schemaFile);
-      if (entry != null)
-      {
-        updateSchemaBuilderWithEntry(schemaBuilder, entry, schemaFile.getName(), failOnError);
-      }
-      return entry;
+      updateSchemaBuilderWithEntry(schemaBuilder, entry, schemaFile.getName(), failOnError);
     }
-    finally {
-      Utils.closeSilently(reader);
-    }
+    return entry;
+
   }
 
   private void updateSchemaBuilderWithEntry(SchemaBuilder schemaBuilder, Entry schemaEntry, String schemaFile,
@@ -1129,19 +1087,6 @@
     logger.error(message);
   }
 
-  /** A file filter implementation that accepts only LDIF files. */
-  public static class SchemaFileFilter implements FilenameFilter
-  {
-    private static final String LDIF_SUFFIX = ".ldif";
-
-    @Override
-    public boolean accept(File directory, String filename)
-    {
-      return OperatingSystem.isWindows() ?
-          filename.toLowerCase().endsWith(LDIF_SUFFIX) : filename.endsWith(LDIF_SUFFIX);
-    }
-  }
-
   /** Interface to update a schema provided a schema builder. */
   public interface SchemaUpdater
   {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
index acbb9cf..23e3f8b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
@@ -26,7 +26,6 @@
 import org.forgerock.opendj.config.server.ConfigException;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.schema.AttributeType;
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.forgerock.opendj.ldap.schema.SchemaBuilder;
 import org.forgerock.opendj.server.config.server.SynchronizationProviderCfg;
@@ -35,7 +34,6 @@
 import org.opends.server.backends.task.Task;
 import org.opends.server.backends.task.TaskState;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.core.ServerContext;
 import org.opends.server.schema.SchemaHandler;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeBuilder;
@@ -90,10 +88,8 @@
 
     // Get the attribute that specifies which schema file(s) to add.
     Entry taskEntry = getTaskEntry();
-    ServerContext serverContext = getServerContext();
-    AttributeType attrType = serverContext.getSchema().getAttributeType(ATTR_TASK_ADDSCHEMAFILE_FILENAME);
-    List<Attribute> attrList = taskEntry.getAllAttributes(attrType);
-    if (attrList.isEmpty())
+    Iterable<Attribute> attrList = taskEntry.getAllAttributes(ATTR_TASK_ADDSCHEMAFILE_FILENAME);
+    if (!attrList.iterator().hasNext())
     {
       LocalizableMessage message = ERR_TASK_ADDSCHEMAFILE_NO_FILENAME.get(
           ATTR_TASK_ADDSCHEMAFILE_FILENAME, taskEntry.getName());
@@ -140,7 +136,7 @@
     // it will be good to do it now as well so we can reject
     // the entry immediately which will fail the attempt by the client to add it
     // to the server, rather than having to check its status after the fact.
-    final SchemaHandler schemaHandler = serverContext.getSchemaHandler();
+    final SchemaHandler schemaHandler = getServerContext().getSchemaHandler();
     final Schema currentSchema = schemaHandler.getSchema();
     final SchemaBuilder schemaBuilder = new SchemaBuilder(currentSchema);
     for (String schemaFile : filesToAdd)
@@ -239,7 +235,7 @@
         final Schema newSchema = schemaBuilder.toSchema();
         try
         {
-          schemaHandler.updateSchemaAndConcatenatedSchemaFiles(newSchema);
+          schemaHandler.updateSchemaAndConcatenatedSchemaFile(newSchema);
         }
         catch (DirectoryException e)
         {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
index 7309e91..1ede286 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
@@ -56,8 +56,8 @@
 import org.forgerock.opendj.ldif.LDIFEntryReader;
 import org.forgerock.opendj.ldif.LDIFEntryWriter;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.schema.SchemaHandler;
 import org.opends.server.util.ChangeOperationType;
+import org.opends.server.util.SchemaUtils;
 
 import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
 import static org.forgerock.opendj.ldap.schema.SchemaOptions.*;
@@ -632,7 +632,7 @@
     // and add all attribute/object classes in this new super entry which
     // will be read at start-up.
     Entry theNewSchemaEntry = new LinkedHashMapEntry();
-    final FilenameFilter filter = new SchemaHandler.SchemaFileFilter();
+    final FilenameFilter filter = new SchemaUtils.SchemaFileFilter();
     for (final File f : folder.listFiles(filter))
     {
       logger.debug(LocalizableMessage.raw("Processing %s", f.getAbsolutePath()));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/ActivateOnceSDKSchemaIsUsed.java b/opendj-server-legacy/src/main/java/org/opends/server/util/ActivateOnceSDKSchemaIsUsed.java
deleted file mode 100644
index a85b2a4..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/ActivateOnceSDKSchemaIsUsed.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2015-2016 ForgeRock AS.
- */
-package org.opends.server.util;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Temporary annotation to remind that annotated code should be activated once the
- * SDK schema is used in place of legacy server schema.
- */
-@Retention(RetentionPolicy.SOURCE)
-@RemoveOnceSDKSchemaIsUsed
-public @interface ActivateOnceSDKSchemaIsUsed
-{
-  /** Optional comment on activation. */
-  String value() default "";
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/RemoveOnceSDKSchemaIsUsed.java b/opendj-server-legacy/src/main/java/org/opends/server/util/RemoveOnceSDKSchemaIsUsed.java
deleted file mode 100644
index 030bddd..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/RemoveOnceSDKSchemaIsUsed.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2015 ForgeRock AS.
- */
-package org.opends.server.util;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Temporary annotation to remind that annotated code could be removed once the
- * SDK schema is used in place of legacy server schema.
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface RemoveOnceSDKSchemaIsUsed
-{
-  /** Optional comment on removal. */
-  String value() default "";
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java
index 650808d..18289c4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/SchemaUtils.java
@@ -15,11 +15,15 @@
  */
 package org.opends.server.util;
 
+import static org.opends.messages.ConfigMessages.ERR_CONFIG_SCHEMA_CANNOT_LIST_FILES;
+import static org.opends.server.util.StaticUtils.getExceptionMessage;
 import static org.opends.messages.SchemaMessages.*;
 import static org.opends.server.util.ServerConstants.SCHEMA_PROPERTY_FILENAME;
 import static org.opends.server.schema.SchemaConstants.SYNTAX_AUTH_PASSWORD_OID;
 import static org.opends.server.schema.SchemaConstants.SYNTAX_USER_PASSWORD_OID;
 
+import java.io.File;
+import java.io.FilenameFilter;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
@@ -36,7 +40,9 @@
 import org.forgerock.opendj.ldap.schema.SchemaElement;
 import org.opends.server.core.ServerContext;
 import org.opends.server.types.DirectoryException;
+import org.opends.server.types.InitializationException;
 
+import com.forgerock.opendj.util.OperatingSystem;
 import com.forgerock.opendj.util.SubstringReader;
 
 /** Utility methods related to schema. */
@@ -59,6 +65,19 @@
     NOT_A_PASSWORD
   }
 
+  /** A file filter implementation that accepts only LDIF files. */
+  public static class SchemaFileFilter implements FilenameFilter
+  {
+    private static final String LDIF_SUFFIX = ".ldif";
+
+    @Override
+    public boolean accept(File directory, String filename)
+    {
+      return OperatingSystem.isWindows() ?
+          filename.toLowerCase().endsWith(LDIF_SUFFIX) : filename.endsWith(LDIF_SUFFIX);
+    }
+  }
+
   /**
    * Checks if the provided attribute type contains a password.
    *
@@ -212,6 +231,28 @@
   }
 
   /**
+   * Returns the list of schema files contained in the provided schema directory.
+   *
+   * @param schemaDirectory
+   *            The directory containing schema files
+   * @return the schema files
+   * @throws InitializationException
+   *            If the files can't be retrieved
+   */
+  public static File[] getSchemaFiles(File schemaDirectory) throws InitializationException
+  {
+    try
+    {
+      return schemaDirectory.listFiles(new SchemaUtils.SchemaFileFilter());
+    }
+    catch (Exception e)
+    {
+      throw new InitializationException(
+          ERR_CONFIG_SCHEMA_CANNOT_LIST_FILES.get(schemaDirectory, getExceptionMessage(e)), e);
+    }
+  }
+
+  /**
    * Adds the provided schema file to the provided schema element definition.
    *
    * @param definition
@@ -286,9 +327,8 @@
     }
     catch (final StringIndexOutOfBoundsException e)
     {
-      // TODO : write the correct message = Error when trying to parse the schema file from a schema
-      // element definition
-      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, LocalizableMessage.raw(""));
+      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
+          LocalizableMessage.raw("Error when trying to parse the schema file from a schema element definition"));
     }
   }
 
@@ -417,9 +457,8 @@
    * @return the OID corresponding to the definition
    * @throws DirectoryException
    *            If the parsing of the definition fails
-   *
-   * */
-  public static String parseOID(String definition, Arg1<Object> parsingErrorMsg) throws DirectoryException
+   */
+  private static String parseOID(String definition, Arg1<Object> parsingErrorMsg) throws DirectoryException
   {
     try
     {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
index d89358d..9b1af2b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
@@ -1780,14 +1780,11 @@
   public static boolean deleteFiles(Iterable<File> files)
   {
     boolean allDeleted = true;
-    if (files != null)
+    for (File f : files)
     {
-      for (File f : files)
+      if (!f.isDirectory())
       {
-          if (!f.isDirectory())
-          {
-            allDeleted = f.delete() && allDeleted;
-          }
+        allDeleted &= f.delete();
       }
     }
     return allDeleted;
@@ -1897,6 +1894,27 @@
   }
 
   /**
+   * Returns the sorted list of names of provided files.
+   *
+   * @param files
+   *            The files to sort and get the names of
+   * @return the sorted list of file names
+   */
+  public static List<String> getFileNames(final File[] files)
+  {
+    final List<String> names = new ArrayList<>(files.length);
+    for (final File f : files)
+    {
+      if (f.isFile())
+      {
+        names.add(f.getName());
+      }
+    }
+    Collections.sort(names);
+    return names;
+  }
+
+  /**
    * Retrieves a {@code File} object corresponding to the specified path.
    * If the given path is an absolute path, then it will be used.  If the path
    * is relative, then it will be interpreted as if it were relative to the
diff --git a/opendj-server-legacy/src/messages/org/opends/messages/config.properties b/opendj-server-legacy/src/messages/org/opends/messages/config.properties
index da5360a..7adb162 100644
--- a/opendj-server-legacy/src/messages/org/opends/messages/config.properties
+++ b/opendj-server-legacy/src/messages/org/opends/messages/config.properties
@@ -856,10 +856,10 @@
 ERR_CONFIG_SCHEMA_PROVIDER_CONFIG_NOT_ACCEPTABLE_758=The configuration of schema provider '%s' \
  is not acceptable for the following reasons: %s
 ERR_CONFIG_SCHEMA_PROVIDER_CANT_BE_INITIALIZED_759=The schema provider class '%s' could not be \
- instanciated or initialized with the configuration '%s' : %s
+ instantiated or initialized with the configuration '%s' : %s
 ERR_CONFIG_CORE_SCHEMA_PROVIDER_DISABLED_760=The core schema provider defined by '%s' \
- has been disabled. The core schema must alwasy be enabled.
-WARN_CONFIG_SCHEMA_FILE_HAS_SCHEMA_WARNING_761=The config schema file '%s' generates warning when \
+ has been disabled. The core schema must always be enabled.
+WARN_CONFIG_SCHEMA_FILE_HAS_SCHEMA_WARNING_761=The config schema file '%s' generated warning when \
  trying to update schema with its content: %s
-WARN_CONFIG_SCHEMA_FILE_HAS_SCHEMA_WARNING_WITH_OVERWRITE_762=The config schema file '%s' generates warning when \
- trying to update schema with its content, despite allowing to overwrite definitions: %s
\ No newline at end of file
+WARN_CONFIG_SCHEMA_FILE_HAS_SCHEMA_WARNING_WITH_OVERWRITE_762=The config schema file '%s' generated \
+ warning when trying to update schema with its content, despite allowing to overwrite definitions: %s
\ No newline at end of file
diff --git a/opendj-server-legacy/src/messages/org/opends/messages/task.properties b/opendj-server-legacy/src/messages/org/opends/messages/task.properties
index e5a9d88..4783903 100644
--- a/opendj-server-legacy/src/messages/org/opends/messages/task.properties
+++ b/opendj-server-legacy/src/messages/org/opends/messages/task.properties
@@ -193,5 +193,5 @@
   does not appear to be a replication server
 ERR_TASK_RESET_CHANGE_NUMBER_INVALID_114=Invalid change number (%d) specified, it must be greater than zero
 ERR_TASK_RESET_CHANGE_NUMBER_FAILED_115=Unable to reset the change number index: %s
-ERR_TASK_ADDSCHEMAFILE_SCHEMA_VALIDATION_ERROR_116=An error occurred while attempting to \
- validate the schema after changes made by the add schema file task: %s
\ No newline at end of file
+ERR_TASK_ADDSCHEMAFILE_SCHEMA_VALIDATION_ERROR_116=The changes made by the add schema \
+ file task failed schema validation: %s
\ No newline at end of file
diff --git a/opendj-server-legacy/src/messages/org/opends/messages/tool.properties b/opendj-server-legacy/src/messages/org/opends/messages/tool.properties
index 4798fd8..3c95cfe 100644
--- a/opendj-server-legacy/src/messages/org/opends/messages/tool.properties
+++ b/opendj-server-legacy/src/messages/org/opends/messages/tool.properties
@@ -2570,8 +2570,7 @@
 INFO_UPGRADE_TASK_DISABLING_HTTP_CONNECTION_HANDLER_10074=Disabling the HTTP connection handler
 INFO_UPGRADE_TASK_ADDING_DEFAULT_HTTP_ENDPOINTS_AND_AUTH_10075=Adding default HTTP endpoints and auth mechanisms to \
   configuration
-INFO_UPGRADE_TASK_REMOVE_MATCHING_RULES_ENTRY_10076=Removing top configuration entry \
- for matching rules
+INFO_UPGRADE_TASK_REMOVE_MATCHING_RULES_ENTRY_10076=Removing top configuration entry for matching rules
 INFO_UPGRADE_TASK_REMOVE_SYNTAXES_10077=Removing configuration for syntaxes
 INFO_UPGRADE_TASK_ADD_SCHEMA_PROVIDERS_10078=Adding configuration for schema providers
 
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java b/opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
index 76663c9..f3868fb 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
@@ -238,7 +238,7 @@
   public static void startFakeServer() throws Exception
   {
     schemaBeforeStartingFakeServer = DirectoryServer.getSchema();
-    DirectoryServer.setSchema(Schema.getDefaultSchema());
+    DirectoryServer.getInstance().getServerContext().getSchemaHandler().updateSchema(Schema.getDefaultSchema());
   }
 
   /**
@@ -753,7 +753,7 @@
    */
   public static void shutdownFakeServer() throws DirectoryException
   {
-    DirectoryServer.setSchema(schemaBeforeStartingFakeServer);
+    DirectoryServer.getInstance().getServerContext().getSchemaHandler().updateSchema(schemaBeforeStartingFakeServer);
   }
 
   /**
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
index 85ebcd1..0619d92 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
@@ -73,6 +73,7 @@
 import org.opends.server.util.ServerConstants;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 /** A set of test cases for the schema backend. */
@@ -594,37 +595,137 @@
   }
 
   /**
+   * The type of modification.
+   * <p>
+   * This enumeration allows to have more readable tests data (avoid use of boolean).
+   */
+  enum ModifyType {
+    PERMISSIVE(true),
+    NON_PERMISSIVE(false);
+
+    private final String[] modifyArgs;
+
+    private ModifyType(boolean permissive)
+    {
+      this.modifyArgs = SchemaBackendTestCase.args(permissive);
+    }
+
+    /** Returns the arguments to use for the modify operation. */
+    String[] args()
+    {
+      return modifyArgs;
+    }
+  }
+
+  @DataProvider
+  public Object[][] dataForAddAttributeTypeReplaceTest()
+  {
+    return new Object[][] {
+      // change syntax
+      { ModifyType.PERMISSIVE, "attributeTypes:( at1-replace-oid " +
+          "NAME 'at1-replace' " +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", SUCCESS },
+      // add an unused name
+      { ModifyType.PERMISSIVE, "attributeTypes:( at1-replace-oid " +
+          "NAME ('at1-replace' 'at1-replace-bis')" +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", SUCCESS },
+      // use another unused name
+      { ModifyType.PERMISSIVE, "attributeTypes:( at1-replace-oid " +
+          "NAME 'at1-replace-bis'" +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", SUCCESS },
+      // add a name already used by another attribute type
+      { ModifyType.PERMISSIVE, "attributeTypes:( at1-replace-oid " +
+          "NAME ('at1-replace' 'cn')" +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", CONSTRAINT_VIOLATION },
+      // use another unused oid with the same name
+      { ModifyType.PERMISSIVE, "attributeTypes:( at1-replace-oid-new " +
+          "NAME 'at1-replace'" +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", CONSTRAINT_VIOLATION },
+
+      // change syntax
+      { ModifyType.NON_PERMISSIVE, "attributeTypes:( at1-replace-oid " +
+          "NAME 'at1-replace' " +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", ATTRIBUTE_OR_VALUE_EXISTS },
+      // add an unused name
+      { ModifyType.NON_PERMISSIVE, "attributeTypes:( at1-replace-oid " +
+          "NAME ('at1-replace' 'at1-replace-bis')" +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", ATTRIBUTE_OR_VALUE_EXISTS },
+      // use another unused name
+      { ModifyType.NON_PERMISSIVE, "attributeTypes:( at1-replace-oid " +
+          "NAME 'at1-replace-bis'" +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", ATTRIBUTE_OR_VALUE_EXISTS },
+      // add a name already used by another attribute type
+      { ModifyType.NON_PERMISSIVE, "attributeTypes:( at1-replace-oid " +
+          "NAME ('at1-replace' 'cn')" +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", ATTRIBUTE_OR_VALUE_EXISTS },
+      // use another unused oid with the same name
+      { ModifyType.NON_PERMISSIVE, "attributeTypes:( at1-replace-oid-new " +
+          "NAME 'at1-replace'" +
+          "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
+          "X-ORIGIN 'SchemaBackendTestCase' )", CONSTRAINT_VIOLATION },
+    };
+  }
+
+  /**
    * Tests the behavior of the schema backend when attempting to add a new
    * attribute type in a manner that replaces an existing definition.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
    */
-  @Test
-  public void testAddAttributeTypeSuccessfulReplace()
-         throws Exception
+  @Test(dataProvider= "dataForAddAttributeTypeReplaceTest")
+  public void testAddAttributeTypeReplace(ModifyType modifyType, String newAttributeTypeDefinition,
+      ResultCode expectedResultCode)
+          throws Exception
   {
-    String ldif = toLdif(
+    final String initialOid = "at1-replace-oid";
+    final String initialName = "at1-replace";
+    try
+    {
+      // add the attribute that does not exists yet, this should always succeed
+      String ldifAdd1 = toLdif(
          "dn: cn=schema",
          "changetype: modify",
          "add: attributeTypes",
-         "attributeTypes: ( testaddattributetypesuccessfulreplace-oid " +
-              "NAME 'testAddAttributeTypeSuccessfulReplace' " +
+         "attributeTypes: ( " + initialOid + " " +
+             "NAME '" + initialName + "' " +
               "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE " +
-              "X-ORIGIN 'SchemaBackendTestCase' )",
-         "",
-         "dn: cn=schema",
-         "changetype: modify",
-         "add: attributeTypes",
-         "attributeTypes: ( testaddattributetypesuccessfulreplace-oid " +
-              "NAME 'testAddAttributeTypeSuccessfulReplace' " +
-              "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE " +
               "X-ORIGIN 'SchemaBackendTestCase' )");
+      assertFalse(DirectoryServer.getSchema().hasAttributeType(initialOid));
+      assertFalse(DirectoryServer.getSchema().hasAttributeType(initialName));
+      runModify(argsNotPermissive(), ldifAdd1, System.err, SUCCESS);
+      assertTrue(DirectoryServer.getSchema().hasAttributeType(initialOid));
+      assertTrue(DirectoryServer.getSchema().hasAttributeType(initialName));
 
-    String attrName = "testaddattributetypesuccessfulreplace";
-    assertFalse(DirectoryServer.getSchema().hasAttributeType(attrName));
+      // try to add the attribute again, with its new definition
+      String ldifAdd2 = toLdif(
+          "dn: cn=schema",
+          "changetype: modify",
+          "add: attributeTypes",
+          newAttributeTypeDefinition);
 
-    runModify(argsPermissive(), ldif, System.err, SUCCESS);
-    assertTrue(DirectoryServer.getSchema().hasAttributeType(attrName));
+      runModify(modifyType.args(), ldifAdd2, System.err, expectedResultCode);
+    }
+    finally
+    {
+      // clean the attribute to put back the schema in its initial state before the test
+      if (DirectoryServer.getSchema().hasAttributeType(initialOid))
+      {
+        String removalLdif = toLdif(
+          "dn: cn=schema",
+          "changetype: modify",
+          "delete: attributeTypes",
+          "attributeTypes: ( " + initialOid + " )"
+          );
+        runModify(argsPermissive(), removalLdif, System.err, SUCCESS);
+      }
+    }
   }
 
   /**
@@ -1365,36 +1466,104 @@
     assertSchemaFileExists("98-schema-test-oc.ldif", true);
   }
 
+  @DataProvider
+  public Object[][] dataForAddObjectClassReplaceTest()
+  {
+    return new Object[][] {
+      // change optional attribute
+      { ModifyType.PERMISSIVE, "objectClasses: ( oc1-replace-oid " +
+          "NAME 'oc1-replace' SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", SUCCESS },
+      // add an unused name
+      { ModifyType.PERMISSIVE, "objectClasses: ( oc1-replace-oid " +
+          "NAME ('oc1-replace' 'oc1-replace-bis') SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", SUCCESS },
+      // use another unused name
+      { ModifyType.PERMISSIVE, "objectClasses: ( oc1-replace-oid " +
+          "NAME 'oc1-replace-bis' SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", SUCCESS },
+      // add a name already used by another object class
+      { ModifyType.PERMISSIVE, "objectClasses: ( oc1-replace-oid " +
+          "NAME ('oc1-replace' 'person') SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", CONSTRAINT_VIOLATION },
+      // use another unused oid with the same name
+      { ModifyType.PERMISSIVE, "objectClasses: ( oc1-replace-oid-new " +
+          "NAME 'oc1-replace' SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", CONSTRAINT_VIOLATION },
+
+      // change optional attribute
+      { ModifyType.NON_PERMISSIVE, "objectClasses: ( oc1-replace-oid " +
+          "NAME 'oc1-replace' SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", ATTRIBUTE_OR_VALUE_EXISTS },
+      // add an unused name
+      { ModifyType.NON_PERMISSIVE, "objectClasses: ( oc1-replace-oid " +
+          "NAME ('oc1-replace' 'oc1-replace-bis') SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", ATTRIBUTE_OR_VALUE_EXISTS },
+      // use another unused name
+      { ModifyType.NON_PERMISSIVE, "objectClasses: ( oc1-replace-oid " +
+          "NAME 'oc1-replace-bis' SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", ATTRIBUTE_OR_VALUE_EXISTS },
+      // add a name already used by another object class
+      { ModifyType.NON_PERMISSIVE, "objectClasses: ( oc1-replace-oid " +
+          "NAME ('oc1-replace' 'person') SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", ATTRIBUTE_OR_VALUE_EXISTS },
+      // use another unused oid with the same name
+      { ModifyType.NON_PERMISSIVE, "objectClasses: ( oc1-replace-oid-new " +
+          "NAME 'oc1-replace' SUP top STRUCTURAL " +
+          "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )", CONSTRAINT_VIOLATION },
+    };
+  }
+
   /**
    * Tests the behavior of the schema backend when attempting to add a new
-   * objectclass that already exists (i.e., a replace)
-   *
-   * @throws  Exception  If an unexpected problem occurs.
+   * objectclass that already exists (i.e., a replace).
    */
-  @Test
-  public void testAddObjectClassSuccessfulReplace()
+  @Test(dataProvider="dataForAddObjectClassReplaceTest")
+  public void testAddObjectClassReplace(ModifyType modifyType, String newObjectClassDefinition,
+      ResultCode expectedResultCode)
          throws Exception
   {
-    String ldif = toLdif(
-         "dn: cn=schema",
-         "changetype: modify",
-         "add: objectClasses",
-         "objectClasses: ( testaddobjectclasssuccessfulreplace-oid " +
-              "NAME 'testAddObjectClassSuccessfulReplace' SUP top STRUCTURAL " +
-              "MUST cn X-ORIGIN 'SchemaBackendTestCase' )",
-         "",
-         "dn: cn=schema",
-         "changetype: modify",
-         "add: objectClasses",
-         "objectClasses: ( testaddobjectclasssuccessfulreplace-oid " +
-              "NAME 'testAddObjectClassSuccessfulReplace' SUP top STRUCTURAL " +
-              "MUST cn MAY description X-ORIGIN 'SchemaBackendTestCase' )");
+    final String initialOid = "oc1-replace-oid";
+    final String initialName = "oc1-replace";
+    try
+    {
+      // add the attribute that does not exists yet, this should always succeed
+      String ldifAdd1 = toLdif(
+           "dn: cn=schema",
+           "changetype: modify",
+           "add: objectClasses",
+           "objectClasses: ( " + initialOid + " " +
+                "NAME '" + initialName + "' " +
+                "SUP top STRUCTURAL " +
+                "MUST cn X-ORIGIN 'SchemaBackendTestCase' )");
+      assertFalse(DirectoryServer.getSchema().hasObjectClass(initialOid));
+      assertFalse(DirectoryServer.getSchema().hasObjectClass(initialName));
+      runModify(argsNotPermissive(), ldifAdd1, System.err, SUCCESS);
+      assertTrue(DirectoryServer.getSchema().hasObjectClass(initialOid));
+      assertTrue(DirectoryServer.getSchema().hasObjectClass(initialName));
 
-    String ocName = "testaddobjectclasssuccessfulreplace";
-    assertFalse(DirectoryServer.getSchema().hasObjectClass(ocName));
+      // try to add the attribute again, with its new definition
+      String ldifAdd2 = toLdif(
+          "dn: cn=schema",
+          "changetype: modify",
+          "add: objectClasses",
+          newObjectClassDefinition);
 
-    runModify(argsPermissive(), ldif, System.err, SUCCESS);
-    assertTrue(DirectoryServer.getSchema().hasObjectClass(ocName));
+      runModify(modifyType.args(), ldifAdd2, System.err, expectedResultCode);
+    }
+    finally
+    {
+      // clean the object class to put back the schema in its initial state before the test
+      if (DirectoryServer.getSchema().hasObjectClass(initialOid))
+      {
+        String removalLdif = toLdif(
+          "dn: cn=schema",
+          "changetype: modify",
+          "delete: objectClasses",
+          "objectClasses: ( " + initialOid + " )");
+        runModify(argsPermissive(), removalLdif, System.err, SUCCESS);
+      }
+    }
   }
 
   /**
@@ -1884,17 +2053,17 @@
     assertTrue(DirectoryServer.getSchema().hasObjectClass(ocName));
   }
 
-  private String[] argsNotPermissive()
+  private static String[] argsNotPermissive()
   {
     return args(false);
   }
 
-  private String[] argsPermissive()
+  private static String[] argsPermissive()
   {
     return args(true);
   }
 
-  private String[] args(boolean usePermissiveModifyControl)
+  private static String[] args(boolean usePermissiveModifyControl)
   {
     final List<String> args = CollectionUtils.newArrayList(
       "-h", "127.0.0.1",
@@ -3491,14 +3660,12 @@
   }
 
   /**
-   * Tests the addition of a new DITContentRule with a conflicting rule identifier.
+   * Tests the addition of a new DITContentRule with a conflicting rule identifier and permissive control.
    *
    * @throws Exception
    *           If an unexpected problem occurs.
    */
-  // TODO: this test fails because I removed checks on names when adding a schema element
-  // Should I put them back ?
-  @Test(enabled=false)
+  @Test
   public void testAddDITStructureRuleConflictingRuleIDWithPermissiveControl() throws Exception
   {
 
@@ -3510,7 +3677,7 @@
         "-",
         "add: dITStructureRules",
         "dITStructureRules: ( 1 NAME 'dummyStructureRule' FORM domainNameForm )");
-    runModify(argsPermissive(), ldif, CONSTRAINT_VIOLATION);
+    runModify(argsPermissive(), ldif, SUCCESS);
   }
 
   /**
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeTypeSyntaxTest.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeTypeSyntaxTest.java
deleted file mode 100644
index 101034d..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeTypeSyntaxTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2016 ForgeRock AS.
- */
-package org.opends.server.schema;
-
-import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.SearchScope;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.forgerock.opendj.ldap.schema.Schema;
-import org.forgerock.opendj.ldap.schema.SchemaBuilder;
-import org.forgerock.opendj.ldap.schema.Syntax;
-import org.opends.server.TestCaseUtils;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.protocols.internal.InternalSearchOperation;
-import org.opends.server.protocols.internal.SearchRequest;
-import org.opends.server.util.RemoveOnceSDKSchemaIsUsed;
-import org.testng.annotations.Test;
-
-import static org.opends.server.protocols.internal.InternalClientConnection.*;
-import static org.opends.server.protocols.internal.Requests.*;
-import static org.testng.Assert.*;
-
-/** Test the AttributeTypeSyntax. */
-@RemoveOnceSDKSchemaIsUsed
-public class AttributeTypeSyntaxTest extends SchemaTestCase
-{
-
-  /**
-   * Tests the use of the "X-APPROX" extension to specify a particular
-   * approximate matching rule.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testXAPPROXExtension() throws Exception
-  {
-    Schema schema = DirectoryServer.getInstance().getServerContext().getSchema();
-    Syntax attrTypeSyntax = schema.getSyntax("1.3.6.1.4.1.1466.115.121.1.3");
-    assertNotNull(attrTypeSyntax);
-
-    // Create an attribute type definition and verify that it is acceptable.
-    ByteString definition = ByteString.valueOfUtf8(
-      "( testxapproxtype-oid NAME 'testXApproxType' " +
-           "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " +
-           "X-APPROX 'ds-mr-double-metaphone-approx' )");
-    LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder();
-    assertTrue(attrTypeSyntax.valueIsAcceptable(definition, invalidReason), invalidReason.toString());
-
-    // Verify that we can decode the attribute type and that it has the
-    // correct approximate matching rule.
-    Schema newSchema = new SchemaBuilder(schema)
-      .addAttributeType(definition.toString(), false)
-      .toSchema();
-
-    AttributeType attrType = newSchema.getAttributeType("testXApproxType");
-    assertNotNull(attrType.getApproximateMatchingRule());
-    assertEquals(attrType.getApproximateMatchingRule(), schema.getMatchingRule("ds-mr-double-metaphone-approx"));
-  }
-
-  /**
-   * Tests a situation when two radically different equality and substring
-   * matching rules (such as Case Ignore and Case Exact) are used to define an
-   * attribute description. For more information, look at the issue# 4468 in
-   * Issue Tracker.
-   *
-   * @throws Exception In case of an error.
-   */
-  @Test
-  public void testMixedEqualityAndSubstringMatchingRules() throws Exception
-  {
-    //Add an attribute with directory string syntax.
-    int  resultCode = TestCaseUtils.applyModifications(true,
-      "dn: cn=schema",
-      "changetype: modify",
-      "add: attributetypes",
-      "attributeTypes: ( gvRights-oid NAME 'gvRights' DESC 'x attr' EQUALITY " +
-      "caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR " +
-      "caseExactSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 " +
-      "USAGE userApplications )",
-      "-",
-      "add: objectclasses",
-      "objectClasses: ( gvRightsTest-oid NAME 'gvRightsTest' DESC 'Test' SUP top AUXILIARY " +
-      "MUST ( objectClass $ gvRights ) )");
-    assertEquals(resultCode, 0);
-    TestCaseUtils.initializeTestBackend(true);
-    //add the test entry.
-    TestCaseUtils.addEntry(
-      "dn: cn=gvrightstest,o=test",
-      "objectclass: person",
-      "objectclass: gvRightsTest",
-      "cn: gvrightstest",
-      "sn: test",
-      "gvRights: gvApplId=test2,ou=Applications,dc=bla$test2-T");
-
-    //Search for the entry using substring matching rule filter.
-    String filter = "(&(gvrights=*ApplId=test2,ou=*)" + "(gvrights=*test2,ou=A*))";
-    SearchRequest request = newSearchRequest("cn=gvrightstest,o=test", SearchScope.WHOLE_SUBTREE, filter);
-    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
-    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
-    assertEquals(searchOperation.getEntriesSent(), 1);
-  }
-}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/ConfigurableAttributeSyntaxTest.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/ConfigurableAttributeSyntaxTest.java
deleted file mode 100644
index 71f2acb..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/ConfigurableAttributeSyntaxTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2016 ForgeRock AS.
- */
-package org.opends.server.schema;
-
-import static org.opends.server.schema.SchemaConstants.*;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.types.Entry;
-import org.opends.server.util.RemoveOnceSDKSchemaIsUsed;
-import org.testng.annotations.DataProvider;
-
-@RemoveOnceSDKSchemaIsUsed
-public class ConfigurableAttributeSyntaxTest extends SchemaTestCase
-{
-  /**
-   * Build the data for the test of the hasAcceptableValue Methods
-   * of the class extending the AttributeSyntax class and having
-   * some configuration capabilities.
-   */
-  @DataProvider(name="acceptableValues")
-  public Object[][] createSyntaxTest() throws Exception
-  {
-    // some config object used later in the test
-    Entry strictConfig = TestCaseUtils.makeEntry(
-        "dn: cn=Telephone Number,cn=Syntaxes,cn=config",
-        "objectClass: top",
-        "objectClass: ds-cfg-telephone-number-attribute-syntax",
-        "objectClass: ds-cfg-attribute-syntax",
-        "ds-cfg-strict-format: true",
-        "ds-cfg-enabled: true",
-        "ds-cfg-java-class: org.opends.server.schema.TelephoneNumberSyntax",
-        "cn: Telephone Number"
-         );
-
-    Entry relaxedConfig = TestCaseUtils.makeEntry(
-        "dn: cn=Telephone Number,cn=Syntaxes,cn=config",
-        "objectClass: top",
-        "objectClass: ds-cfg-telephone-number-attribute-syntax",
-        "objectClass: ds-cfg-attribute-syntax",
-        "ds-cfg-strict-format: false",
-        "ds-cfg-enabled: true",
-        "ds-cfg-java-class: org.opends.server.schema.TelephoneNumberSyntax",
-        "cn: Telephone Number"
-         );
-
-    // fill this table with tables containing :
-    // - the configEntry that must be applied before the test.
-    // - the name of the Syntax to test.
-    // - a value that must be tested for correctness.
-    // - a boolean indicating if the value is correct.
-    return new Object[][] {
-         {strictConfig, SYNTAX_TELEPHONE_OID, "+61 3 9896 7830", true},
-         {strictConfig, SYNTAX_TELEPHONE_OID, "+1 512 315 0280", true},
-         {strictConfig, SYNTAX_TELEPHONE_OID, "+1-512-315-0280", true},
-         {strictConfig, SYNTAX_TELEPHONE_OID, "3 9896 7830", false},
-         {strictConfig, SYNTAX_TELEPHONE_OID, "+1+512 315 0280", false},
-         {strictConfig, SYNTAX_TELEPHONE_OID, "+1x512x315x0280", false},
-         {strictConfig, SYNTAX_TELEPHONE_OID, "   ", false},
-         {strictConfig, SYNTAX_TELEPHONE_OID, "", false},
-
-
-         {relaxedConfig, SYNTAX_TELEPHONE_OID, "+1+512 315 0280", true},
-         {relaxedConfig, SYNTAX_TELEPHONE_OID, "+1x512x315x0280", true},
-         {relaxedConfig, SYNTAX_TELEPHONE_OID, "   ", false},
-         {relaxedConfig, SYNTAX_TELEPHONE_OID, "", false},
-    };
-  }
-
-}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/GeneralizedTimeSyntaxTest.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/GeneralizedTimeSyntaxTest.java
index 19029c2..11b95f0 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/GeneralizedTimeSyntaxTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/schema/GeneralizedTimeSyntaxTest.java
@@ -24,7 +24,6 @@
 import java.util.TimeZone;
 
 import org.opends.server.DirectoryServerTestCase;
-import org.opends.server.util.RemoveOnceSDKSchemaIsUsed;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -32,7 +31,6 @@
 /**
  * Test the GeneralizedTimeSyntax.
  */
-@RemoveOnceSDKSchemaIsUsed
 public class GeneralizedTimeSyntaxTest extends DirectoryServerTestCase
 {
   /**
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
index f92c1af..12fe4f1 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
@@ -331,7 +331,7 @@
    *
    * @throws  Exception  If an unexpected problem occurs.
    */
-  @Test(enabled=false)
+  @Test
   public void testAddEmptySchemaFile()
          throws Exception
   {
@@ -361,8 +361,7 @@
     assertEquals(resultCode, 0);
 
     waitTaskCompletedSuccessfully(DN.valueOf(taskDNStr));
-    // TODO : why should the modification time change whereas there is no actual change ?
-    assertFalse(getSchemaHandler().getYoungestModificationTime() == beforeModifyTimestamp);
+    assertTrue(getSchemaHandler().getYoungestModificationTime() == beforeModifyTimestamp);
   }
 
   /**
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
index 8959e13..7294ca7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
@@ -492,7 +492,7 @@
     DN dnToRemove = entry.getName();
     if (!hasPrivilege)
     {
-      dnToRemove = DN.valueOf("cn=Telex Number,cn=Syntaxes,cn=config");
+      dnToRemove = DN.valueOf("cn=File-Based Access Logger,cn=Loggers,cn=config");
     }
     DeleteOperation deleteOperation = conn.processDelete(dnToRemove);
     assertPrivilege(deleteOperation.getResultCode(), hasPrivilege);

--
Gitblit v1.10.0