You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/01/06 19:27:19 UTC

svn commit: r896599 [10/30] - in /directory/apacheds/trunk: ./ avl-partition/ avl-partition/src/ avl-partition/src/main/ avl-partition/src/main/java/ avl-partition/src/main/java/org/ avl-partition/src/main/java/org/apache/ avl-partition/src/main/java/o...

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java Wed Jan  6 18:26:43 2010
@@ -20,58 +20,90 @@
 package org.apache.directory.server.core.schema;
 
 
-import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.IntegrationUtils;
-
 import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
-import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 
 /**
- * A test case which tests the correct operation of the schema 
- * entity handler.  
+ * A test case which tests the correct operation of the schema entity handler.
+ * <br>
+ * We have many things to check. Here is a list of what we want to control :
+ * <ul>
+ *   <li>Enabling Schema</li>
+ *   <ul>
+ *     <li>an existing schema</li>
+ *     <li>a non existing schema</li>
+ *     <li>an already enabled Schema</li>
+ *     <li>an existing schema which will break the Registries when enabled</li>
+ *   </ul>
+ *   <li>Disabling Schema</li>
+ *   <ul>
+ *     <li>an already disabled Schema</li>
+ *     <li>an existing schema</li>
+ *     <li>an existing schema which will break the Registries when disabled</li>
+ *     <li>a non existing schema</li>
+ *   </ul>
+ * </ul>
+ * <ul>
+ *   <li>Adding a new schema</li>
+ *   <ul>
+ *     <li>enabled schema</li>
+ *     <ul>
+ *       <li>Adding a new enabled valid schema with no deps</li>
+ *       <li>Adding a new enabled schema with existing deps</li>
+ *       <li>Adding a new enabled schema with non existing deps</li>
+ *       <li>Adding a new enabled schema with an already existing name</li>
+ *       <li>Adding a new enabled schema with deps on disabled schema</li>
+ *     </ul>
+ *     <li>disabled schema</li>
+ *     <ul>
+ *       <li>Adding a new disabled valid schema with no deps</li>
+ *       <li>Adding a new disabled schema with existing deps</li>
+ *       <li>Adding a new disabled schema with non existing deps</li>
+ *       <li>Adding a new disabled schema with an already existing name</li>
+ *       <li>Adding a new disabled schema with deps on disabled schema</li>
+ *     </ul>
+ *   </ul>
+ * </ul>
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-@RunWith ( CiRunner.class )
-public class MetaSchemaHandlerIT
+@RunWith(FrameworkRunner.class)
+public class MetaSchemaHandlerIT extends AbstractMetaSchemaObjectHandler
 {
     /** a test attribute in the test schema: uidNumber in nis schema */
-    private static final String TEST_ATTR_OID = "1.3.6.1.1.1.1.0";
+    private static final String UID_NUMBER_ATTR = "uidnumber";
+    
+    /** Another test attribute : krb5principalName taken from the Krb5Kdc schema */
+    private static final String KRB5_PRINCIPAL_NAME_ATTR = "krb5PrincipalName";
     
-    public static DirectoryService service;
-
-
-    private static AttributeTypeRegistry getAttributeTypeRegistry()
-    {
-        return service.getRegistries().getAttributeTypeRegistry();
-    }
-
 
     @Before
     public void checkSambaSchema() throws Exception
@@ -90,11 +122,416 @@
         IntegrationUtils.disableSchema( service, "nis" );
     }
 
+    
+    private void createDisabledBrokenSchema() throws Exception
+    {
+        LdapContext schemaRoot = getSchemaContext( service );
+
+        // Create the schema
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: broken",
+            MetaSchemaConstants.M_DISABLED_AT, "TRUE" );
+        
+        schemaRoot.createSubcontext( "cn=broken", dummySchema );
+    }
+
+    
+    private void createEnabledValidSchema( String schemaName ) throws Exception
+    {
+        LdapContext schemaRoot = getSchemaContext( service );
+
+        // Create the schema
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn", schemaName );
+        
+        schemaRoot.createSubcontext( "cn=" + schemaName, dummySchema );
+    }
+
+    // -----------------------------------------------------------------------
+    // Enabling Schema tests
+    // -----------------------------------------------------------------------
+    /**
+     * Checks to make sure updates enabling a metaSchema object in
+     * the schema partition triggers the loading of that schema into
+     * the global registries.
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testEnableExistingSchema() throws Exception
+    {
+        // Chck that the nis schema is loaded
+        assertTrue( IntegrationUtils.isLoaded( service, "nis" ) );
+
+        // check that the nis schema is not enabled
+        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
+        
+        // double check and make sure an attribute from that schema is 
+        // not in the AttributeTypeRegistry
+        assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( UID_NUMBER_ATTR ) );
+        
+        // now enable the test schema
+        IntegrationUtils.enableSchema( service, "nis" );
+        
+        // now test that the schema is loaded 
+        assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
+        
+        // double check and make sure the test attribute from the 
+        // test schema is now loaded and present within the attr registry
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( UID_NUMBER_ATTR ) );
+    }
+
+
+    /**
+     * Checks that trying to enable a non existing schema does not work
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testEnableNotExistingSchema() throws Exception
+    {
+        // check that the 'wrong' schema is not loaded
+        assertFalse( IntegrationUtils.isLoaded( service, "wrong" ) );
+        
+        // now enable the 'wrong' schema
+        try
+        {
+            IntegrationUtils.enableSchema( service, "wrong" );
+            fail();
+        }
+        catch ( LdapNameNotFoundException lnnfe )
+        {
+            // Expected
+            assertTrue( true );
+        }
+        
+        // Test again that the schema is not loaded 
+        assertFalse( IntegrationUtils.isLoaded( service, "wrong" ) );
+    }
+
+    
+    /**
+     * Checks to make sure that if we try to enable an already enabled
+     * schema, we don't do anything.
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testEnableSchemaAlreadyEnabled() throws Exception
+    {
+        // check that the nis schema is loaded
+        assertTrue( IntegrationUtils.isLoaded(  service, "nis" ) );
+        
+        // Ceck that it's not enabled
+        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
+        
+        // double check and make sure an attribute from that schema is 
+        // not in the AttributeTypeRegistry
+        assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( UID_NUMBER_ATTR ) );
+        
+        // now enable the test schema
+        IntegrationUtils.enableSchema( service, "nis" );
+        
+        // and enable it again (it should not do anything)
+        IntegrationUtils.enableSchema( service, "nis" );
+        
+        // now test that the schema is loaded 
+        assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
+        
+        // double check and make sure the test attribute from the 
+        // test schema is now loaded and present within the attr registry
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( UID_NUMBER_ATTR ) );
+    }
+
+    
+    /**
+     * Checks that if we enable a schema which will break the registries, we get 
+     * an error. 
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testEnableSchemaBreakingRegistries() throws Exception
+    {
+        // TODO : create a special Schema colliding with an existing one
+    }
+
+    
+    // -----------------------------------------------------------------------
+    // Disabling Schema tests
+    // -----------------------------------------------------------------------
+    /**
+     * Checks to make sure updates disabling a metaSchema object in
+     * the schema partition triggers the loading of that schema into
+     * the global registries.
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testDisableExistingSchema() throws Exception
+    {
+        // Check that the krb5kdc schema is loaded
+        assertTrue( IntegrationUtils.isLoaded( service, "krb5kdc" ) );
+
+        // check that the krb5kdc schema is enabled
+        assertTrue( IntegrationUtils.isEnabled( service, "krb5kdc" ) );
+        
+        // double check and make sure an attribute from that schema is 
+        // in the AttributeTypeRegistry
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( KRB5_PRINCIPAL_NAME_ATTR ) );
+        
+        // now disable the krb5kdc schema
+        IntegrationUtils.disableSchema( service, "krb5kdc" );
+        
+        // now test that the schema is not enabled 
+        assertTrue( IntegrationUtils.isDisabled( service, "krb5kdc" ) );
+        
+        // double check and make sure the test attribute from the 
+        // test schema is now loaded and present within the attr registry
+        assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( KRB5_PRINCIPAL_NAME_ATTR ) );
+    }
+
+
+    /**
+     * Checks that trying to disable a non existing schema does not work
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testDisableNotExistingSchema() throws Exception
+    {
+        // check that the 'wrong' schema is not loaded
+        assertFalse( IntegrationUtils.isLoaded( service, "wrong" ) );
+        
+        // now disable the 'wrong' schema
+        try
+        {
+            IntegrationUtils.disableSchema( service, "wrong" );
+            fail();
+        }
+        catch ( LdapNameNotFoundException lnnfe )
+        {
+            // Expected
+            assertTrue( true );
+        }
+        
+        // Test again that the schema is not loaded 
+        assertFalse( IntegrationUtils.isLoaded( service, "wrong" ) );
+    }
+
+    
+    /**
+     * Checks to make sure that if we try to disable an already disabled
+     * schema, we don't do anything.
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testDisableSchemaAlreadyDisabled() throws Exception
+    {
+        // check that the nis schema is loaded
+        assertTrue( IntegrationUtils.isLoaded(  service, "nis" ) );
+        
+        // Check that it's not enabled
+        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
+        
+        // double check and make sure an attribute from that schema is 
+        // not in the AttributeTypeRegistry
+        assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( UID_NUMBER_ATTR ) );
+        
+        // now disable the test schema again
+        IntegrationUtils.disableSchema( service, "nis" );
+
+        // now test that the schema is not loaded 
+        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
+        
+        // double check and make sure the test attribute from the 
+        // test schema is not loaded and present within the attr registry
+        assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( UID_NUMBER_ATTR ) );
+    }
+
+    
+    /**
+     * Checks that if we disable a schema which will break the registries, we get 
+     * an error. 
+     *
+     * @throws Exception on error
+     */
+    @Test
+    public void testDisableSchemaBreakingRegistries() throws Exception
+    {
+        // check that the nis schema is loaded
+        assertTrue( IntegrationUtils.isLoaded(  service, "system" ) );
+        
+        // Check that it's enabled
+        assertTrue( IntegrationUtils.isEnabled( service, "system" ) );
+        
+        // double check and make sure an attribute from that schema is 
+        // in the AttributeTypeRegistry
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "cn" ) );
+        
+        // now disable the system schema : it should break the registries, thus being rejected
+        IntegrationUtils.disableSchema( service, "system" );
+
+        // now test that the schema is not loaded 
+        assertTrue( IntegrationUtils.isEnabled( service, "system" ) );
+        
+        // double check and make sure the test attribute from the 
+        // test schema is loaded and present within the attr registry
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "cn" ) );
+    }
 
     // -----------------------------------------------------------------------
     // Schema Add Tests
     // -----------------------------------------------------------------------
