directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1073496 [6/6] - in /directory/shared/branches/akarasulu: ./ all/ dsml-parser/ dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/ dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ dsml-parser/src/main/java/org...
Date Tue, 22 Feb 2011 20:56:30 GMT
Modified: directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1073496&r1=1073495&r2=1073496&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
(original)
+++ directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
Tue Feb 22 20:56:22 2011
@@ -931,7 +931,7 @@ public final class Dn implements Iterabl
             Rdn nameRdn = dn.rdns.get( dn.rdns.size() - i - 1 );
             Rdn ldapRdn = rdns.get( rdns.size() - i - 1 );
 
-            if ( nameRdn.compareTo( ldapRdn ) != 0 )
+            if ( !nameRdn.equals( ldapRdn ) )
             {
                 return false;
             }
@@ -1508,7 +1508,7 @@ public final class Dn implements Iterabl
 
             for ( int i = 0; i < this.size(); i++ )
             {
-                if ( name.rdns.get( i ).compareTo( rdns.get( i ) ) != 0 )
+                if ( !name.rdns.get( i ).equals( rdns.get( i ) ) )
                 {
                     return false;
                 }

Modified: directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java?rev=1073496&r1=1073495&r2=1073496&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
(original)
+++ directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
Tue Feb 22 20:56:22 2011
@@ -24,11 +24,11 @@ import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.commons.collections.MultiMap;
@@ -40,7 +40,11 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.util.*;
+import org.apache.directory.shared.util.Chars;
+import org.apache.directory.shared.util.Hex;
+import org.apache.directory.shared.util.StringConstants;
+import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.Unicode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -111,7 +115,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class Rdn implements Cloneable, Comparable<Rdn>, Externalizable, Iterable<Ava>
+public class Rdn implements Cloneable, Externalizable, Iterable<Ava>
 {
     /** The LoggerFactory used by this class */
     protected static final Logger LOG = LoggerFactory.getLogger( Rdn.class );
@@ -134,20 +138,13 @@ public class Rdn implements Cloneable, C
     /** The normalized Rdn */
     private String normName = null;
 
-    /** The starting position of this Rdn in the given string from which
-     * we have extracted the upName */
-    private int start;
-
-    /** The length of this Rdn upName */
-    private int length;
-
     /**
      * Stores all couple type = value. We may have more than one type, if the
      * '+' character appears in the AttributeTypeAndValue. This is a TreeSet,
      * because we want the ATAVs to be sorted. An atav may contain more than one
      * value. In this case, the values are String stored in a List.
      */
-    private Set<Ava> atavs = null;
+    private List<Ava> atavs = null;
 
     /**
      * We also keep a set of types, in order to use manipulations. A type is
@@ -230,8 +227,6 @@ public class Rdn implements Cloneable, C
      */
     public Rdn(String rdn, SchemaManager schemaManager) throws LdapInvalidDnException
     {
-        start = 0;
-
         if ( Strings.isNotEmpty(rdn) )
         {
             // Parse the string. The Rdn will be updated.
@@ -252,13 +247,11 @@ public class Rdn implements Cloneable, C
             }
 
             upName = rdn;
-            length = rdn.length();
         }
         else
         {
             upName = "";
             normName = "";
-            length = 0;
             normalized.set( false );
         }
     }
@@ -296,8 +289,6 @@ public class Rdn implements Cloneable, C
         addAVA( upType, normType, new StringValue( upValue ), new StringValue( normValue
) );
 
         upName = upType + '=' + upValue;
-        start = 0;
-        length = upName.length();
 
         // create the internal normalized form
         normalize();
@@ -346,8 +337,6 @@ public class Rdn implements Cloneable, C
         addAVA( upType, upType, new StringValue( upValue ), new StringValue( upValue ) );
 
         upName = upType + '=' + upValue;
-        start = 0;
-        length = upName.length();
 
         if( schemaManager != null )
         {
@@ -390,8 +379,6 @@ public class Rdn implements Cloneable, C
      */
     Rdn(int start, int length, String upName, String normName)
     {
-        this.start = start;
-        this.length = length;
         this.upName = upName;
         this.normName = normName;
         normalized.set( true );
@@ -409,8 +396,6 @@ public class Rdn implements Cloneable, C
         nbAtavs = rdn.getNbAtavs();
         this.normName = rdn.normName;
         this.upName = rdn.getName();
-        this.start = rdn.start;
-        this.length = rdn.length;
         normalized.set(rdn.normalized.get());
 
         switch ( rdn.getNbAtavs() )
@@ -424,7 +409,7 @@ public class Rdn implements Cloneable, C
 
             default:
                 // We must duplicate the treeSet and the hashMap
-                atavs = new TreeSet<Ava>();
+                atavs = new ArrayList<Ava>();
                 atavTypes = new MultiValueMap();
 
                 for ( Ava currentAtav : rdn.atavs )
@@ -590,7 +575,7 @@ public class Rdn implements Cloneable, C
                 // We already have an atav. We have to put it in the HashMap
                 // before adding a new one.
                 // First, create the HashMap,
-                atavs = new TreeSet<Ava>();
+                atavs = new ArrayList<Ava>();
 
                 // and store the existing AttributeTypeAndValue into it.
                 atavs.add( atav );
@@ -640,7 +625,7 @@ public class Rdn implements Cloneable, C
                 // We already have an atav. We have to put it in the HashMap
                 // before adding a new one.
                 // First, create the HashMap,
-                atavs = new TreeSet<Ava>();
+                atavs = new ArrayList<Ava>();
 
                 // and store the existing AttributeTypeAndValue into it.
                 atavs.add( atav );
@@ -679,8 +664,6 @@ public class Rdn implements Cloneable, C
         nbAtavs = 0;
         normName = "";
         upName = "";
-        start = -1;
-        length = 0;
         normalized.set( false );
     }
 
@@ -742,28 +725,6 @@ public class Rdn implements Cloneable, C
 
 
     /**
-     * Get the start position
-     *
-     * @return The start position in the Dn
-     */
-    public int getStart()
-    {
-        return start;
-    }
-
-
-    /**
-     * Get the Rdn length
-     *
-     * @return the Rdn length
-     */
-    public int getLength()
-    {
-        return length;
-    }
-
-
-    /**
      * Get the AttributeTypeAndValue which type is given as an argument. If we
      * have more than one value associated with the type, we will return only
      * the first one.
@@ -873,7 +834,7 @@ public class Rdn implements Cloneable, C
                 default:
                     // We must duplicate the treeSet and the hashMap
                     rdn.atavTypes = new MultiValueMap();
-                    rdn.atavs = new TreeSet<Ava>();
+                    rdn.atavs = new ArrayList<Ava>();
 
                     for ( Ava currentAtav : this.atavs )
                     {
@@ -905,7 +866,7 @@ public class Rdn implements Cloneable, C
      * @param rdn the Rdn to be compared
      * @return 0 if both RDNs are equals. -1 if the current Rdn is inferior, 1 if
      *         the current Rdn is superior, UNDEFINED otherwise.
-     */
+     *
     public int compareTo( Rdn rdn )
     {
         if ( rdn == null )
@@ -1020,7 +981,7 @@ public class Rdn implements Cloneable, C
                 return atav;
 
             default:
-                return ( ( TreeSet<Ava> ) atavs ).first().clone();
+                return atavs.get( 0 ).clone();
         }
     }
 
@@ -1041,7 +1002,7 @@ public class Rdn implements Cloneable, C
                 return atav.getUpType();
 
             default:
-                return ( ( TreeSet<Ava> ) atavs ).first().getUpType();
+                return atavs.get( 0 ).getUpType();
         }
     }
 
