directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r835672 - /directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
Date Fri, 13 Nov 2009 00:38:00 GMT
Author: elecharny
Date: Fri Nov 13 00:38:00 2009
New Revision: 835672

URL: http://svn.apache.org/viewvc?rev=835672&view=rev
Log:
Added some comments

Modified:
    directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java

Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java?rev=835672&r1=835671&r2=835672&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
Fri Nov 13 00:38:00 2009
@@ -98,6 +98,8 @@
     // ----------------------------------------------------------------------
     // Test all core methods with normal operational pathways
     // ----------------------------------------------------------------------
+    // Test Add operation
+    // ----------------------------------------------------------------------
     @Test
     public void testAddComparatorToEnabledSchema() throws Exception
     {
@@ -111,8 +113,15 @@
         
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
+        
+        // Pre-checks
+        assertFalse( isOnDisk( dn ) );
+        assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
+
+        // Addition
         getSchemaContext( service ).createSubcontext( dn, attrs );
         
+        // Post-checks
         assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
         assertEquals( schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta"
);
         Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
@@ -135,8 +144,15 @@
         // nis is by default inactive
         LdapDN dn = getComparatorContainer( "nis" );
         dn.add( "m-oid" + "=" + OID );
+        
+        // Pre-checks
+        assertFalse( isOnDisk( dn ) );
+        assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
+
+        // Addition
         getSchemaContext( service ).createSubcontext( dn, attrs );
         
+        // Post-checks
         assertFalse( "adding new comparator to disabled schema should not register it into
the registries", 
             schemaManager.getComparatorRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
@@ -158,6 +174,11 @@
         LdapDN dn = getComparatorContainer( "notloaded" );
         dn.add( "m-oid" + "=" + OID );
         
+        // Pre-checks
+        assertFalse( isOnDisk( dn ) );
+        assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
+
+        // Addition
         try
         {
             getSchemaContext( service ).createSubcontext( dn, attrs );
@@ -168,6 +189,7 @@
             // Expected result.
         }
         
+        // Post-checks
         assertFalse( "adding new comparator to disabled schema should not register it into
the registries", 
             schemaManager.getComparatorRegistry().contains( OID ) );
         assertFalse( isOnDisk( dn ) );
@@ -196,8 +218,15 @@
         
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
+        
+        // Pre-checks
+        assertFalse( isOnDisk( dn ) );
+        assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
+
+        // Addition
         getSchemaContext( service ).createSubcontext( dn, attrs );
         
+        // Post-checks
         assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
         assertEquals( schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta"
);
         Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
@@ -229,8 +258,15 @@
         // nis is by default inactive
         LdapDN dn = getComparatorContainer( "nis" );
         dn.add( "m-oid" + "=" + OID );
+
+        // Pre-checks
+        assertFalse( isOnDisk( dn ) );
+        assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
+
+        // Addition
         getSchemaContext( service ).createSubcontext( dn, attrs );
         
+        // Post-checks
         assertFalse( "adding new comparator to disabled schema should not register it into
the registries", 
             schemaManager.getComparatorRegistry().contains( OID ) );
 
@@ -238,18 +274,25 @@
     }
     
 
+    // ----------------------------------------------------------------------
+    // Test Delete operation
+    // ----------------------------------------------------------------------
     @Test
     public void testDeleteComparatorFromEnabledSchema() throws Exception
     {
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
+        
         testAddComparatorToEnabledSchema();
         
+        // Pre-checks
         assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
         
+        // Deletion
         getSchemaContext( service ).destroySubcontext( dn );
 
+        // Post-checks
         assertFalse( "comparator should be removed from the registry after being deleted",

             schemaManager.getComparatorRegistry().contains( OID ) );
         
@@ -273,12 +316,15 @@
         dn.add( "m-oid" + "=" + OID );
         testAddComparatorToDisabledSchema();
 
+        // Pre-checks
         assertFalse( "comparator should be removed from the registry after being deleted",

             schemaManager.getComparatorRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
         
+        // Deletion
         getSchemaContext( service ).destroySubcontext( dn );
 
+        // Post-checks
         assertFalse( "comparator should be removed from the registry after being deleted",

             schemaManager.getComparatorRegistry().contains( OID ) );
         
@@ -427,15 +473,21 @@
     // ----------------------------------------------------------------------
     // Test move, rename, and delete when a MR exists and uses the Comparator
     // ----------------------------------------------------------------------
-
-    
     @Test
     public void testDeleteComparatorWhenInUse() throws Exception
     {
         LdapDN dn = getComparatorContainer( "apachemeta" );
         dn.add( "m-oid" + "=" + OID );
+        
         testAddComparatorToEnabledSchema();
-        schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
+        
+        MatchingRule mr = new DummyMR();
+        schemaManager.register( mr );
+        
+        // Pre-checks
+        assertTrue( isOnDisk( dn ) );
+        assertTrue( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
+        assertTrue( service.getSchemaManager().getMatchingRuleRegistry().contains( mr.getOid()
) );
         
         try
         {



Mime
View raw message