+    /**
+     * Add a valid and enabled schema
+     */
+    @Test
+    public void testAddEnabledValidSchema() throws Exception
+    {
+        LdapDN dn = getSchemaContainer( "dummy" );
+
+        assertFalse( isOnDisk( dn ) );
+
+        LdapContext schemaRoot = getSchemaContext( service );
+        
+        createEnabledValidSchema( "dummy" );
+        
+        assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
+        assertNotNull( schemaRoot.lookup( "cn=dummy" ) );
+        
+        assertTrue( isOnDisk( dn ) );
+    }
+    
+    
+    /**
+     * Add a valid and enabled schema with existing enabled deps
+     */
+    @Test
+    public void testAddEnabledSchemaWithExistingEnabledDeps() throws Exception
+    {
+        LdapDN dn = getSchemaContainer( "dummy" );
+
+        assertFalse( isOnDisk( dn ) );
+
+        LdapContext schemaRoot = getSchemaContext( service );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            "m-dependencies: core",
+            "m-dependencies: system",
+            MetaSchemaConstants.M_DISABLED_AT, "FALSE" );
+        
+        schemaRoot.createSubcontext( "cn=dummy", dummySchema );
+        
+        assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
+        assertNotNull( schemaRoot.lookup( "cn=dummy" ) );
+        
+        assertTrue( isOnDisk( dn ) );
+    }
+    
+    
+    /**
+     * Add a valid and enabled schema with existing disabled deps. It should not be loaded.
+     */
+    @Test
+    public void testAddEnabledSchemaWithExistingDisabledDeps() throws Exception
+    {
+        LdapDN dn = getSchemaContainer( "dummy" );
+
+        assertFalse( isOnDisk( dn ) );
 
+        LdapContext schemaRoot = getSchemaContext( service );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            "m-dependencies: core",
+            "m-dependencies: nis",
+            MetaSchemaConstants.M_DISABLED_AT, "FALSE" );
+        
+        try
+        {
+            schemaRoot.createSubcontext( "cn=dummy", dummySchema );
+            fail();
+        }
+        catch ( LdapOperationNotSupportedException lonse )
+        {
+            assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, lonse.getResultCode() );
+        }
+        
+        assertFalse( IntegrationUtils.isLoaded( service, "dummy" ) );
+        assertFalse( isOnDisk( dn ) );
+    }
+    
+    
+    /**
+     * Add a valid and enabled schema with not existing deps. It should not be loaded.
+     */
+    @Test
+    public void testAddEnabledSchemaWithNotExistingDeps() throws Exception
+    {
+        LdapDN dn = getSchemaContainer( "dummy" );
+
+        assertFalse( isOnDisk( dn ) );
+
+        LdapContext schemaRoot = getSchemaContext( service );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            "m-dependencies: core",
+            "m-dependencies: wrong",
+            MetaSchemaConstants.M_DISABLED_AT, "FALSE" );
+        
+        try
+        {
+            schemaRoot.createSubcontext( "cn=dummy", dummySchema );
+            fail();
+        }
+        catch ( LdapOperationNotSupportedException lonse )
+        {
+            assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, lonse.getResultCode() );
+        }
+        
+        assertFalse( IntegrationUtils.isLoaded( service, "dummy" ) );
+        assertFalse( isOnDisk( dn ) );
+    }
+
+    
+    // -----------------------------------------------------------------------
+    // Schema Delete Tests
+    // -----------------------------------------------------------------------
+    /**
+     * Delete a valid and enabled schema
+     */
+    @Test
+    public void testDeleteEnabledValidSchema() throws Exception
+    {
+        LdapDN dn = getSchemaContainer( "dummy" );
+        LdapContext schemaRoot = getSchemaContext( service );
+        
+        // Create a schema we will delete
+        createEnabledValidSchema( "dummy" );
+        assertTrue( isOnDisk( dn ) );
+        assertTrue( IntegrationUtils.isLoaded( service, "dummy" ) );
+
+        // Delete the schema
+        schemaRoot.destroySubcontext( "cn=dummy" );
+
+        assertFalse( isOnDisk( dn ) );
+        assertFalse( IntegrationUtils.isLoaded( service, "dummy" ) );
+    }
+
+    
+    
+    
     
     /**
      * Tests the addition of a new metaSchema object that is disabled 
@@ -103,16 +540,19 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testAddDisabledSchemaNoDeps() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
-        Attributes dummySchema = new BasicAttributes( "objectClass", "top", true );
-        dummySchema.get( "objectClass" ).add( MetaSchemaConstants.META_SCHEMA_OC );
-        dummySchema.put( "cn", "dummy" );
-        dummySchema.put( MetaSchemaConstants.M_DISABLED_AT, "TRUE" );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            MetaSchemaConstants.M_DISABLED_AT, "TRUE" );
+        
         schemaRoot.createSubcontext( "cn=dummy", dummySchema );
         
-        assertNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertFalse( IntegrationUtils.isEnabled( service, "dummy" ) );
         assertNotNull( schemaRoot.lookup( "cn=dummy" ) );
     }
     
@@ -124,18 +564,21 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testAddDisabledSchemaWithDeps() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
-        Attributes dummySchema = new BasicAttributes( "objectClass", "top", true );
-        dummySchema.get( "objectClass" ).add( MetaSchemaConstants.META_SCHEMA_OC );
-        dummySchema.put( "cn", "dummy" );
-        dummySchema.put( MetaSchemaConstants.M_DISABLED_AT, "TRUE" );
-        dummySchema.put( MetaSchemaConstants.M_DEPENDENCIES_AT, "nis" );
-        dummySchema.get( MetaSchemaConstants.M_DEPENDENCIES_AT ).add( "core" );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            MetaSchemaConstants.M_DISABLED_AT, "TRUE",
+            "m-dependencies: nis",
+            "m-dependencies: core" );
+        
         schemaRoot.createSubcontext( "cn=dummy", dummySchema );
         
-        assertNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertFalse( IntegrationUtils.isEnabled( service, "dummy" ) );
         assertNotNull( schemaRoot.lookup( "cn=dummy" ) );
     }
     
@@ -147,15 +590,17 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testRejectDisabledSchemaAddWithMissingDeps() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
-        Attributes dummySchema = new BasicAttributes( "objectClass", "top", true );
-        dummySchema.get( "objectClass" ).add( MetaSchemaConstants.META_SCHEMA_OC );
-        dummySchema.put( "cn", "dummy" );
-        dummySchema.put( MetaSchemaConstants.M_DISABLED_AT, "TRUE" );
-        dummySchema.put( MetaSchemaConstants.M_DEPENDENCIES_AT, "missing" );
-        dummySchema.get( MetaSchemaConstants.M_DEPENDENCIES_AT ).add( "core" );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            MetaSchemaConstants.M_DISABLED_AT, "TRUE",
+            "m-dependencies: missing",
+            "m-dependencies: core" );
         
         try
         {
@@ -166,7 +611,7 @@
             assertTrue( e.getResultCode().equals( ResultCodeEnum.UNWILLING_TO_PERFORM ) );
         }
         
-        assertNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertFalse( IntegrationUtils.isEnabled( service, "dummy" ) );
 
         //noinspection EmptyCatchBlock
         try
@@ -179,7 +624,6 @@
         }
     }
     
-    
     /**
      * Tests the addition of a new metaSchema object that is enabled 
      * on addition and has no dependencies.
@@ -187,15 +631,19 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testAddEnabledSchemaNoDeps() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
-        Attributes dummySchema = new BasicAttributes( "objectClass", "top", true );
-        dummySchema.get( "objectClass" ).add( MetaSchemaConstants.META_SCHEMA_OC );
-        dummySchema.put( "cn", "dummy" );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaSchema",
+            "cn: dummy"
+            );
+
         schemaRoot.createSubcontext( "cn=dummy", dummySchema );
         
-        assertNotNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
         assertNotNull( schemaRoot.lookup( "cn=dummy" ) );
     }
     
@@ -207,13 +655,15 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testRejectEnabledSchemaAddWithDisabledDeps() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
-        Attributes dummySchema = new BasicAttributes( "objectClass", "top", true );
-        dummySchema.get( "objectClass" ).add( MetaSchemaConstants.META_SCHEMA_OC );
-        dummySchema.put( "cn", "dummy" );
-        dummySchema.put( MetaSchemaConstants.M_DEPENDENCIES_AT, "nis" );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            "m-dependencies: nis" );
         
         try
         {
@@ -225,7 +675,7 @@
             assertTrue( e.getResultCode().equals( ResultCodeEnum.UNWILLING_TO_PERFORM ) );
         }
         
-        assertNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertFalse( IntegrationUtils.isEnabled( service, "dummy" ) );
 
         //noinspection EmptyCatchBlock
         try
@@ -250,17 +700,18 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testDeleteSchemaNoDependents() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
 
         // add the dummy schema enabled 
         testAddEnabledSchemaNoDeps();
-        assertNotNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
         
         // delete it now
         schemaRoot.destroySubcontext( "cn=dummy" );
-        assertNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertFalse( IntegrationUtils.isEnabled( service, "dummy" ) );
     }
     
     
@@ -270,18 +721,19 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testRejectSchemaDeleteWithDependents() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
 
         // add the dummy schema enabled
         testAddEnabledSchemaNoDeps();
-        assertNotNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
         
         // make the nis schema depend on the dummy schema
         ModificationItem[] mods = new ModificationItem[1];
         mods[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE,
-                new BasicAttribute( MetaSchemaConstants.M_DEPENDENCIES_AT, "dummy" ) );
+                new BasicAttribute( "m-dependencies", "dummy" ) );
         schemaRoot.modifyAttributes( "cn=nis", mods );
         
         // attempt to delete it now & it should fail
@@ -295,7 +747,7 @@
             assertTrue( e.getResultCode().equals( ResultCodeEnum.UNWILLING_TO_PERFORM ) );
         }
 
-        assertNotNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
     }
     
     
@@ -306,14 +758,16 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testRejectEnabledSchemaAddWithMisingDeps() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
 
-        Attributes dummySchema = new BasicAttributes( "objectClass", "top", true );
-        dummySchema.get( "objectClass" ).add( MetaSchemaConstants.META_SCHEMA_OC );
-        dummySchema.put( "cn", "dummy" );
-        dummySchema.put( MetaSchemaConstants.M_DEPENDENCIES_AT, "missing" );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            "m-dependencies: missing" );
         
         try
         {
@@ -325,7 +779,7 @@
             assertTrue( e.getResultCode().equals( ResultCodeEnum.UNWILLING_TO_PERFORM ) );
         }
         
-        assertNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertFalse( IntegrationUtils.isEnabled( service, "dummy" ) );
 
         //noinspection EmptyCatchBlock
         try
@@ -340,140 +794,6 @@
 
     
     /**
-     * Checks to make sure updates enabling a metaSchema object in
-     * the schema partition triggers the loading of that schema into
-     * the global registries.
-     *
-     * @throws Exception on error
-     */
-    @Test
-    public void testEnableSchema() throws Exception
-    {
-        AttributeTypeRegistry atr = getAttributeTypeRegistry();
-        
-        // check that the nis schema is not loaded
-        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
-        
-        // double check and make sure an attribute from that schema is 
-        // not in the AttributeTypeRegistry
-        assertFalse( atr.hasAttributeType( TEST_ATTR_OID ) );
-        
-        // now enable the test schema
-        IntegrationUtils.enableSchema( service, "nis" );
-        
-        // now test that the schema is loaded 
-        assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
-        
-        // double check and make sure the test attribute from the 
-        // test schema is now loaded and present within the attr registry
-        assertTrue( atr.hasAttributeType( TEST_ATTR_OID ) );
-    }
-
-
-    /**
-     * Checks to make sure that if we try to enable an already enabled
-     * schema, we don't do anything.
-     *
-     * @throws Exception on error
-     */
-    @Test
-    public void testEnableSchemaAlreadyEnabled() throws Exception
-    {
-        AttributeTypeRegistry atr = getAttributeTypeRegistry();
-        
-        // check that the nis schema is not loaded
-        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
-        
-        // double check and make sure an attribute from that schema is 
-        // not in the AttributeTypeRegistry
-        assertFalse( atr.hasAttributeType( TEST_ATTR_OID ) );
-        
-        // now enable the test schema
-        IntegrationUtils.enableSchema( service, "nis" );
-        
-        // and enable it again (it should not do anything)
-        IntegrationUtils.enableSchema( service, "nis" );
-        
-        // now test that the schema is loaded 
-        assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
-        
-        // double check and make sure the test attribute from the 
-        // test schema is now loaded and present within the attr registry
-        assertTrue( atr.hasAttributeType( TEST_ATTR_OID ) );
-    }
-
-    
-    /**
-     * Checks to make sure that if we try to disable an already disabled
-     * schema, we don't do anything.
-     *
-     * @throws Exception on error
-     */
-    @Test
-    public void testDisableSchemaAlreadyDisabled() throws Exception
-    {
-        AttributeTypeRegistry atr = getAttributeTypeRegistry();
-        
-        // check that the nis schema is not loaded
-        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
-        
-        // double check and make sure an attribute from that schema is 
-        // not in the AttributeTypeRegistry
-        assertFalse( atr.hasAttributeType( TEST_ATTR_OID ) );
-        
-        // now disable the test schema
-        IntegrationUtils.disableSchema( service, "nis" );
-        
-        // now test that the schema is loaded 
-        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
-        
-        // and disable it again (it should not do anything)
-        IntegrationUtils.disableSchema( service, "nis" );
-        
-        // and test again that the schema is still disabled
-        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
-        
-        // double check and make sure the test attribute from the 
-        // test schema is now loaded and present within the attr registry
-        assertFalse( atr.hasAttributeType( TEST_ATTR_OID ) );
-    }
-
-    
-    /**
-     * Checks to make sure an attempt to disable a metaSchema fails if 
-     * that schema has dependents which are enabled.
-     *
-     * @throws Exception on error
-     */
-    @Test
-    public void testDisableSchema() throws Exception
-    {
-        // let's enable the test schema
-        testEnableSchema();
-        
-        AttributeTypeRegistry atr = getAttributeTypeRegistry();
-        
-        // check that the nis schema is enabled
-        assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
-        
-        // double check and make sure an attribute from that schema is 
-        // in the AttributeTypeRegistry
-        assertTrue( atr.hasAttributeType( TEST_ATTR_OID ) );
-        
-        // now disable the test schema 
-        IntegrationUtils.disableSchema( service, "samba" );
-        IntegrationUtils.disableSchema( service, "nis" );
-        
-        // now test that the schema is NOT loaded 
-        assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
-        
-        // double check and make sure the test attribute from the test  
-        // schema is now NOT loaded and present within the attr registry
-        assertFalse( atr.hasAttributeType( TEST_ATTR_OID ) );
-    }
-
-    
-    /**
      * Checks to make sure updates disabling a metaSchema object in
      * the schema partition triggers the unloading of that schema from
      * the global registries.
@@ -481,6 +801,7 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testDisableSchemaWithEnabledDependents() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
@@ -488,25 +809,25 @@
         // let's enable the test schema and add the dummy schema
         // as enabled by default and dependends on the test schema
         
-//      // enables the test schema and samba
-        testEnableSchema(); 
+        // enables the test schema and samba
+        testEnableExistingSchema(); 
         
         // adds enabled dummy schema that depends on the test schema  
-        Attributes dummySchema = new BasicAttributes( "objectClass", "top", true );
-        dummySchema.get( "objectClass" ).add( MetaSchemaConstants.META_SCHEMA_OC );
-        dummySchema.put( "cn", "dummy" );
-        dummySchema.put( MetaSchemaConstants.M_DEPENDENCIES_AT, "nis" );
+        Attributes dummySchema = AttributeUtils.createAttributes( 
+            "objectClass: top", 
+            "objectClass", MetaSchemaConstants.META_SCHEMA_OC,
+            "cn: dummy",
+            "m-dependencies: nis" );
+        
         schemaRoot.createSubcontext( "cn=dummy", dummySchema );
         
         // check that the nis schema is loaded and the dummy schema is loaded
         assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
-        assertNotNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
-        
-        AttributeTypeRegistry atr = getAttributeTypeRegistry();
+        assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
         
         // double check and make sure an attribute from that schema is 
         // in the AttributeTypeRegistry
-        assertTrue( atr.hasAttributeType( TEST_ATTR_OID ) );
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( UID_NUMBER_ATTR ) );
         
         // now try to disable the test schema which should fail 
         // since it's dependent, the dummy schema, is enabled
@@ -526,19 +847,17 @@
         
         // now test that both schema are still loaded 
         assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
-        assertNotNull( IntegrationUtils.getLoadedSchemas( service ).get( "dummy" ) );
+        assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
         
         // double check and make sure the test attribute from the test  
         // schema is still loaded and present within the attr registry
-        assertTrue( atr.hasAttributeType( TEST_ATTR_OID ) );
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( UID_NUMBER_ATTR ) );
     }
     
     
     // -----------------------------------------------------------------------
     // Schema Rename Tests
     // -----------------------------------------------------------------------
-
-
     /**
      * Makes sure we can change the name of a schema with entities in it.
      * Will use the samba schema which comes out of the box and nothing 
@@ -547,6 +866,7 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testSchemaRenameDisabledSchema() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
@@ -581,6 +901,7 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testRejectSchemaRenameWithDeps() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
@@ -616,18 +937,19 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testSchemaRenameEnabledSchema() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
 
         IntegrationUtils.enableSchema( service, "samba" );
-        assertTrue( getAttributeTypeRegistry().hasAttributeType( "sambaNTPassword" ) );
-        assertEquals( "samba", getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "sambaNTPassword" ) );
+        assertEquals( "samba", service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
         
         schemaRoot.rename( "cn=samba", "cn=foo" );
         assertNotNull( schemaRoot.lookup( "cn=foo" ) );
-        assertTrue( getAttributeTypeRegistry().hasAttributeType( "sambaNTPassword" ) );
-        assertEquals( "foo", getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "sambaNTPassword" ) );
+        assertEquals( "foo", service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
 
         //noinspection EmptyCatchBlock
         try
@@ -644,8 +966,6 @@
     // -----------------------------------------------------------------------
     // Dependency Modify Tests
     // -----------------------------------------------------------------------
-
-
     /**
      * Checks to make sure the addition of an undefined schema to the dependencies 
      * of an existing schema fail with an UNWILLING_TO_PERFORM result code.
@@ -653,6 +973,7 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testRejectAddBogusDependency() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
@@ -682,6 +1003,7 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testRejectAddOfDisabledDependencyToEnabledSchema() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
@@ -709,6 +1031,7 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testAddOfDisabledDependencyToDisabledSchema() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );
@@ -729,6 +1052,7 @@
      * @throws Exception on error
      */
     @Test