@@ -1062,7 +1023,7 @@ public class Rdn implements Cloneable, C
                 return atav.getNormType();
 
             default:
-                return ( ( TreeSet<Ava> ) atavs ).first().getNormType();
+                return atavs.get( 0 ).getNormType();
         }
     }
 
@@ -1083,7 +1044,7 @@ public class Rdn implements Cloneable, C
                 return atav.getUpValue();
 
             default:
-                return ( ( TreeSet<Ava> ) atavs ).first().getUpValue();
+                return atavs.get( 0 ).getUpValue();
         }
     }
 
@@ -1104,7 +1065,7 @@ public class Rdn implements Cloneable, C
                 return atav.getNormValue();
 
             default:
-                return ( ( TreeSet<Ava> ) atavs ).first().getNormValue();
+                return atavs.get( 0 ).getNormValue();
         }
     }
 
@@ -1119,19 +1080,71 @@ public class Rdn implements Cloneable, C
      *            Rdn to be compared for equality with this Rdn
      * @return true if the specified object is equal to this Rdn
      */
-    public boolean equals( Object rdn )
+    public boolean equals( Object that )
     {
-        if ( this == rdn )
+        if ( this == that )
         {
             return true;
         }
 
-        if ( !( rdn instanceof Rdn) )
+        if ( !( that instanceof Rdn) )
+        {
+            return false;
+        }
+        
+        Rdn rdn = (Rdn)that;
+
+        if ( rdn.nbAtavs != nbAtavs )
         {
+            // We don't have the same number of ATAVs. The Rdn which
+            // has the higher number of Atav is the one which is
+            // superior
             return false;
         }
 
-        return compareTo( (Rdn) rdn ) == EQUAL;
+        switch ( nbAtavs )
+        {
+            case 0:
+                return true;
+
+            case 1:
+                return atav.equals( rdn.atav );
+
+            default:
+                // We have more than one value. We will
+                // go through all of them.
+
+                // the types are already normalized and sorted in the atavs Map
+                // so we could compare the first element with all of the second
+                // Ava elemnts, etc.
+                Iterator<Ava> localIterator = atavs.iterator();
+
+                while ( localIterator.hasNext() )
+                {
+                    Iterator<Ava> paramIterator = rdn.atavs.iterator();
+
+                    Ava localAtav = localIterator.next();
+                    boolean equals = false;
+
+                    while ( paramIterator.hasNext() )
+                    {
+                        Ava paramAtav = paramIterator.next();
+                        
+                        if ( localAtav.equals( paramAtav ) )
+                        {
+                            equals = true;
+                            break;
+                        }
+                    }
+
+                    if ( equals == false )
+                    {
+                        return false;
+                    }
+                }
+
+                return true;
+        }
     }
 
 
