From 6dee41dc50e9e716c7aac50f0f1bce9047465843 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Mon, 04 Apr 2016 13:38:34 +0000
Subject: [PATCH] Rename config-small.ldif to configForTests/config-small.ldif

---
 opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java                     |   10 +-
 opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java    |   11 +-
 opendj-server-legacy/src/test/java/org/opends/server/core/ConfigurationHandlerTestCase.java |  152 ++++++++++++++++---------------------
 opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java |    2 
 opendj-server-legacy/tests/unit-tests-testng/resource/configForTests/config-small.ldif      |   14 +--
 opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java              |    5 
 opendj-server-legacy/tests/unit-tests-testng/resource/config-changes.ldif                   |   19 ++++
 opendj-server-legacy/src/test/java/org/opends/server/core/SchemaHandlerTestCase.java        |    8 -
 8 files changed, 108 insertions(+), 113 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java b/opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
index 08f30e3..46f5161 100644
--- a/opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
+++ b/opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -304,10 +305,11 @@
      */
     public static List<org.opends.server.types.Attribute> toAttributes(
             final Iterable<org.forgerock.opendj.ldap.Attribute> listOfAttributes) {
-        List<org.opends.server.types.Attribute> toListOfAttributes =
-                new ArrayList<>(((Collection<?>) listOfAttributes).size());
-        for (org.forgerock.opendj.ldap.Attribute a : listOfAttributes) {
-            toListOfAttributes.add(toAttribute(a));
+        List<org.opends.server.types.Attribute> toListOfAttributes = new ArrayList<>();
+        Iterator<Attribute> it = listOfAttributes.iterator();
+        while (it.hasNext())
+        {
+          toListOfAttributes.add(toAttribute(it.next()));
         }
         return toListOfAttributes;
     }
@@ -508,6 +510,7 @@
         final org.opends.server.types.Entry srvResultEntry) {
 
         final org.forgerock.opendj.ldap.Entry entry = new LinkedHashMapEntry(srvResultEntry.getName().toString());
+        entry.addAttribute(from(srvResultEntry.getObjectClassAttribute()));
         for (org.opends.server.types.Attribute a : srvResultEntry.getAttributes()) {
             entry.addAttribute(from(a));
         }
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 f0d67f0..ee941fc 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
@@ -34,16 +34,17 @@
   private final ServerContext serverContext;
   private final DirectoryEnvironmentConfig env;
 
-  public static ServerContextBuilder aServerContext()
+  public static ServerContextBuilder aServerContext() throws InitializationException
   {
     return new ServerContextBuilder();
   }
 
-  public ServerContextBuilder()
+  public ServerContextBuilder() throws InitializationException
   {
     serverContext = mock(ServerContext.class);
 
     env = new DirectoryEnvironmentConfig(false);
+    env.setMaintainConfigArchive(false);
     when(serverContext.getEnvironment()).thenReturn(env);
   }
 
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 88b2189..b4787f5 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
@@ -420,10 +420,12 @@
       config.setConfigClass(ConfigurationHandler.class);
       config.setConfigFile(new File(testConfigDir, "config.ldif"));
 
-      // Initialize the configuration framework for DSConfig.
-      ConfigurationFramework.getInstance()
-          .initialize(testInstallRoot.getAbsolutePath(),
-              testInstanceRoot.getAbsolutePath());
+      ConfigurationFramework configurationFramework = ConfigurationFramework.getInstance();
+      if (!configurationFramework.isInitialized())
+      {
+        configurationFramework.initialize(testInstallRoot.getAbsolutePath(), testInstanceRoot.getAbsolutePath());
+      }
+      configurationFramework.setIsClient(false);
 
       AccessLogger.getInstance().addLogPublisher(
           (AccessLogPublisher) getStartupTextAccessPublisher(ACCESS_TEXT_WRITER, false));
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/ConfigurationHandlerTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/ConfigurationHandlerTestCase.java
index 49cc7ff..6985026 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/ConfigurationHandlerTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/ConfigurationHandlerTestCase.java
@@ -15,9 +15,10 @@
  */
 package org.opends.server.core;
 
-import static org.mockito.Matchers.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.*;
-import static org.opends.server.ServerContextBuilder.*;
+import static org.opends.server.ServerContextBuilder.aServerContext;
 import static org.testng.Assert.*;
 
 import java.io.File;
@@ -36,7 +37,8 @@
 import org.opends.server.TestCaseUtils;
 import org.opends.server.config.ConfigConstants;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
@@ -46,33 +48,53 @@
   private static final DN DN_SCHEMA_PROVIDERS = DN.valueOf("cn=Schema Providers,cn=config");
   private static final DN DN_CORE_SCHEMA = DN.valueOf("cn=Core Schema,cn=Schema Providers,cn=config");
 
+  private ConfigurationHandler configHandler;
+
+  @BeforeMethod
+  public void initializeTest() throws Exception
+  {
+    // Use a copy of configuration for tests to avoid updating the original configuration file.
+    File originalConfigFile = TestCaseUtils.getTestResource("configForTests/config-small.ldif");
+    File copyConfigFile = new File(TestCaseUtils.getUnitTestRootPath(), "config-small-copy.ldif");
+    copyConfigFile.deleteOnExit();
+    if (copyConfigFile.exists())
+    {
+      copyConfigFile.delete();
+    }
+    TestCaseUtils.copyFile(originalConfigFile, copyConfigFile);
+    configHandler = getConfigurationHandler(copyConfigFile);
+  }
+
+  @AfterClass
+  public void cleanup()
+  {
+    File copyConfigFile = new File(TestCaseUtils.getUnitTestRootPath(), "config-small-copy.ldif");
+    if (copyConfigFile.exists())
+    {
+      copyConfigFile.delete();
+    }
+  }
+
   /** Returns the configuration handler fully initialized from configuration file. */
-  private ConfigurationHandler getConfigurationHandler()
-      throws InitializationException
+  private ConfigurationHandler getConfigurationHandler(File configFile) throws Exception
   {
     final ServerContext context = aServerContext().
         schemaDirectory(new File(TestCaseUtils.getBuildRoot(), "resource/schema")).
-        configFile(TestCaseUtils.getTestResource("config-small.ldif")).
+        configFile(configFile).
         build();
 
-    final ConfigurationHandler configHandler = new ConfigurationHandler(context);
-    configHandler.initializeWithPartialSchema();
-    return configHandler;
+    return ConfigurationHandler.bootstrapConfiguration(context, ConfigurationHandler.class);
   }
 
   @Test
-    public void testInitializeWithPartialSchemaConfiguration() throws Exception
+    public void testConfigurationBootstrap() throws Exception
     {
-      ConfigurationHandler configHandler = getConfigurationHandler();
-
       assertTrue(configHandler.hasEntry(DN_CONFIG));
     }
 
   @Test
   public void testGetEntry() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     Entry entry = configHandler.getEntry(DN_SCHEMA_PROVIDERS);
     assertTrue(entry.containsAttribute("objectclass", "top", "ds-cfg-branch"));
   }
