directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r888491 - /directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java
Date Tue, 08 Dec 2009 17:26:24 GMT
Author: kayyagari
Date: Tue Dec  8 17:26:23 2009
New Revision: 888491

URL: http://svn.apache.org/viewvc?rev=888491&view=rev
Log:
o added a test case for checking the behaviour of adding a comparator with and existing SO's
OID
o added a variable to hold OID 

Modified:
    directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java?rev=888491&r1=888490&r2=888491&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java
(original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/SchemaManagerAddTest.java
Tue Dec  8 17:26:23 2009
@@ -40,6 +40,7 @@
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.shared.ldap.schema.comparators.BooleanComparator;
+import org.apache.directory.shared.ldap.schema.comparators.CsnComparator;
 import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
 import org.apache.directory.shared.schema.DefaultSchemaManager;
 import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -581,7 +582,8 @@
         int ctrSize = schemaManager.getComparatorRegistry().size();
         int goidSize = schemaManager.getOidRegistry().size();
 
-        LdapComparator<?> lc = new BooleanComparator( "0.0.0" );
+        String oid = "0.0.0";
+        LdapComparator<?> lc = new BooleanComparator( oid );
 
         assertTrue( schemaManager.add( lc ) );
 
@@ -593,7 +595,7 @@
 
         try
         {
-            LdapComparator<?> added = schemaManager.lookupComparatorRegistry( "0.0.0"
);
+            LdapComparator<?> added = schemaManager.lookupComparatorRegistry( oid );
 
             assertNotNull( added );
         }
@@ -603,6 +605,35 @@
         }
     }
 
+    
+    @Test
+    public void testAddAlreadyExistingComparator() throws Exception
+    {
+        SchemaManager schemaManager = loadSystem();
+        int ctrSize = schemaManager.getComparatorRegistry().size();
+        int goidSize = schemaManager.getOidRegistry().size();
+
+        String oid = "0.0.0";
+        LdapComparator<?> lc = new BooleanComparator( oid );
+
+        assertTrue( schemaManager.add( lc ) );
+
+        List<Throwable> errors = schemaManager.getErrors();
+        assertEquals( 0, errors.size() );
+
+        lc = new CsnComparator( oid );
+        // FIXME the below add throws a NamingException instead of false
+        // expected behaviour is to return a boolean value consistently
+        assertFalse( schemaManager.add( lc ) );
+
+        errors = schemaManager.getErrors();
+        assertEquals( 1, errors.size() );
+        
+        assertEquals( ctrSize, schemaManager.getComparatorRegistry().size() );
+        assertEquals( goidSize, schemaManager.getOidRegistry().size() );
+    }
+    
+    
     //=========================================================================
     // DITContentRule addition tests
     //-------------------------------------------------------------------------



Mime
View raw message