@@ -1553,9 +1566,6 @@ public class Rdn implements Cloneable, C
             Unicode.writeUTF(out, normName);
         }
 
-        out.writeInt( start );
-        out.writeInt( length );
-
         switch ( nbAtavs )
         {
             case 0:
@@ -1602,9 +1612,6 @@ public class Rdn implements Cloneable, C
             normName = upName;
         }
 
-        start = in.readInt();
-        length = in.readInt();
-
         switch ( nbAtavs )
         {
             case 0:
@@ -1618,7 +1625,7 @@ public class Rdn implements Cloneable, C
                 break;
 
             default:
-                atavs = new TreeSet<Ava>();
+                atavs = new ArrayList<Ava>();
 
                 atavTypes = new MultiValueMap();
 

Modified: directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/RdnSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/RdnSerializer.java?rev=1073496&r1=1073495&r2=1073496&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/RdnSerializer.java
(original)
+++ directory/shared/branches/akarasulu/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/RdnSerializer.java
Tue Feb 22 20:56:22 2011
@@ -74,8 +74,6 @@ public final class RdnSerializer
         out.writeInt( rdn.getNbAtavs() );
         Unicode.writeUTF(out, rdn.getName());
         Unicode.writeUTF(out, rdn.getNormName());
-        out.writeInt( rdn.getStart() );
-        out.writeInt( rdn.getLength() );
         
         switch ( rdn.getNbAtavs() )
         {
@@ -124,12 +122,8 @@ public final class RdnSerializer
             normName = upName;
         }
         
-        // Read the Rdn's position and length
-        int start = in.readInt();
-        int length = in.readInt();
-        
         // Now creates the Rdn
-        Rdn rdn = new Rdn( length, start, upName, normName );
+        Rdn rdn = new Rdn( 0, 0, upName, normName );
 
         // Read through the Atavs
         switch ( nbAtavs )

Modified: directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java?rev=1073496&r1=1073495&r2=1073496&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java
(original)
+++ directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/message/ExtendedResponseImplTest.java
Tue Feb 22 20:56:22 2011
@@ -267,18 +267,4 @@ public class ExtendedResponseImplTest
         assertFalse( resp0.equals( resp1 ) );
         assertFalse( resp1.equals( resp0 ) );
     }
