directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1547602 - in /directory/shared/trunk/ldap/model/src: main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java test/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorterTest.java
Date Tue, 03 Dec 2013 21:51:30 GMT
Author: seelmann
Date: Tue Dec  3 21:51:30 2013
New Revision: 1547602

URL: http://svn.apache.org/r1547602
Log:
Fix issues with mixed case names

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorterTest.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java?rev=1547602&r1=1547601&r2=1547602&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java
Tue Dec  3 21:51:30 2013
@@ -131,8 +131,8 @@ public class SchemaObjectSorter
 
             for ( T schemaObject : schemaObjects )
             {
-                String oid = schemaObject.getOid();
-                oid2numericOid.put( oid.toLowerCase(), oid );
+                String oid = schemaObject.getOid().toLowerCase();
+                oid2numericOid.put( oid, oid );
                 for ( String name : schemaObject.getNames() )
                 {
                     oid2numericOid.put( name.toLowerCase(), oid );
@@ -174,7 +174,12 @@ public class SchemaObjectSorter
 
                     for ( String superiorOid : superiorOids )
                     {
-                        String superiorNumeridOid = oid2numericOid.get( superiorOid );
+                        if ( superiorOid == null )
+                        {
+                            continue;
+                        }
+
+                        String superiorNumeridOid = oid2numericOid.get( superiorOid.toLowerCase()
);
 
                         // AT's superior is not within the processed AT list
                         if ( superiorNumeridOid == null )
@@ -182,7 +187,7 @@ public class SchemaObjectSorter
                             continue;
                         }
 
-                        T superiorSchemaObject = numericOid2schemaObject.get( superiorNumeridOid
);
+                        T superiorSchemaObject = numericOid2schemaObject.get( superiorNumeridOid.toLowerCase()
);
 
                         // AT's superior was already removed
                         if ( superiorSchemaObject == null )

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorterTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorterTest.java?rev=1547602&r1=1547601&r2=1547602&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorterTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorterTest.java
Tue Dec  3 21:51:30 2013
@@ -78,10 +78,10 @@ public class SchemaObjectSorterTest
 
             List<AttributeType> attributeTypes = new ArrayList<AttributeType>();
             addAttributeType( attributeTypes, oidIterator.next(), "att1", null );
-            addAttributeType( attributeTypes, oidIterator.next(), "att2", "att1" );
+            addAttributeType( attributeTypes, oidIterator.next(), "aTT2", "att1" );
             addAttributeType( attributeTypes, oidIterator.next(), "att3", "att2" );
-            addAttributeType( attributeTypes, oidIterator.next(), "att4", "att3" );
-            addAttributeType( attributeTypes, oidIterator.next(), "att5", "att1" );
+            addAttributeType( attributeTypes, oidIterator.next(), "att4", "atT3" );
+            addAttributeType( attributeTypes, oidIterator.next(), "att5", "aTt1" );
             addAttributeType( attributeTypes, oidIterator.next(), "att6", null );
             addAttributeType( attributeTypes, oidIterator.next(), "att7", "other" );
 
@@ -113,13 +113,16 @@ public class SchemaObjectSorterTest
 
         AttributeType next = iterator.next();
         String superiorOid = next.getSuperiorOid();
+        if(superiorOid != null) {
+            superiorOid = superiorOid.toLowerCase();
+        }
 
         if ( !Arrays.asList( expected ).contains( superiorOid ) )
         {
             fail( "Expected that " + Arrays.asList( expected ) + " contains " + superiorOid
);
         }
 
-        return next.getName();
+        return next.getName().toLowerCase();
     }
 
 
@@ -154,10 +157,10 @@ public class SchemaObjectSorterTest
     {
         List<ObjectClass> objectClasses = new ArrayList<ObjectClass>();
         addObjectClass( objectClasses, "1.2.1", "oc1" );
-        addObjectClass( objectClasses, "1.2.2", "oc2", "oc1" );
-        addObjectClass( objectClasses, "1.2.3", "oc3", "oc2" );
+        addObjectClass( objectClasses, "1.2.2", "OC2", "oc1" );
+        addObjectClass( objectClasses, "1.2.3", "oc3", "oC2" );
         addObjectClass( objectClasses, "1.2.4", "oc4" );
-        addObjectClass( objectClasses, "1.2.5", "oc5", "oc2", "oc4" );
+        addObjectClass( objectClasses, "1.2.5", "oc5", "Oc2", "oC4" );
         addObjectClass( objectClasses, "1.2.6", "oc6", "other" );
 
         Iterable<ObjectClass> sorted = SchemaObjectSorter.sortObjectClasses( objectClasses
);
@@ -176,10 +179,10 @@ public class SchemaObjectSorterTest
 
             List<ObjectClass> objectClasses = new ArrayList<ObjectClass>();
             addObjectClass( objectClasses, oidIterator.next(), "oc1" );
-            addObjectClass( objectClasses, oidIterator.next(), "oc2", "oc1" );
-            addObjectClass( objectClasses, oidIterator.next(), "oc3", "oc2" );
+            addObjectClass( objectClasses, oidIterator.next(), "OC2", "oc1" );
+            addObjectClass( objectClasses, oidIterator.next(), "oc3", "Oc2" );
             addObjectClass( objectClasses, oidIterator.next(), "oc4" );
-            addObjectClass( objectClasses, oidIterator.next(), "oc5", "oc2", "oc4" );
+            addObjectClass( objectClasses, oidIterator.next(), "oc5", "oC2", "OC4" );
             addObjectClass( objectClasses, oidIterator.next(), "oc6", "other" );
 
             Iterable<ObjectClass> sorted = SchemaObjectSorter.sortObjectClasses( objectClasses
);
@@ -209,13 +212,17 @@ public class SchemaObjectSorterTest
 
         ObjectClass next = iterator.next();
         List<String> superiorOids = next.getSuperiorOids();
+        for ( int i = 0; i < superiorOids.size(); i++ )
+        {
+            superiorOids.set( i, superiorOids.get( i ).toLowerCase() );
+        }
 
         if ( !Arrays.asList( expected ).containsAll( superiorOids ) )
         {
             fail( "Expected that " + Arrays.asList( expected ) + " contains all " + superiorOids
);
         }
 
-        return next.getName();
+        return next.getName().toLowerCase();
     }
 
 



Mime
View raw message