@@ -80,8 +102,6 @@
   @Test
   public void testGetChildren() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     Set<DN> dns = configHandler.getChildren(DN_SCHEMA_PROVIDERS);
     assertTrue(dns.contains(DN_CORE_SCHEMA));
   }
@@ -89,8 +109,6 @@
   @Test
   public void testNumSubordinates() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     long numSubordinates = configHandler.numSubordinates(DN_SCHEMA_PROVIDERS, false);
     assertEquals(numSubordinates, 1);
 
@@ -101,7 +119,6 @@
   @Test
   public void testRegisterChangeListener() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     ConfigChangeListener listener1 = mock(ConfigChangeListener.class);
     ConfigChangeListener listener2 = mock(ConfigChangeListener.class);
 
@@ -114,7 +131,6 @@
   @Test
   public void testRegisterDeregisterChangeListener() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     ConfigChangeListener listener1 = mock(ConfigChangeListener.class);
     ConfigChangeListener listener2 = mock(ConfigChangeListener.class);
 
@@ -128,7 +144,6 @@
   @Test
   public void testRegisterAddListener() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     ConfigAddListener listener1 = mock(ConfigAddListener.class);
     ConfigAddListener listener2 = mock(ConfigAddListener.class);
 
@@ -141,7 +156,6 @@
   @Test
   public void testRegisterDeleteListener() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     ConfigDeleteListener listener1 = mock(ConfigDeleteListener.class);
     ConfigDeleteListener listener2 = mock(ConfigDeleteListener.class);
 