-
-
-    /**
-     * Tests inequality when responses are different.
-     */
-    @Test
-    public void testNotEqualsDiffResponses()
-    {
-        ExtendedResponseImpl resp0 = createStub();
-        ExtendedResponseImpl resp1 = createStub();
-
-        assertFalse( resp0.equals( resp1 ) );
-        assertFalse( resp1.equals( resp0 ) );
-    }
 }

Modified: directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/AvaTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/AvaTest.java?rev=1073496&r1=1073495&r2=1073496&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/AvaTest.java
(original)
+++ directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/AvaTest.java
Tue Feb 22 20:56:22 2011
@@ -20,26 +20,25 @@
 package org.apache.directory.shared.ldap.model.name;
 
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.apache.directory.shared.ldap.model.name.Ava;
-import org.apache.directory.shared.ldap.model.name.AvaSerializer;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test the class AttributeTypeAndValue
@@ -61,8 +60,6 @@ public class AvaTest
         Ava atav = new Ava();
         assertEquals( "", atav.toString() );
         assertEquals( "", atav.getUpName() );
-        assertEquals( -1, atav.getStart() );
-        assertEquals( 0, atav.getLength() );
     }
 
 
@@ -109,18 +106,22 @@ public class AvaTest
     public void testAttributeTypeAndValueValidType() throws LdapException
     {
         Ava atav = new Ava( "A", "a", (String)null, (String)null );
-        assertEquals( "a=", atav.toString() );
+        assertEquals( "A=", atav.toString() );
+        assertEquals( "a=", atav.getNormName() );
         assertEquals( "A=", atav.getUpName() );
         
         atav = new Ava( "  A  ", "a", (String)null, (String)null );
-        assertEquals( "a=", atav.toString() );
+        assertEquals( "a=", atav.getNormName() );
+        assertEquals( "  A  =", atav.toString() );
         assertEquals( "  A  =", atav.getUpName() );
         
         atav = new Ava( "  A  ", null, (String)null, (String)null );
-        assertEquals( "a=", atav.toString() );
+        assertEquals( "a=", atav.getNormName() );
+        assertEquals( "  A  =", atav.toString() );
         assertEquals( "  A  =", atav.getUpName() );
         
         atav = new Ava( null, "a", (String)null, (String)null );
+        assertEquals( "a=", atav.getNormName() );
         assertEquals( "a=", atav.toString() );
         assertEquals( "a=", atav.getUpName() );
         
@@ -153,8 +154,6 @@ public class AvaTest
         Ava atav = new Ava( "a", "a", "b", "b" );
         assertEquals( "a=b", atav.toString() );
         assertEquals( "a=b", atav.getUpName() );
-        assertEquals( 0, atav.getStart() );
-        assertEquals( 3, atav.getLength() );
     }
 
 
@@ -167,7 +166,7 @@ public class AvaTest
         Ava atav1 = new Ava( "a", "a","b", "b" );
         Ava atav2 = new Ava( "a", "a","b", "b" );
 
-        assertEquals( 0, atav1.compareTo( atav2 ) );
+        assertTrue( atav1.equals( atav2 ) );
     }
 
 
@@ -180,7 +179,7 @@ public class AvaTest
         Ava atav1 = new Ava( "a", "a", "b", "b" );
         Ava atav2 = new Ava( "A", "A", "b", "b" );
 
-        assertEquals( 0, atav1.compareTo( atav2 ) );
+        assertTrue( atav1.equals( atav2 ) );
     }
 
 
@@ -195,7 +194,7 @@ public class AvaTest
             
         Ava atav2 = new Ava( "a", "a", "b", "b" );
 
-        assertEquals( 1, atav1.compareTo( atav2 ) );
+        assertFalse( atav1.equals( atav2 ) );
     }
 
 
@@ -209,7 +208,7 @@ public class AvaTest
         Ava atav1 = new Ava( "a", "a", "b", "b" );
         Ava atav2 = new Ava( "b", "b", "b", "b" );
 