+    @Ignore
     public void testAddOfEnabledDependencyToDisabledSchema() throws Exception
     {
         LdapContext schemaRoot = getSchemaContext( service );

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerIT.java Wed Jan  6 18:26:43 2010
@@ -20,29 +20,16 @@
 package org.apache.directory.server.core.schema;
 
 
-import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
 import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
-import org.apache.directory.server.schema.registries.OidRegistry;
-import org.apache.directory.server.schema.registries.SyntaxCheckerRegistry;
-import org.apache.directory.server.schema.registries.SyntaxRegistry;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
-import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.Syntax;
-import org.apache.directory.shared.ldap.schema.SyntaxChecker;
-import org.apache.directory.shared.ldap.schema.syntaxes.AcceptAllSyntaxChecker;
-
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
@@ -51,8 +38,20 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
+import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schema.SyntaxChecker;
+import org.apache.directory.shared.ldap.schema.syntaxCheckers.OctetStringSyntaxChecker;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 
 /**
@@ -62,254 +61,349 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-@RunWith ( CiRunner.class )
-public class MetaSyntaxCheckerHandlerIT
+@RunWith(FrameworkRunner.class)
+public class MetaSyntaxCheckerHandlerIT extends AbstractMetaSchemaObjectHandler
 {
     private static final String OID = "1.3.6.1.4.1.18060.0.4.0.0.100000";
     private static final String NEW_OID = "1.3.6.1.4.1.18060.0.4.0.0.100001";
 
-
-    public static DirectoryService service;
-
-
-    private static SyntaxCheckerRegistry getSyntaxCheckerRegistry()
-    {
-        return service.getRegistries().getSyntaxCheckerRegistry();
-    }
+    public static SchemaManager schemaManager;
 
 
-    private static SyntaxRegistry getSyntaxRegistry()
+    @Before
+    public void setup()
     {
-        return service.getRegistries().getSyntaxRegistry();
+        schemaManager = service.getSchemaManager();
     }
 
 
-    private static OidRegistry getOidRegistry()
+    // ----------------------------------------------------------------------
+    // Test all core methods with normal operational pathways
+    // ----------------------------------------------------------------------
+    @Test
+    public void testAddSyntaxCheckerToEnabledSchema() throws Exception
     {
-        return service.getRegistries().getOidRegistry();
+        Attributes attrs = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaSyntaxChecker",
+            "m-fqcn", OctetStringSyntaxChecker.class.getName(),
+            "m-oid", OID,
+            "m-description: A test syntaxChecker" );
+        
+        LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
+        dn.add( "m-oid" + "=" + OID );
+        getSchemaContext( service ).createSubcontext( dn, attrs );
+        
+        assertTrue( schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        assertEquals( schemaManager.getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
+        Class<?> clazz = schemaManager.getSyntaxCheckerRegistry().lookup( OID ).getClass();
+        assertEquals( clazz, OctetStringSyntaxChecker.class );
+        assertTrue( isOnDisk( dn ) );
     }
-
-
-    /**
-     * Gets relative DN to ou=schema.
-     *
-     * @param schemaName the name of the schema
-     * @return the dn of the container holding syntax checkers for the schema
-     * @throws Exception on dn parse errors
-     */
-    private LdapDN getSyntaxCheckerContainer( String schemaName ) throws Exception
+    
+    
+    @Test
+    public void testAddSyntaxCheckerToDisabledSchema() throws Exception
     {
-        return new LdapDN( "ou=syntaxCheckers,cn=" + schemaName );
+        Attributes attrs = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaSyntaxChecker",
+            "m-fqcn", OctetStringSyntaxChecker.class.getName(),
+            "m-oid", OID,
+            "m-description: A test syntaxChecker" );
+        
+        // nis is by default inactive
+        LdapDN dn = getSyntaxCheckerContainer( "nis" );
+        dn.add( "m-oid" + "=" + OID );
+        getSchemaContext( service ).createSubcontext( dn, attrs );
+        
+        assertFalse( "adding new syntaxChecker to disabled schema should not register it into the registries", 
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        assertTrue( isOnDisk( dn ) );
     }
     
     
-    // ----------------------------------------------------------------------
-    // Test all core methods with normal operational pathways
-    // ----------------------------------------------------------------------
+    @Test
+    public void testAddSyntaxCheckerToUnloadedSchema() throws Exception
+    {
+        Attributes attrs = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaSyntaxChecker",
+            "m-fqcn", OctetStringSyntaxChecker.class.getName(),
+            "m-oid", OID,
+            "m-description: A test syntaxChecker" );
+        
+        // nis is by default inactive
+        LdapDN dn = getSyntaxCheckerContainer( "notloaded" );
+        dn.add( "m-oid" + "=" + OID );
+
+        try
+        {
+            getSchemaContext( service ).createSubcontext( dn, attrs );
+            fail( "Should not be there" );
+        }
+        catch( NameNotFoundException nnfe )
+        {
+            // Expected result.
+        }
+        
+        assertFalse( "adding new syntaxChecker to disabled schema should not register it into the registries", 
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        assertFalse( isOnDisk( dn ) );
+    }
 
 
     @Test
-    public void testAddSyntaxChecker() throws Exception
+    public void testAddSyntaxCheckerWithByteCodeOnEnabledSchema() throws Exception
     {
-        Attributes attrs = new BasicAttributes( true );
-        Attribute oc = new BasicAttribute( SchemaConstants.OBJECT_CLASS_AT, "top" );
-        oc.add( MetaSchemaConstants.META_TOP_OC );
-        oc.add( MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
-        attrs.put( oc );
-        attrs.put( MetaSchemaConstants.M_FQCN_AT, AcceptAllSyntaxChecker.class.getName() );
-        attrs.put( MetaSchemaConstants.M_OID_AT, OID );
-        attrs.put( MetaSchemaConstants.M_DESCRIPTION_AT, "A test syntaxChecker" );
+        InputStream in = getClass().getResourceAsStream( "DummySyntaxChecker.bytecode" );
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        
+        while ( in.available() > 0 )
+        {
+            out.write( in.read() );
+        }
+        
+        Attributes attrs = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaSyntaxChecker",
+            "m-fqcn", "org.apache.directory.shared.ldap.schema.syntaxCheckers.DummySyntaxChecker",
+            "m-bytecode", out.toByteArray(),
+            "m-oid", OID,
+            "m-description: A test syntaxChecker" );
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
         getSchemaContext( service ).createSubcontext( dn, attrs );
         
-        assertTrue( getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
-        assertEquals( getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
-        Class<?> clazz = getSyntaxCheckerRegistry().lookup( OID ).getClass();
-        assertEquals( clazz, AcceptAllSyntaxChecker.class );
+        assertTrue( schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        assertEquals( schemaManager.getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
+        Class<?> clazz = schemaManager.getSyntaxCheckerRegistry().lookup( OID ).getClass();
+        assertEquals( clazz.getName(), "org.apache.directory.shared.ldap.schema.syntaxCheckers.DummySyntaxChecker" );
+        assertTrue( isOnDisk( dn ) );
     }
-    
-    
+
+
     @Test
-    public void testAddSyntaxCheckerWithByteCode() throws Exception
+    public void testAddSyntaxCheckerWithByteCodeOnDisabledSchema() throws Exception
     {
         InputStream in = getClass().getResourceAsStream( "DummySyntaxChecker.bytecode" );
         ByteArrayOutputStream out = new ByteArrayOutputStream();
+        
         while ( in.available() > 0 )
         {
             out.write( in.read() );
         }
         
-        Attributes attrs = new BasicAttributes( true );
-        Attribute oc = new BasicAttribute( SchemaConstants.OBJECT_CLASS_AT, "top" );
-        oc.add( MetaSchemaConstants.META_TOP_OC );
-        oc.add( MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
-        attrs.put( oc );
-        attrs.put( MetaSchemaConstants.M_FQCN_AT, "DummySyntaxChecker" );
-        attrs.put( MetaSchemaConstants.M_BYTECODE_AT, out.toByteArray() );
-        attrs.put( MetaSchemaConstants.M_OID_AT, OID );
-        attrs.put( MetaSchemaConstants.M_DESCRIPTION_AT, "A test syntaxChecker" );
+        Attributes attrs = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaSyntaxChecker",
+            "m-fqcn", "org.apache.directory.shared.ldap.schema.syntaxCheckers.DummySyntaxChecker",
+            "m-bytecode", out.toByteArray(),
+            "m-oid", OID,
+            "m-description: A test syntaxChecker" );
         
-        LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        LdapDN dn = getSyntaxCheckerContainer( "nis" );
+        dn.add( "m-oid" + "=" + OID );
         getSchemaContext( service ).createSubcontext( dn, attrs );
         
-        assertTrue( getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
-        assertEquals( getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
-        Class<?> clazz = getSyntaxCheckerRegistry().lookup( OID ).getClass();
-        assertEquals( clazz.getName(), "DummySyntaxChecker" );
+        assertFalse( schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        assertTrue( isOnDisk( dn ) );
     }
     
     
     @Test
-    public void testDeleteSyntaxChecker() throws Exception
+    public void testDeleteSyntaxCheckerFromEnabledSchema() throws Exception
     {
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
-        testAddSyntaxChecker();
+        dn.add( "m-oid" + "=" + OID );
+        testAddSyntaxCheckerToEnabledSchema();
+        
+        assertTrue( "syntaxChecker should be removed from the registry after being deleted", 
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        assertTrue( isOnDisk( dn ) );
         
         getSchemaContext( service ).destroySubcontext( dn );
 
         assertFalse( "syntaxChecker should be removed from the registry after being deleted", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
 
-        //noinspection EmptyCatchBlock
         try
         {
-            getSyntaxCheckerRegistry().lookup( OID );
+            schemaManager.getSyntaxCheckerRegistry().lookup( OID );
             fail( "syntaxChecker lookup should fail after deleting the syntaxChecker" );
         }
         catch( NamingException e )
         {
         }
+        
+        assertFalse( isOnDisk( dn ) );
+    }
+    
+    
+    @Test
+    public void testDeleteSyntaxCheckerFromDisabledSchema() throws Exception
+    {
+        LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
+        dn.add( "m-oid" + "=" + OID );
+        testAddSyntaxCheckerToEnabledSchema();
+        
+        assertTrue( "syntaxChecker should be removed from the registry after being deleted", 
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        assertTrue( isOnDisk( dn ) );
+
+        getSchemaContext( service ).destroySubcontext( dn );
+
+        assertFalse( "syntaxChecker should be removed from the registry after being deleted", 
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+
+        try
+        {
+            schemaManager.getSyntaxCheckerRegistry().lookup( OID );
+            fail( "syntaxChecker lookup should fail after deleting the syntaxChecker" );
+        }
+        catch( NamingException e )
+        {
+        }
+        
+        assertFalse( isOnDisk( dn ) );
     }
 
 
     @Test
+    @Ignore
     public void testRenameSyntaxChecker() throws Exception
     {
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
-        testAddSyntaxChecker();
+        dn.add( "m-oid" + "=" + OID );
+        testAddSyntaxCheckerToEnabledSchema();
         
         LdapDN newdn = getSyntaxCheckerContainer( "apachemeta" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + NEW_OID );
+        newdn.add( "m-oid" + "=" + NEW_OID );
         getSchemaContext( service ).rename( dn, newdn );
 
         assertFalse( "old syntaxChecker OID should be removed from the registry after being renamed", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
 
         //noinspection EmptyCatchBlock
         try
         {
-            getSyntaxCheckerRegistry().lookup( OID );
+            schemaManager.getSyntaxCheckerRegistry().lookup( OID );
             fail( "syntaxChecker lookup should fail after deleting the syntaxChecker" );
         }
         catch( NamingException e )
         {
         }
 
-        assertTrue( getSyntaxCheckerRegistry().hasSyntaxChecker( NEW_OID ) );
-        Class<?> clazz = getSyntaxCheckerRegistry().lookup( NEW_OID ).getClass();
-        assertEquals( clazz, AcceptAllSyntaxChecker.class );
+        assertTrue( schemaManager.getSyntaxCheckerRegistry().contains( NEW_OID ) );
+        Class<?> clazz = schemaManager.getSyntaxCheckerRegistry().lookup( NEW_OID ).getClass();
+        assertEquals( clazz, OctetStringSyntaxChecker.class );
     }
 
 
     @Test
+    @Ignore
     public void testMoveSyntaxChecker() throws Exception
     {
-        testAddSyntaxChecker();
+        testAddSyntaxCheckerToEnabledSchema();
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = getSyntaxCheckerContainer( "apache" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        newdn.add( "m-oid" + "=" + OID );
         
         getSchemaContext( service ).rename( dn, newdn );
 
         assertTrue( "syntaxChecker OID should still be present", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
         
         assertEquals( "syntaxChecker schema should be set to apache not apachemeta", 
-            getSyntaxCheckerRegistry().getSchemaName( OID ), "apache" );
+            schemaManager.getSyntaxCheckerRegistry().getSchemaName( OID ), "apache" );
 
-        Class<?> clazz = getSyntaxCheckerRegistry().lookup( OID ).getClass();
-        assertEquals( clazz, AcceptAllSyntaxChecker.class );
+        Class<?> clazz = schemaManager.getSyntaxCheckerRegistry().lookup( OID ).getClass();
+        assertEquals( clazz, OctetStringSyntaxChecker.class );
     }
 
 
     @Test
+    @Ignore
     public void testMoveSyntaxCheckerAndChangeRdn() throws Exception
     {
-        testAddSyntaxChecker();
+        testAddSyntaxCheckerToEnabledSchema();
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = getSyntaxCheckerContainer( "apache" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + NEW_OID );
+        newdn.add( "m-oid" + "=" + NEW_OID );
         
         getSchemaContext( service ).rename( dn, newdn );
 
         assertFalse( "old syntaxChecker OID should NOT be present", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
         
         assertTrue( "new syntaxChecker OID should be present", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( NEW_OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( NEW_OID ) );
         
         assertEquals( "syntaxChecker with new oid should have schema set to apache NOT apachemeta", 
-            getSyntaxCheckerRegistry().getSchemaName( NEW_OID ), "apache" );
+            schemaManager.getSyntaxCheckerRegistry().getSchemaName( NEW_OID ), "apache" );
 
-        Class<?> clazz = getSyntaxCheckerRegistry().lookup( NEW_OID ).getClass();
-        assertEquals( clazz, AcceptAllSyntaxChecker.class );
+        Class<?> clazz = schemaManager.getSyntaxCheckerRegistry().lookup( NEW_OID ).getClass();
+        assertEquals( clazz, OctetStringSyntaxChecker.class );
     }
 
     
     @Test
+    @Ignore
     public void testModifySyntaxCheckerWithModificationItems() throws Exception
     {
-        testAddSyntaxChecker();
+        testAddSyntaxCheckerToEnabledSchema();
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
         
         ModificationItem[] mods = new ModificationItem[1];
-        Attribute attr = new BasicAttribute( MetaSchemaConstants.M_FQCN_AT, BogusSyntaxChecker.class.getName() );
+        Attribute attr = new BasicAttribute( "m-fqcn", BogusSyntaxChecker.class.getName() );
         mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
         getSchemaContext( service ).modifyAttributes( dn, mods );
 
         assertTrue( "syntaxChecker OID should still be present", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
         
         assertEquals( "syntaxChecker schema should be set to apachemeta", 
-            getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
+            schemaManager.getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
 
-        Class<?> clazz = getSyntaxCheckerRegistry().lookup( OID ).getClass();
+        Class<?> clazz = schemaManager.getSyntaxCheckerRegistry().lookup( OID ).getClass();
         assertEquals( clazz, BogusSyntaxChecker.class );
     }
 
     
     @Test
+    @Ignore
     public void testModifySyntaxCheckerWithAttributes() throws Exception
     {
-        testAddSyntaxChecker();
+        testAddSyntaxCheckerToEnabledSchema();
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
         
         Attributes mods = new BasicAttributes( true );
-        mods.put( MetaSchemaConstants.M_FQCN_AT, BogusSyntaxChecker.class.getName() );
+        mods.put( "m-fqcn", BogusSyntaxChecker.class.getName() );
         getSchemaContext( service ).modifyAttributes( dn, DirContext.REPLACE_ATTRIBUTE, mods );
 
         assertTrue( "syntaxChecker OID should still be present", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
         
         assertEquals( "syntaxChecker schema should be set to apachemeta", 
-            getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
+            schemaManager.getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
 
-        Class<?> clazz = getSyntaxCheckerRegistry().lookup( OID ).getClass();
+        Class<?> clazz = schemaManager.getSyntaxCheckerRegistry().lookup( OID ).getClass();
         assertEquals( clazz, BogusSyntaxChecker.class );
     }
     
@@ -317,19 +411,42 @@
     // ----------------------------------------------------------------------
     // Test move, rename, and delete when a MR exists and uses the Normalizer
     // ----------------------------------------------------------------------
-
-    
     @Test
     public void testDeleteSyntaxCheckerWhenInUse() throws Exception
     {
-        LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
-        testAddSyntaxChecker();
-        getSyntaxRegistry().register( new DummySyntax() );
+        LdapDN scDn = getSyntaxCheckerContainer( "apachemeta" );
+        scDn.add( "m-oid" + "=" + OID );
+        
+        // Create a new SyntaxChecker
+        testAddSyntaxCheckerToEnabledSchema();
+        assertTrue( isOnDisk( scDn ) );
+        assertTrue( service.getSchemaManager().getSyntaxCheckerRegistry().contains( OID ) );
+        
+        // Create a Syntax using this comparator
+        Attributes attrs = AttributeUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaSyntax",
+            "m-oid", OID,
+            "m-description: test" );
+
+        LdapDN sDn = getSyntaxContainer( "apachemeta" );
+        sDn.add( "m-oid" + "=" + OID );
+
+        // Pre-checks
+        assertFalse( isOnDisk( sDn ) );
+        assertFalse( service.getSchemaManager().getLdapSyntaxRegistry().contains( OID ) );
+
+        // Syntax Addition
+        getSchemaContext( service ).createSubcontext( sDn, attrs );
+
+        // Post-checks
+        assertTrue( isOnDisk( sDn ) );
+        assertTrue( service.getSchemaManager().getLdapSyntaxRegistry().contains( OID ) );
         
         try
         {
-            getSchemaContext( service ).destroySubcontext( dn );
+            getSchemaContext( service ).destroySubcontext( scDn );
             fail( "should not be able to delete a syntaxChecker in use" );
         }
         catch( LdapOperationNotSupportedException e ) 
@@ -338,23 +455,22 @@
         }
 
         assertTrue( "syntaxChecker should still be in the registry after delete failure", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
-        getSyntaxRegistry().unregister( OID );
-        getOidRegistry().unregister( OID );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
     }
     
     
     @Test
+    @Ignore
     public void testMoveSyntaxCheckerWhenInUse() throws Exception
     {
-        testAddSyntaxChecker();
-        getSyntaxRegistry().register( new DummySyntax() );
+        testAddSyntaxCheckerToEnabledSchema();
+        schemaManager.getLdapSyntaxRegistry().register( new DummySyntax() );
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = getSyntaxCheckerContainer( "apache" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        newdn.add( "m-oid" + "=" + OID );
         
         try
         {
@@ -367,23 +483,24 @@
         }
 
         assertTrue( "syntaxChecker should still be in the registry after move failure", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
-        getSyntaxRegistry().unregister( OID );
-        getOidRegistry().unregister( OID );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        schemaManager.getLdapSyntaxRegistry().unregister( OID );
+        schemaManager.getGlobalOidRegistry().unregister( OID );
     }
 
 
     @Test
+    @Ignore
     public void testMoveSyntaxCheckerAndChangeRdnWhenInUse() throws Exception
     {
-        testAddSyntaxChecker();
-        getSyntaxRegistry().register( new DummySyntax() );
+        testAddSyntaxCheckerToEnabledSchema();
+        schemaManager.getLdapSyntaxRegistry().register( new DummySyntax() );
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = getSyntaxCheckerContainer( "apache" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + NEW_OID );
+        newdn.add( "m-oid" + "=" + NEW_OID );
         
         try
         {
@@ -396,22 +513,23 @@
         }
 
         assertTrue( "syntaxChecker should still be in the registry after move failure", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
-        getSyntaxRegistry().unregister( OID );
-        getOidRegistry().unregister( OID );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        schemaManager.getLdapSyntaxRegistry().unregister( OID );
+        schemaManager.getGlobalOidRegistry().unregister( OID );
     }
 
     
     @Test
+    @Ignore
     public void testRenameSyntaxCheckerWhenInUse() throws Exception
     {
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
-        testAddSyntaxChecker();
-        getSyntaxRegistry().register( new DummySyntax() );
+        dn.add( "m-oid" + "=" + OID );
+        testAddSyntaxCheckerToEnabledSchema();
+        schemaManager.getLdapSyntaxRegistry().register( new DummySyntax() );
         
         LdapDN newdn = getSyntaxCheckerContainer( "apachemeta" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + NEW_OID );
+        newdn.add( "m-oid" + "=" + NEW_OID );
         
         try
         {
@@ -424,9 +542,9 @@
         }
 
         assertTrue( "syntaxChecker should still be in the registry after rename failure", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
-        getSyntaxRegistry().unregister( OID );
-        getOidRegistry().unregister( OID );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
+        schemaManager.getLdapSyntaxRegistry().unregister( OID );
+        schemaManager.getGlobalOidRegistry().unregister( OID );
     }
 
 
@@ -436,15 +554,16 @@
 
 
     @Test
+    @Ignore
     public void testMoveSyntaxCheckerToTop() throws Exception
     {
-        testAddSyntaxChecker();
+        testAddSyntaxCheckerToEnabledSchema();
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
 
         LdapDN top = new LdapDN();
-        top.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        top.add( "m-oid" + "=" + OID );
         
         try
         {
@@ -457,20 +576,21 @@
         }
 
         assertTrue( "syntaxChecker should still be in the registry after move failure", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
     }
 
 
     @Test
+    @Ignore
     public void testMoveSyntaxCheckerToComparatorContainer() throws Exception
     {
-        testAddSyntaxChecker();
+        testAddSyntaxCheckerToEnabledSchema();
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
 
         LdapDN newdn = new LdapDN( "ou=comparators,cn=apachemeta" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        newdn.add( "m-oid" + "=" + OID );
         
         try
         {
@@ -483,91 +603,65 @@
         }
 
         assertTrue( "syntaxChecker should still be in the registry after move failure", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
     }
     
     
     @Test
-    public void testAddSyntaxCheckerToDisabledSchema() throws Exception
-    {
-        Attributes attrs = new BasicAttributes( true );
-        Attribute oc = new BasicAttribute( SchemaConstants.OBJECT_CLASS_AT, "top" );
-        oc.add( MetaSchemaConstants.META_TOP_OC );
-        oc.add( MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
-        attrs.put( oc );
-        attrs.put( MetaSchemaConstants.M_FQCN_AT, AcceptAllSyntaxChecker.class.getName() );
-        attrs.put( MetaSchemaConstants.M_OID_AT, OID );
-        attrs.put( MetaSchemaConstants.M_DESCRIPTION_AT, "A test syntaxChecker" );
-        
-        // nis is by default inactive
-        LdapDN dn = getSyntaxCheckerContainer( "nis" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
-        getSchemaContext( service ).createSubcontext( dn, attrs );
-        
-        assertFalse( "adding new syntaxChecker to disabled schema should not register it into the registries", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
-    }
-
-
-    @Test
+    @Ignore
     public void testMoveSyntaxCheckerToDisabledSchema() throws Exception
     {
-        testAddSyntaxChecker();
+        testAddSyntaxCheckerToEnabledSchema();
         
         LdapDN dn = getSyntaxCheckerContainer( "apachemeta" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
 
         // nis is inactive by default
         LdapDN newdn = getSyntaxCheckerContainer( "nis" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        newdn.add( "m-oid" + "=" + OID );
         
         getSchemaContext( service ).rename( dn, newdn );
 
         assertFalse( "syntaxChecker OID should no longer be present", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
     }
 
 
     @Test
+    @Ignore
     public void testMoveSyntaxCheckerToEnabledSchema() throws Exception
     {
         testAddSyntaxCheckerToDisabledSchema();
         
         // nis is inactive by default
         LdapDN dn = getSyntaxCheckerContainer( "nis" );
-        dn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        dn.add( "m-oid" + "=" + OID );
 
         assertFalse( "syntaxChecker OID should NOT be present when added to disabled nis schema", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
 
         LdapDN newdn = getSyntaxCheckerContainer( "apachemeta" );
-        newdn.add( MetaSchemaConstants.M_OID_AT + "=" + OID );
+        newdn.add( "m-oid" + "=" + OID );
         
         getSchemaContext( service ).rename( dn, newdn );
 
         assertTrue( "syntaxChecker OID should be present when moved to enabled schema", 
-            getSyntaxCheckerRegistry().hasSyntaxChecker( OID ) );
+            schemaManager.getSyntaxCheckerRegistry().contains( OID ) );
         
         assertEquals( "syntaxChecker should be in apachemeta schema after move", 
-            getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
+            schemaManager.getSyntaxCheckerRegistry().getSchemaName( OID ), "apachemeta" );
     }
 
     
-    public static class BogusSyntaxChecker implements SyntaxChecker
+    public static class BogusSyntaxChecker extends SyntaxChecker
     {
+        private static final long serialVersionUID = 1L;
+
         public BogusSyntaxChecker()
         {
+        	super(OID);
         }
         
-        public void assertSyntax( Object value ) throws NamingException
-        {
-        }
-
-        public String getSyntaxOid()
-        {
-            return OID;
-        }
-
         public boolean isValidSyntax( Object value )
         {
             return false;
@@ -575,59 +669,17 @@
     }
 
     
-    class DummySyntax implements Syntax
+    class DummySyntax extends LdapSyntax
     {
         private static final long serialVersionUID = 1L;
 
-
-        public String getDescription()
-        {
-            return null;
-        }
-
-        public String getName()
-        {
-            return "dummy";
-        }
-
-        public String[] getNames()
-        {
-            return new String[] { "dummy" };
-        }
-
-        public String getOid()
-        {
-            return OID;
-        }
-
-        public boolean isObsolete()
-        {
-            return false;
-        }
-
-        public SyntaxChecker getSyntaxChecker() throws NamingException
-        {
-            return null;
-        }
-
-        public boolean isHumanReadable()
-        {
-            return false;
-        }
-
-        public String getSchema()
-        {
-            return null;
-        }
-
-        public void setSchema( String schemaName )
-        {
-        }
-
-        public String[] getNamesRef()
+        public DummySyntax()
         {
-            // TODO Auto-generated method stub
-            return null;
+            super( OID );
+            addName( "dummy" );
+            isObsolete = false; 
+            isHumanReadable = false;
+            syntaxChecker = null;
         }
     }
 }