@@ -154,8 +168,7 @@
   @Test
   public void testAddEntry() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-    String dn = "cn=New schema provider,cn=Schema Providers,cn=config";
+    String dn = "cn=Another schema provider,cn=Schema Providers,cn=config";
 
     configHandler.addEntry(new LinkedHashMapEntry(dn));
 
@@ -165,7 +178,6 @@
   @Test(expectedExceptions=DirectoryException.class)
   public void testAddEntryExistingEntry() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     configHandler.addEntry(new LinkedHashMapEntry(DN_CORE_SCHEMA));
   }
 
@@ -173,30 +185,24 @@
   @Test(enabled=false, expectedExceptions=DirectoryException.class)
   public void testAddEntryParentUnknown() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     configHandler.addEntry(new LinkedHashMapEntry("cn=Core Schema,cn=Schema Providers,cn=Providers,cn=config"));
   }
 
   @Test(expectedExceptions=DirectoryException.class)
   public void testAddEntryNoParent() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     configHandler.addEntry(new LinkedHashMapEntry(DN.rootDN()));
   }
 
   @Test
   public void testAddListenerWithAddEntry() throws Exception
   {
-    String dn = "cn=New schema provider,cn=Schema Providers,cn=config";
-    ConfigurationHandler configHandler = getConfigurationHandler();
+    String dn = "cn=Yet another schema provider,cn=Schema Providers,cn=config";
 
     ConfigAddListener listener = mock(ConfigAddListener.class);
     configHandler.registerAddListener(DN_SCHEMA_PROVIDERS, listener);
-    when(listener.configAddIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-      thenReturn(true);
-    when(listener.applyConfigurationAdd(any(Entry.class))).
-      thenReturn(new ConfigChangeResult());
+    when(listener.configAddIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(true);
+    when(listener.applyConfigurationAdd(any(Entry.class))).thenReturn(new ConfigChangeResult());
 
     configHandler.addEntry(new LinkedHashMapEntry(dn));
 
@@ -207,11 +213,9 @@
   @Test(expectedExceptions=DirectoryException.class)
   public void testAddListenerWithAddEntryWhenConfigNotAcceptable() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     ConfigAddListener listener = mock(ConfigAddListener.class);
     configHandler.registerAddListener(DN_SCHEMA_PROVIDERS, listener);
-    when(listener.configAddIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-    thenReturn(false);
+    when(listener.configAddIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(false);
 
     configHandler.addEntry(new LinkedHashMapEntry("cn=New schema provider,cn=Schema Providers,cn=config"));
   }
@@ -221,13 +225,10 @@
   {
     final ConfigChangeResult ccr = new ConfigChangeResult();
     ccr.setResultCode(ResultCode.OTHER);
-    ConfigurationHandler configHandler = getConfigurationHandler();
     ConfigAddListener listener = mock(ConfigAddListener.class);
     configHandler.registerAddListener(DN_SCHEMA_PROVIDERS, listener);
-    when(listener.configAddIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-      thenReturn(true);
-    when(listener.applyConfigurationAdd(any(Entry.class))).
-      thenReturn(ccr);
+    when(listener.configAddIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(true);
+    when(listener.applyConfigurationAdd(any(Entry.class))).thenReturn(ccr);
 
     configHandler.addEntry(new LinkedHashMapEntry("cn=New schema provider,cn=Schema Providers,cn=config"));
   }
@@ -235,48 +236,37 @@
   @Test
   public void testDeleteEntry() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     configHandler.deleteEntry(DN_CORE_SCHEMA);
 
     assertFalse(configHandler.hasEntry(DN_CORE_SCHEMA));
   }
 
-  /** TODO : disabled because fail when converting to server DN. Re-enable once migrated to SDK DN. */
-  @Test(enabled=false, expectedExceptions=DirectoryException.class)
+  @Test(expectedExceptions=DirectoryException.class)
   public void testDeleteEntryUnexistingEntry() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     configHandler.deleteEntry(DN.valueOf("cn=Unexisting provider,cn=Schema Providers,cn=config"));
   }
 
-  @Test(enabled=false, expectedExceptions=DirectoryException.class)
+  @Test(expectedExceptions=DirectoryException.class)
   public void testDeleteEntryWithChildren() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     configHandler.deleteEntry(DN_SCHEMA_PROVIDERS);
   }
 
-  /** TODO : disabled because fail when converting to server DN. Re-enable once migrated to SDK DN. */
-  @Test(enabled=false, expectedExceptions=DirectoryException.class)
+  @Test(expectedExceptions=DirectoryException.class)
   public void testDeleteEntryUnknownParent() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     configHandler.deleteEntry(DN.valueOf("cn=Core Schema,cn=Schema Providers,cn=Providers,cn=config"));
   }
 
   @Test
   public void testDeleteListenerWithDeleteEntry() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     ConfigDeleteListener listener = mock(ConfigDeleteListener.class);
     configHandler.registerDeleteListener(DN_SCHEMA_PROVIDERS, listener);
     Entry entryToDelete = configHandler.getEntry(DN_CORE_SCHEMA);
-    when(listener.configDeleteIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-      thenReturn(true);
-    when(listener.applyConfigurationDelete(any(Entry.class))).
-      thenReturn(new ConfigChangeResult());
+    when(listener.configDeleteIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(true);
+    when(listener.applyConfigurationDelete(any(Entry.class))).thenReturn(new ConfigChangeResult());
 
     configHandler.deleteEntry(DN_CORE_SCHEMA);
 
@@ -287,12 +277,9 @@
   @Test(expectedExceptions=DirectoryException.class)
   public void testDeleteListenerWithDeleteEntryWhenConfigNotAcceptable() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     ConfigDeleteListener listener = mock(ConfigDeleteListener.class);
     configHandler.registerDeleteListener(DN_SCHEMA_PROVIDERS, listener);
-    when(listener.configDeleteIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-      thenReturn(false);
+    when(listener.configDeleteIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(false);
 
     configHandler.deleteEntry(DN_CORE_SCHEMA);
   }
@@ -300,17 +287,13 @@
   @Test(expectedExceptions=DirectoryException.class)
   public void testDeleteListenerWithDeleteEntryWhenFailureApplyingConfig() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     final ConfigChangeResult ccr = new ConfigChangeResult();
     ccr.setResultCode(ResultCode.OTHER);
 
     ConfigDeleteListener listener = mock(ConfigDeleteListener.class);
     configHandler.registerDeleteListener(DN_SCHEMA_PROVIDERS, listener);
-    when(listener.configDeleteIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-      thenReturn(true);
-    when(listener.applyConfigurationDelete(any(Entry.class))).
-      thenReturn(ccr);
+    when(listener.configDeleteIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(true);
+    when(listener.applyConfigurationDelete(any(Entry.class))).thenReturn(ccr);
 
     configHandler.deleteEntry(DN_CORE_SCHEMA);
   }
@@ -318,7 +301,6 @@
   @Test
   public void testReplaceEntry() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
     String dn = DN_CORE_SCHEMA.toString();
 
     configHandler.replaceEntry(
@@ -330,22 +312,25 @@
   }
 
   @Test
-  public void testChangeListenerIsDeletedWhenConfigEntryIsDeleted()
+  public void testChangeListenerIsDeletedWhenConfigEntryIsDeleted() throws Exception
   {
-    // TODO
+    ConfigChangeListener listener = mock(ConfigChangeListener.class);
+    configHandler.registerChangeListener(DN_CORE_SCHEMA, listener);
+    when(listener.configChangeIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(true);
+    when(listener.applyConfigurationChange(any(Entry.class))).thenReturn(new ConfigChangeResult());
+
+    configHandler.deleteEntry(DN_CORE_SCHEMA);
+
+    assertThat(configHandler.getChangeListeners(DN_CORE_SCHEMA)).isEmpty();
   }
 
   @Test
   public void testChangeListenerWithReplaceEntry() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     ConfigChangeListener listener = mock(ConfigChangeListener.class);
     configHandler.registerChangeListener(DN_CORE_SCHEMA, listener);
-    when(listener.configChangeIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-      thenReturn(true);
-    when(listener.applyConfigurationChange(any(Entry.class))).
-      thenReturn(new ConfigChangeResult());
+    when(listener.configChangeIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(true);
+    when(listener.applyConfigurationChange(any(Entry.class))).thenReturn(new ConfigChangeResult());
     Entry oldEntry = configHandler.getEntry(DN_CORE_SCHEMA);
 
     configHandler.replaceEntry(oldEntry,
@@ -360,12 +345,9 @@
   @Test(expectedExceptions=DirectoryException.class)
   public void testChangeListenerWithReplaceEntryWhenConfigNotAcceptable() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     ConfigChangeListener listener = mock(ConfigChangeListener.class);
     configHandler.registerChangeListener(DN_CORE_SCHEMA, listener);
-    when(listener.configChangeIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-      thenReturn(false);
+    when(listener.configChangeIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(false);
     Entry oldEntry = configHandler.getEntry(DN_CORE_SCHEMA);
 
     configHandler.replaceEntry(oldEntry,
@@ -377,17 +359,13 @@
   @Test(expectedExceptions=DirectoryException.class)
   public void testChangeListenerWithReplaceEntryWhenFailureApplyingConfig() throws Exception
   {
-    ConfigurationHandler configHandler = getConfigurationHandler();
-
     final ConfigChangeResult ccr = new ConfigChangeResult();
     ccr.setResultCode(ResultCode.OTHER);
 
     ConfigChangeListener listener = mock(ConfigChangeListener.class);
     configHandler.registerChangeListener(DN_CORE_SCHEMA, listener);
-    when(listener.configChangeIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).
-      thenReturn(true);
-    when(listener.applyConfigurationChange(any(Entry.class))).
-      thenReturn(ccr);
+    when(listener.configChangeIsAcceptable(any(Entry.class), any(LocalizableMessageBuilder.class))).thenReturn(true);
+    when(listener.applyConfigurationChange(any(Entry.class))).thenReturn(ccr);
     Entry oldEntry = configHandler.getEntry(DN_CORE_SCHEMA);
 
     configHandler.replaceEntry(oldEntry,
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/SchemaHandlerTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/SchemaHandlerTestCase.java
index 98c9f37..ae91483 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/SchemaHandlerTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/SchemaHandlerTestCase.java
@@ -22,14 +22,12 @@
 
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.opends.server.TestCaseUtils;
+import org.opends.server.schema.SchemaConstants;
 import org.testng.annotations.Test;
 
 @SuppressWarnings("javadoc")
 public class SchemaHandlerTestCase extends CoreTestCase
 {
-
-  private static final String DIRECTORY_STRING_SYNTAX_OID = "1.3.6.1.4.1.1466.115.121.1.15";
-
   @Test
   public void testSchemaInitialization() throws Exception
   {
@@ -37,7 +35,7 @@
     initializeSchemaHandler(schema);
 
     assertThat(schema.getMatchingRules()).isNotEmpty(); // some matching rules defined
-    schema.getSyntax(DIRECTORY_STRING_SYNTAX_OID);
+    schema.getSyntax(SchemaConstants.SYNTAX_DIRECTORY_STRING_OID);
     schema.getAttributeType("javaClassName"); // from file 03-rfc2713
     schema.getAttributeType("nisNetIdUser"); // from file 5-solaris.ldif
     schema.getObjectClass("changeLogEntry"); // from file 03-changelog.ldif
@@ -47,7 +45,7 @@
   {
     final ServerContext serverContext = aServerContext()
         .schemaDirectory(new File(TestCaseUtils.getBuildRoot(), "resource/schema"))
-        .configFile(TestCaseUtils.getTestResource("config-small.ldif"))
+        .configFile(TestCaseUtils.getTestResource("configForTests/config-small.ldif"))
         .withConfigurationBootstrapped()
         .schema(schema)
         .build();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java
index 811dde5..f72f947 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/schema/CoreSchemaProviderTestCase.java
@@ -55,7 +55,7 @@
   {
     return aServerContext()
         .schemaDirectory(new File(TestCaseUtils.getBuildRoot(), "resource/schema"))
-        .configFile(TestCaseUtils.getTestResource("config-small.ldif"))
+        .configFile(TestCaseUtils.getTestResource("configForTests/config-small.ldif"))
         .withConfigurationBootstrapped()
         .schema(schema)
         .build();
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/config-changes.ldif b/opendj-server-legacy/tests/unit-tests-testng/resource/config-changes.ldif
index 73c5ffc..5be305f 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/config-changes.ldif
+++ b/opendj-server-legacy/tests/unit-tests-testng/resource/config-changes.ldif
@@ -1,3 +1,16 @@
+# 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 2016 ForgeRock AS.
 dn: cn=config
 changetype: modify
 replace: ds-cfg-notify-abandoned-operations
@@ -422,6 +435,7 @@
 changetype: add
 objectClass: top
 objectClass: ds-cfg-backend
+objectClass: ds-cfg-pluggable-backend
 objectClass: ds-cfg-je-backend
 ds-cfg-enabled: false
 ds-cfg-java-class: org.opends.server.backends.jeb.JEBackend
@@ -440,6 +454,7 @@
 changetype: add
 objectClass: top
 objectClass: ds-cfg-backend
+objectClass: ds-cfg-pluggable-backend
 objectClass: ds-cfg-je-backend
 ds-cfg-enabled: true
 ds-cfg-java-class: org.opends.server.backends.jeb.JEBackend
@@ -797,6 +812,7 @@
 changetype: add
 objectClass: top
 objectClass: ds-cfg-backend
+objectClass: ds-cfg-pluggable-backend
 objectClass: ds-cfg-je-backend
 ds-cfg-enabled: false
 ds-cfg-java-class: org.opends.server.backends.jeb.JEBackend
@@ -967,6 +983,7 @@
 changetype: add
 objectClass: top
 objectClass: ds-cfg-backend
+objectClass: ds-cfg-pluggable-backend
 objectClass: ds-cfg-je-backend
 ds-cfg-enabled: false
 ds-cfg-java-class: org.opends.server.backends.jeb.JEBackend
@@ -1134,6 +1151,7 @@
 changetype: add
 objectClass: top
 objectClass: ds-cfg-backend
+objectClass: ds-cfg-pluggable-backend
 objectClass: ds-cfg-je-backend
 ds-cfg-enabled: false
 ds-cfg-java-class: org.opends.server.backends.jeb.JEBackend
@@ -1332,6 +1350,7 @@
 changetype: add
 objectClass: top
 objectClass: ds-cfg-backend
+objectClass: ds-cfg-pluggable-backend
 objectClass: ds-cfg-je-backend
 ds-cfg-enabled: false
 ds-cfg-java-class: org.opends.server.backends.jeb.JEBackend
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/config-small.ldif b/opendj-server-legacy/tests/unit-tests-testng/resource/configForTests/config-small.ldif
similarity index 86%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/config-small.ldif
rename to opendj-server-legacy/tests/unit-tests-testng/resource/configForTests/config-small.ldif
index 8bdaa4e..946e943 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/config-small.ldif
+++ b/opendj-server-legacy/tests/unit-tests-testng/resource/configForTests/config-small.ldif
@@ -11,14 +11,11 @@
 # information: "Portions Copyright [year] [name of copyright owner]".
 #
 # Copyright 2006-2010 Sun Microsystems, Inc.
-# Portions Copyright 2010-2015 ForgeRock AS.
+# Portions Copyright 2010-2016 ForgeRock AS.
 # Portions Copyright 2012-2014 Manuel Gaupp
 
-#
-# This file contains the primary Directory Server configuration.  It must not
-# be directly edited while the server is online.  The server configuration
-# should only be managed using the administration utilities provided with the
-# Directory Server.
+# This file contains a minimal configuration to be used in unit tests, mainly to test classes responsible for,
+#  or closely related to, configuration management.
 
 dn: cn=config
 objectClass: top
@@ -69,9 +66,6 @@
 objectClass: top
 objectClass: ds-cfg-schema-provider
 objectClass: ds-cfg-core-schema
+cn: Core Schema
 ds-cfg-java-class: org.opends.server.schema.CoreSchemaProvider
 ds-cfg-enabled: true
-ds-cfg-disabled-matching-rule: NONE
-ds-cfg-disabled-syntax: NONE
-ds-cfg-strip-syntax-min-upper-bound-attribute-type-description: false
-ds-cfg-strict-format-country-string: false

--
Gitblit v1.10.0