-        assertEquals( -1, atav1.compareTo( atav2 ) );
+        assertFalse( atav1.equals( atav2 ) );
     }
 
 
@@ -223,7 +222,7 @@ public class AvaTest
         Ava atav1 = new Ava( "a", "a", "b", "b" );
         Ava atav2 = new Ava( "a", "a", "a", "a" );
 
-        assertEquals( 1, atav1.compareTo( atav2 ) );
+        assertFalse( atav1.equals( atav2 ) );
     }
 
 
@@ -237,7 +236,7 @@ public class AvaTest
         Ava atav1 = new Ava( "a", "a", "a", "a" );
         Ava atav2 = new Ava( "a", "a", "b", "b" );
 
-        assertEquals( -1, atav1.compareTo( atav2 ) );
+        assertFalse( atav1.equals( atav2 ) );
     }
 
 

Modified: directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/RdnTest.java?rev=1073496&r1=1073495&r2=1073496&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/RdnTest.java
(original)
+++ directory/shared/branches/akarasulu/ldap-model/src/test/java/org/apache/directory/shared/ldap/model/name/RdnTest.java
Tue Feb 22 20:56:22 2011
@@ -33,17 +33,14 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Iterator;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.name.Ava;
-import org.apache.directory.shared.ldap.model.name.Rdn;
-import org.apache.directory.shared.ldap.model.name.RdnParser;
-import org.apache.directory.shared.ldap.model.name.RdnSerializer;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test the class Rdn
@@ -341,7 +338,7 @@ public class RdnTest
 
 
     /**
-     * Test the compareTo method for a Rdn.
+     * Test the equals method for a Rdn.
      * 
      * @throws LdapException
      */
@@ -350,7 +347,7 @@ public class RdnTest
     {
         Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
         Rdn rdn2 = null;
-        assertTrue( rdn1.compareTo( rdn2 ) > 0 );
+        assertFalse( rdn1.equals( rdn2 ) );
     }
 
 
@@ -364,7 +361,7 @@ public class RdnTest
     {
         Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
         Rdn rdn2 = new Rdn( " a = b " );
-        assertTrue( rdn1.compareTo( rdn2 ) > 0 );
+        assertFalse( rdn1.equals( rdn2 ) );
     }
 
 
@@ -379,7 +376,7 @@ public class RdnTest
         Rdn rdn1 = new Rdn( " a = b " );
         Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
 
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
+        assertFalse( rdn1.equals( rdn2 ) );
     }
 
 
@@ -394,7 +391,7 @@ public class RdnTest
         Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
         Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
 
-        assertEquals( 0, rdn1.compareTo( rdn2 ) );
+        assertTrue( rdn1.equals( rdn2 ) );
     }
 
 
@@ -409,7 +406,7 @@ public class RdnTest
         Rdn rdn1 = new Rdn( " a = b + a = f + g = h + c = d " );
         Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
 
-        assertEquals( 0, rdn1.compareTo( rdn2 ) );
+        assertTrue( rdn1.equals( rdn2 ) );
     }
 
 
@@ -424,9 +421,8 @@ public class RdnTest
         Rdn rdn1 = new Rdn( " a = f + g = h + c = d " );
         Rdn rdn2 = new Rdn( " c = d + a = h + g = h " );
 
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-        assertTrue( rdn2.compareTo( rdn1 ) > 0 );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
+        assertFalse( rdn1.equals( rdn2 ) );
+        assertFalse( rdn2.equals( rdn1 ) );
     }
 
 
@@ -442,23 +438,20 @@ public class RdnTest
         // the second ATAV differs
         Rdn rdn1 = new Rdn( " a = b + c = d " );
         Rdn rdn2 = new Rdn( " a = b + c = y " );
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-        assertTrue( rdn2.compareTo( rdn1 ) > 0 );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
+        assertFalse( rdn1.equals( rdn2 ) );
+        assertFalse( rdn2.equals( rdn1 ) );
 
         // the third ATAV differs
         Rdn rdn3 = new Rdn( " a = b + c = d + e = f " );
         Rdn rdn4 = new Rdn( " a = b + c = d + e = y " );
-        assertTrue( rdn3.compareTo( rdn4 ) < 0 );
-        assertTrue( rdn4.compareTo( rdn3 ) > 0 );
-        assertEquals( 0, rdn3.compareTo( rdn4 ) + rdn4.compareTo( rdn3 ) );
+        assertFalse( rdn3.equals( rdn4 ) );
+        assertFalse( rdn4.equals( rdn3 ) );
 
         // the second ATAV differs in value only
         Rdn rdn5 = new Rdn( " a = b + a = c " );
         Rdn rdn6 = new Rdn( " a = b + a = y " );
-        assertTrue( rdn5.compareTo( rdn6 ) < 0 );
-        assertTrue( rdn6.compareTo( rdn5 ) > 0 );
-        assertEquals( 0, rdn5.compareTo( rdn6 ) + rdn6.compareTo( rdn5 ) );
+        assertFalse( rdn5.equals( rdn6 ) );
+        assertFalse( rdn6.equals( rdn5 ) );
     }
 
 
@@ -474,25 +467,23 @@ public class RdnTest
     {
         Rdn rdn1 = new Rdn( " a = b + c = d " );
         Rdn rdn2 = new Rdn( " c = d + a = b " );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) );
+        assertTrue( rdn1.equals( rdn2 ) );
 
         rdn1 = new Rdn( " a = b + c = e " );
         rdn2 = new Rdn( " c = d + a = b " );
-        assertTrue( rdn1.compareTo( rdn2 ) > 0 );
-        assertTrue( rdn2.compareTo( rdn1 ) < 0 );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
+        assertFalse( rdn1.equals( rdn2 ) );
+        assertFalse( rdn2.equals( rdn1 ) );
 
         rdn1 = new Rdn( " a = b + c = d " );
         rdn2 = new Rdn( " e = f + g = h " );
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-        assertTrue( rdn2.compareTo( rdn1 ) > 0 );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
+        assertFalse( rdn1.equals( rdn2 ) );
+        assertFalse( rdn2.equals( rdn1 ) );
     }
 
 
     /**
      * Test for DIRSHARED-3.
-     * Tests that compareTo() is invertable for single-valued RDNs.
+     * Tests that equals() is invertable for single-valued RDNs.
      * 
      * @throws LdapException
      */
@@ -501,16 +492,15 @@ public class RdnTest
     {
         Rdn rdn1 = new Rdn( " a = b " );
         Rdn rdn2 = new Rdn( " a = c " );
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-        assertTrue( rdn2.compareTo( rdn1 ) > 0 );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
+        assertFalse( rdn1.equals( rdn2 ) );
+        assertFalse( rdn2.equals( rdn1 ) );
 
     }
 
 
     /**
      * Test for DIRSHARED-3.
-     * Tests that compareTo() is invertable for multi-valued RDNs with different values.
+     * Tests that equals() is invertable for multi-valued RDNs with different values.
      * 
      * @throws LdapException
      */
@@ -519,15 +509,14 @@ public class RdnTest
     {
         Rdn rdn1 = new Rdn( " a = b + a = c " );
         Rdn rdn2 = new Rdn( " a = b + a = y " );
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-        assertTrue( rdn2.compareTo( rdn1 ) > 0 );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
+        assertFalse( rdn1.equals( rdn2 ) );
+        assertFalse( rdn2.equals( rdn1 ) );
     }
 
 
     /**
      * Test for DIRSHARED-3.
-     * Tests that compareTo() is invertable for multi-valued RDNs with different types.
+     * Tests that equals() is invertable for multi-valued RDNs with different types.
      * 
      * @throws org.apache.directory.shared.ldap.model.exception.LdapException
      */
@@ -536,15 +525,14 @@ public class RdnTest
     {
         Rdn rdn1 = new Rdn( " a = b + c = d  " );
         Rdn rdn2 = new Rdn( " e = f + g = h " );
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-        assertTrue( rdn2.compareTo( rdn1 ) > 0 );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
+        assertFalse( rdn1.equals( rdn2 ) );
+        assertFalse( rdn2.equals( rdn1 ) );
     }
 
 
     /**
      * Test for DIRSHARED-3.
-     * Tests that compareTo() is invertable for multi-valued RDNs with different order.
+     * Tests that equals() is invertable for multi-valued RDNs with different order.
      * 
      * @throws LdapException
      */
@@ -553,9 +541,8 @@ public class RdnTest
     {
         Rdn rdn1 = new Rdn( " c = d + a = b " );
         Rdn rdn2 = new Rdn( " a = b + e = f " );
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-        assertTrue( rdn2.compareTo( rdn1 ) > 0 );
-        assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
+        assertFalse( rdn1.equals( rdn2 ) );
+        assertFalse( rdn2.equals( rdn1 ) );
     }
 
 
@@ -569,7 +556,7 @@ public class RdnTest
     {
         Rdn rdn1 = new Rdn( " a = b " );
 
-        assertEquals( 1, rdn1.compareTo( null ) );
+        assertFalse( rdn1.equals( null ) );
     }
 
 
@@ -584,7 +571,7 @@ public class RdnTest
         Rdn rdn1 = new Rdn( " a = b " );
         Rdn rdn2 = new Rdn( " a = b " );
 
-        assertEquals( 0, rdn1.compareTo( rdn2 ) );
+        assertTrue( rdn1.equals( rdn2 ) );
     }
 
 
@@ -599,8 +586,7 @@ public class RdnTest
         Rdn rdn1 = new Rdn( " a = b " );
         Rdn rdn2 = new Rdn( " A = b " );
 
-        assertEquals( 0, rdn1.compareTo( rdn2 ) );
-        assertEquals( true, rdn1.equals( rdn2 ) );
+        assertTrue( rdn1.equals( rdn2 ) );
     }
 
 
@@ -615,7 +601,7 @@ public class RdnTest
         Rdn rdn1 = new Rdn( " a = b " );
         Rdn rdn2 = new Rdn( " A = d " );
 
-        assertTrue( rdn1.compareTo( rdn2 ) < 0 );
+        assertFalse( rdn1.equals( rdn2 ) );
     }
 
 
@@ -1385,7 +1371,7 @@ public class RdnTest
 
 
     /**
-     * Tests the equals and compareTo results of cloned multi-valued RDNs.
+     * Tests the equals and equals results of cloned multi-valued RDNs.
      * Test for DIRSHARED-9.
      * 
      * @throws LdapException
@@ -1398,13 +1384,12 @@ public class RdnTest
         Rdn rdn = new Rdn( " A = b + C = d" );
         Rdn clonedRdn = (Rdn) rdn.clone();
 
-        assertEquals( 0, rdn.compareTo( clonedRdn ) );
-        assertEquals( true, rdn.equals( clonedRdn ) );
+        assertTrue( rdn.equals( clonedRdn ) );
     }
 
 
     /**
-     * Tests the equals and compareTo results of copy constructed multi-valued RDNs.
+     * Tests the equals and equals results of copy constructed multi-valued RDNs.
      * Test for DIRSHARED-9.
      * 
      * @throws LdapException
@@ -1417,8 +1402,7 @@ public class RdnTest
         Rdn rdn = new Rdn( " A = b + C = d" );
         Rdn copiedRdn = new Rdn( rdn );
 
-        assertEquals( 0, rdn.compareTo( copiedRdn ) );
-        assertEquals( true, rdn.equals( copiedRdn ) );
+        assertTrue( rdn.equals( copiedRdn ) );
     }
 
 

Propchange: directory/shared/branches/akarasulu/ldap-schema/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 22 20:56:22 2011
@@ -8,4 +8,4 @@
 /directory/shared/branches/shared-subtree/ldap-schema:965208-965686
 /directory/shared/branches/xdbm-refactoring/ldap-schema:945830-946347
 /directory/shared/branches-dnfactory-experiment/ldap-schema:980350-980351
-/directory/shared/trunk/ldap-schema:1066124-1067995,1068025-1072732
+/directory/shared/trunk/ldap-schema:1066124-1067995,1068025-1072732,1072810-1073487

Modified: directory/shared/branches/akarasulu/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemaloader/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemaloader/JarLdifSchemaLoader.java?rev=1073496&r1=1073495&r2=1073496&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemaloader/JarLdifSchemaLoader.java
(original)
+++ directory/shared/branches/akarasulu/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemaloader/JarLdifSchemaLoader.java
Tue Feb 22 20:56:22 2011
@@ -159,8 +159,8 @@ public class JarLdifSchemaLoader extends
      */
     private String getSchemaDirectoryString( Schema schema )
     {
-        return "schema" + File.separator + "ou=schema" + File.separator
-                        + "cn=" + Strings.lowerCase(schema.getSchemaName()) + File.separator;
+        return "schema" + "/" + "ou=schema" + "/"
+                        + "cn=" + Strings.lowerCase(schema.getSchemaName()) + "/";
     }
 
 
@@ -179,7 +179,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.COMPARATORS_PATH + File.separator + "m-oid=";
+                + SchemaConstants.COMPARATORS_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -215,7 +215,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.SYNTAX_CHECKERS_PATH + File.separator + "m-oid=";
+                + SchemaConstants.SYNTAX_CHECKERS_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -251,7 +251,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.NORMALIZERS_PATH + File.separator + "m-oid=";
+                + SchemaConstants.NORMALIZERS_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -287,7 +287,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.MATCHING_RULES_PATH + File.separator + "m-oid=";
+                + SchemaConstants.MATCHING_RULES_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -323,7 +323,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.SYNTAXES_PATH + File.separator + "m-oid=";
+                + SchemaConstants.SYNTAXES_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -360,7 +360,7 @@ public class JarLdifSchemaLoader extends
         {
             // check that the attributeTypes directory exists for the schema
             String start = getSchemaDirectoryString( schema )
-                    + SchemaConstants.ATTRIBUTES_TYPE_PATH + File.separator + "m-oid=";
+                    + SchemaConstants.ATTRIBUTES_TYPE_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
             
             // get list of attributeType LDIF schema files in attributeTypes
@@ -397,7 +397,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.MATCHING_RULE_USE_PATH + File.separator + "m-oid=";
+                + SchemaConstants.MATCHING_RULE_USE_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -433,7 +433,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.NAME_FORMS_PATH + File.separator + "m-oid=";
+                + SchemaConstants.NAME_FORMS_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -469,7 +469,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.DIT_CONTENT_RULES_PATH + File.separator + "m-oid=";
+                + SchemaConstants.DIT_CONTENT_RULES_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -505,7 +505,7 @@ public class JarLdifSchemaLoader extends
         for ( Schema schema : schemas )
         {
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.DIT_STRUCTURE_RULES_PATH + File.separator + "m-oid=";
+                + SchemaConstants.DIT_STRUCTURE_RULES_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )
@@ -542,7 +542,7 @@ public class JarLdifSchemaLoader extends
         {
             // get objectClasses directory, check if exists, return if not
             String start = getSchemaDirectoryString( schema )
-                + SchemaConstants.OBJECT_CLASSES_PATH + File.separator + "m-oid=";
+                + SchemaConstants.OBJECT_CLASSES_PATH + "/" + "m-oid=";
             String end = "." + LDIF_EXT;
 
             for ( String resourcePath : RESOURCE_MAP.keySet() )

Propchange: directory/shared/branches/akarasulu/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 22 20:56:22 2011
@@ -7,5 +7,5 @@
 /directory/shared/branches/shared-subtree/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:965208-965686
 /directory/shared/branches/xdbm-refactoring/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:945830-946347
 /directory/shared/branches-dnfactory-experiment/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:980350-980351
-/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl:1066124-1067995,1068025-1072732
+/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl:1066124-1067995,1068025-1072732,1072810-1073487
 /directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:806622-894844*

Propchange: directory/shared/branches/akarasulu/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 22 20:56:22 2011
@@ -7,5 +7,5 @@
 /directory/shared/branches/shared-subtree/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:965208-965686
 /directory/shared/branches/xdbm-refactoring/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:945830-946347
 /directory/shared/branches-dnfactory-experiment/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:980350-980351
-/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java:1066124-1067995,1068025-1072732
+/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java:1066124-1067995,1068025-1072732,1072810-1073487
 /directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:806622-894844



Mime
View raw message