directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r655663 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/name/ test/java/org/apache/directory/shared/ldap/name/
Date Mon, 12 May 2008 22:03:09 GMT
Author: elecharny
Date: Mon May 12 15:03:09 2008
New Revision: 655663

URL: http://svn.apache.org/viewvc?rev=655663&view=rev
Log:
o Removed some formating errors
o Added some @version tags
o Added a test for DIRSHARED-3 (the test is not complete)
o Added some javadoc.
o Found a big bug in the RDN deserialization (DIRSHARED-4)

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java?rev=655663&r1=655662&r2=655663&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java
Mon May 12 15:03:09 2008
@@ -60,6 +60,10 @@
      * <li>upValue</li> The User Provided value.
      * <li>valueLength</li>
      * <li>value</li> The normalized value.
+     *
+     * @param atav the AttributeTypeAndValue to serialize
+     * @param out the OutputStream in which the atav will be serialized
+     * @throws IOException If we can't serialize the atav
      */
     public static void serialize( AttributeTypeAndValue atav, ObjectOutput out ) throws IOException
     {
@@ -139,8 +143,12 @@
      * We read back the data to create a new ATAV. The structure 
      * read is exposed in the {@link AttributeTypeAndValue#writeExternal(ObjectOutput)} 
      * method<p>
+     * 
+     * @param in the input stream
+     * @throws IOException If the input stream can't be read
+     * @return The constructed AttributeTypeAndValue
      */
-    public static AttributeTypeAndValue deserialize( ObjectInput in ) throws IOException,
ClassNotFoundException
+    public static AttributeTypeAndValue deserialize( ObjectInput in ) throws IOException
     {
         String upName = in.readUTF();
         int start = in.readInt();
@@ -163,11 +171,11 @@
         {
             int upValueLength = in.readInt();
             byte[] upValue = new byte[upValueLength];
-            in.readFully( (byte[])upValue );
+            in.readFully( upValue );
 
             int valueLength = in.readInt();
             byte[] normValue = new byte[valueLength];
-            in.readFully( (byte[])normValue );
+            in.readFully( normValue );
 
             AttributeTypeAndValue atav = 
                 new AttributeTypeAndValue( upType, normType, upValue, normValue, start, length,
upName );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java?rev=655663&r1=655662&r2=655663&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
Mon May 12 15:03:09 2008
@@ -172,10 +172,13 @@
    /** CompareTo() results */
    public static final int UNDEFINED = Integer.MAX_VALUE;
 
+   /** Constant used in comparisons */
    public static final int SUPERIOR = 1;
 
+   /** Constant used in comparisons */
    public static final int INFERIOR = -1;
 
+   /** Constant used in comparisons */
    public static final int EQUALS = 0;
 
 
@@ -225,20 +228,17 @@
    /**
     * A constructor that constructs a RDN from a type and a value. Constructs
     * an Rdn from the given attribute type and value. The string attribute
-    * values are not interpretted as RFC 2253 formatted RDN strings. That is,
-    * the values are used literally (not parsed) and assumed to be unescaped.
+    * values are not interpreted as RFC 2253 formatted RDN strings. That is,
+    * the values are used literally (not parsed) and assumed to be un-escaped.
     *
-    * @param type
-    *            The type of the RDN
-    * @param value
-    *            The value of the RDN
-    * @throws InvalidNameException
-    *             If the RDN is invalid
+    * @param upType The user provided type of the RDN
+    * @param upValue The user provided value of the RDN
+    * @param normType The normalized provided type of the RDN
+    * @param normValue The normalized provided value of the RDN
+    * @throws InvalidNameException If the RDN is invalid
     */
    public Rdn( String upType, String normType, String upValue, String normValue ) throws
InvalidNameException
    {
-       super();
-
        addAttributeTypeAndValue( upType, normType, upValue, normValue );
 
        upName = upType + '=' + upValue;
@@ -252,10 +252,10 @@
    /**
     * A constructor that constructs a RDN from a type and a value. Constructs
     * an Rdn from the given attribute type and value. The string attribute
-    * values are not interpretted as RFC 2253 formatted RDN strings. That is,
+    * values are not interpreted as RFC 2253 formatted RDN strings. That is,
     * the values are used literally (not parsed) and assumed to be unescaped.
     *
-    * @param type
+    * @param start 
     *            The type of the RDN
     * @param value
     *            The value of the RDN
@@ -281,7 +281,6 @@
    @SuppressWarnings({"unchecked"})
    public Rdn( Rdn rdn )
    {
-       super();
        nbAtavs = rdn.getNbAtavs();
        this.normName = rdn.normName;
        this.upName = rdn.getUpName();
@@ -299,17 +298,16 @@
 
            default:
                // We must duplicate the treeSet and the hashMap
-               Iterator<AttributeTypeAndValue> iter = rdn.atavs.iterator();
-
                atavs = new TreeSet<AttributeTypeAndValue>();
                atavTypes = new MultiHashMap();
 
-               while ( iter.hasNext() )
+               for ( AttributeTypeAndValue currentAtav:rdn.atavs )
                {
-                   AttributeTypeAndValue currentAtav = iter.next();
                    atavs.add( (AttributeTypeAndValue)currentAtav.clone() );
                    atavTypes.put( currentAtav.getUpType(), currentAtav );
                }
+               
+               return;
        }
    }
 
@@ -374,18 +372,19 @@
    /**
     * Add a AttributeTypeAndValue to the current RDN
     *
-    * @param type
-    *            The type of the added RDN.
-    * @param value
-    *            The value of the added RDN
+    * @param upType The user provided type of the added RDN.
+    * @param type The normalized provided type of the added RDN.
+    * @param upValue The user provided value of the added RDN
+    * @param value The normalized provided value of the added RDN
     * @throws InvalidNameException
     *             If the RDN is invalid
     */
-   // WARNING : The protection level is left unspecified intentionnaly.
+   // WARNING : The protection level is left unspecified intentionally.
    // We need this method to be visible from the DnParser class, but not
    // from outside this package.
    @SuppressWarnings({"unchecked"})
-   /* Unspecified protection */void addAttributeTypeAndValue( String upType, String type,
Object upValue, Object value ) throws InvalidNameException
+   /* Unspecified protection */void addAttributeTypeAndValue( String upType, String type,
Object upValue, Object value ) 
+       throws InvalidNameException
    {
        // First, let's normalize the type
        String normalizedType = StringTools.lowerCaseAscii(type);
@@ -727,12 +726,12 @@
 
    /**
     * Compares two RDNs. They are equals if : 
-    * - their have the same number of NC (AttributeTypeAndValue) 
-    * - each ATAVs are equals 
-    * - comparizon of type are done case insensitive 
-    * - each value is equel, case sensitive 
-    * - Order of ATAV is not important If the RDNs are not equals, a positive number is
-    * returned if the first RDN is greated, negative otherwise
+    * <li>their have the same number of NC (AttributeTypeAndValue) 
+    * <li>each ATAVs are equals 
+    * <li>comparison of type are done case insensitive 
+    * <li>each value is equal, case sensitive 
+    * <li>Order of ATAV is not important If the RDNs are not equals, a positive number
is
+    * returned if the first RDN is greater, negative otherwise
     *
     * @param object
     * @return 0 if both rdn are equals. -1 if the current RDN is inferior, 1 if
@@ -775,53 +774,29 @@
 
                        if ( rdn.atavTypes.containsKey( type ) )
                        {
-                           List atavLocalList = ( List ) atavTypes.get( type );
-                           List atavParamList = ( List ) rdn.atavTypes.get( type );
+                           List<AttributeTypeAndValue> atavLocalList = ( List<AttributeTypeAndValue>
) atavTypes.get( type );
+                           List<AttributeTypeAndValue> atavParamList = ( List<AttributeTypeAndValue>
) rdn.atavTypes.get( type );
 
-                           if ( atavLocalList.size() == 1 )
-                           {
-                               // We have only one ATAV
-                               AttributeTypeAndValue atavLocal = ( AttributeTypeAndValue
) atavLocalList.get( 0 );
-                               AttributeTypeAndValue atavParam = ( AttributeTypeAndValue
) atavParamList.get( 0 );
-
-                               // If the ATAVs are different we are finished.
-                               // It the ATAVs are equal we must compare the remaining ATAVs,
too. 
-                               int result = atavLocal.compareTo( atavParam );
-                               if ( result != 0 )
-                               {
-                                   return result;
-                               }
-                           }
-                           else
+                           // We have to verify that each value of the
+                           // first list are present in
+                           // the second list
+                           for ( AttributeTypeAndValue atavLocal:atavLocalList )
                            {
-                               // We have to verify that each value of the
-                               // first list are present in
-                               // the second list
-                               Iterator<AttributeTypeAndValue> atavLocals = atavLocalList.iterator();
+                               boolean found = false;
 
-                               while ( atavLocals.hasNext() )
+                               for ( AttributeTypeAndValue atavParam:atavParamList )
                                {
-                                   AttributeTypeAndValue atavLocal = atavLocals.next();
-
-                                   Iterator<AttributeTypeAndValue> atavParams = atavParamList.iterator();
-                                   boolean found = false;
-
-                                   while ( atavParams.hasNext() )
+                                   if ( atavLocal.compareTo( atavParam ) == EQUALS )
                                    {
-                                       AttributeTypeAndValue atavParam = atavParams.next();
-
-                                       if ( atavLocal.compareTo( atavParam ) == EQUALS )
-                                       {
-                                           found = true;
-                                           break;
-                                       }
+                                       found = true;
+                                       break;
                                    }
+                               }
 
-                                   if ( !found )
-                                   {
-                                       // The ATAV does not exist in the second RDN
-                                       return SUPERIOR;
-                                   }
+                               if ( !found )
+                               {
+                                   // The ATAV does not exist in the second RDN
+                                   return SUPERIOR;
                                }
                            }
                        }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java?rev=655663&r1=655662&r2=655663&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
Mon May 12 15:03:09 2008
@@ -86,6 +86,7 @@
         out.flush();
     }
     
+    
     /**
      * Deserialize a RDN instance
      * 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java?rev=655663&r1=655662&r2=655663&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
Mon May 12 15:03:09 2008
@@ -29,18 +29,19 @@
 import javax.naming.InvalidNameException;
 import javax.naming.NamingException;
 
-import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
 import org.apache.directory.shared.ldap.util.StringTools;
-import org.junit.Test;
+
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import org.junit.Test;
 
 
 /**
  * Test the class AttributeTypeAndValue
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$, 
  */
 public class AttributeTypeAndValueTest
 {

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java?rev=655663&r1=655662&r2=655663&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
Mon May 12 15:03:09 2008
@@ -31,7 +31,7 @@
  * Testcase devised specifically for DIRSERVER-584.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
+ * @version $Rev$, $Date$, 
  * @see <a href="https://issues.apache.org/jira/browse/DIRSERVER-584">DIRSERVER-584</a>
  */
 public class DnParserDIRSERVER_584_Test extends TestCase

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?rev=655663&r1=655662&r2=655663&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Mon May 12 15:03:09 2008
@@ -61,6 +61,7 @@
  * Test the class LdapDN
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$, 
  */
 public class LdapDNTest
 {

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java?rev=655663&r1=655662&r2=655663&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
Mon May 12 15:03:09 2008
@@ -27,8 +27,6 @@
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.LdapDnParser;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -36,6 +34,7 @@
  * Test the class LdapDN
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$, 
  */
 public class LdapDnParserTest extends TestCase
 {

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java?rev=655663&r1=655662&r2=655663&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
Mon May 12 15:03:09 2008
@@ -32,22 +32,22 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 
-import org.apache.directory.shared.ldap.name.Rdn;
-import org.apache.directory.shared.ldap.name.RdnParser;
 import org.apache.directory.shared.ldap.util.StringTools;
 
-import org.junit.Test;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.junit.Test;
+
 
 /**
  * Test the class Rdn
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$, 
  */
 public class RdnTest
 {
@@ -65,6 +65,8 @@
 
     /**
      * test an empty RDN
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnEmpty() throws InvalidNameException
@@ -75,6 +77,8 @@
 
     /**
      * test a simple RDN : a = b
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnSimple() throws InvalidNameException
@@ -85,6 +89,8 @@
 
     /**
      * test a composite RDN : a = b, d = e
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnComposite() throws InvalidNameException
@@ -96,6 +102,8 @@
     /**
      * test a composite RDN with or without spaces: a=b, a =b, a= b, a = b, a =
      * b
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnCompositeWithSpace() throws InvalidNameException
@@ -121,6 +129,8 @@
 
     /**
      * test a simple RDN with differents separators : a = b + c = d
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnSimpleMultivaluedAttribute() throws InvalidNameException
@@ -133,6 +143,8 @@
     /**
      * test a composite RDN with differents separators : a=b+c=d, e=f + g=h +
      * i=j
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnCompositeMultivaluedAttribute() throws InvalidNameException
@@ -150,6 +162,8 @@
 
     /**
      * test a simple RDN with an oid prefix (uppercase) : OID.12.34.56 = azerty
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnOidUpper() throws InvalidNameException
@@ -160,6 +174,8 @@
 
     /**
      * test a simple RDN with an oid prefix (lowercase) : oid.12.34.56 = azerty
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnOidLower() throws InvalidNameException
@@ -171,6 +187,8 @@
     /**
      * test a simple RDN with an oid attribut wiithout oid prefix : 12.34.56 =
      * azerty
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnOidWithoutPrefix() throws InvalidNameException
@@ -182,6 +200,8 @@
     /**
      * test a composite RDN with an oid attribut wiithout oid prefix : 12.34.56 =
      * azerty; 7.8 = test
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnCompositeOidWithoutPrefix() throws InvalidNameException
@@ -193,6 +213,8 @@
 
     /**
      * test a simple RDN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C3\A9"
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnPairCharAttributeValue() throws InvalidNameException
@@ -216,6 +238,8 @@
 
     /**
      * test a simple RDN with quoted attribute value : a = "quoted \"value"
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRdnQuotedAttributeValue() throws InvalidNameException
@@ -228,7 +252,7 @@
      * Test the clone method for a RDN.
      */
     @Test
-    public void testParseRDNNull() throws InvalidNameException
+    public void testParseRDNNull()
     {
         Rdn rdn = null;
 
@@ -246,6 +270,8 @@
 
     /**
      * Test the clone method for a RDN.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCloningOneNameComponent() throws InvalidNameException
@@ -262,6 +288,8 @@
 
     /**
      * Test the clone method for a RDN.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCloningTwoNameComponent() throws InvalidNameException
@@ -281,6 +309,8 @@
 
     /**
      * Test the compareTo method for a RDN.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNull() throws InvalidNameException
@@ -293,6 +323,8 @@
 
     /**
      * Compares a composite NC to a single NC.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNCS2NC() throws InvalidNameException
@@ -305,6 +337,8 @@
 
     /**
      * Compares a single NC to a composite NC.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNC2NCS() throws InvalidNameException
@@ -318,6 +352,8 @@
 
     /**
      * Compares a composite NCS to a composite NCS in the same order.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNCS2NCSOrdered() throws InvalidNameException
@@ -331,6 +367,8 @@
 
     /**
      * Compares a composite NCS to a composite NCS in a different order.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNCS2NCSUnordered() throws InvalidNameException
@@ -344,6 +382,8 @@
 
     /**
      * Compares a composite NCS to a different composite NCS.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNCS2NCSNotEquals() throws InvalidNameException
@@ -351,13 +391,16 @@
         Rdn rdn1 = new Rdn( " a = f + g = h + c = d " );
         Rdn rdn2 = new Rdn( " c = d + a = h + g = h " );
 
-        assertEquals( -1, rdn1.compareTo( rdn2 ) );
+        assertEquals( 1, rdn1.compareTo( rdn2 ) );
+        assertEquals( 1, rdn2.compareTo( rdn1 ) );
     }
 
 
     /**
      * Test for DIRSHARED-2.
      * The first ATAV is equal, the second or following ATAV differs.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void test_DIRSHARED_2() throws InvalidNameException
@@ -378,8 +421,37 @@
         assertTrue( rdn5.compareTo( rdn6 ) != 0 );
     }
     
+
+    /**
+     * Test for DIRSHARED-3.
+     * The compare operation should return a correct value (1 or -1)
+     * depending on the ATAVs, not on their position.
+     * 
+     * @throws InvalidNameException
+     */
+    @Test
+    public void test_DIRSHARED_3() throws InvalidNameException
+    {
+        Rdn rdn1 = new Rdn( " a = b + c = d " );
+        Rdn rdn2 = new Rdn( " c = d + a = b " );
+        assertEquals( 0, rdn1.compareTo( rdn2 ) );
+
+        rdn1 = new Rdn( " a = b + c = e " );
+        rdn2 = new Rdn( " c = d + a = b " );
+        assertEquals( 1, rdn1.compareTo( rdn2 ) );
+        assertEquals( 1, rdn2.compareTo( rdn1 ) );
+
+        rdn1 = new Rdn( " a = b + c = d " );
+        rdn2 = new Rdn( " e = f + g = h " );
+        assertEquals( 1, rdn1.compareTo( rdn2 ) );
+        assertEquals( 1, rdn2.compareTo( rdn1 ) );
+
+    }
+    
     /**
      * Compares with a null RDN.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNullRdn() throws InvalidNameException
@@ -392,6 +464,8 @@
 
     /**
      * Compares with a bad object
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToBadObject() throws InvalidNameException
@@ -404,6 +478,8 @@
 
     /**
      * Compares a simple NC to a simple NC.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNC2NC() throws InvalidNameException
@@ -417,6 +493,8 @@
 
     /**
      * Compares a simple NC to a simple NC in UperCase.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNC2NCUperCase() throws InvalidNameException
@@ -431,6 +509,8 @@
 
     /**
      * Compares a simple NC to a different simple NC.
+     * 
+     * @throws InvalidNameException
      */
     @Test
     public void testRDNCompareToNC2NCNotEquals() throws InvalidNameException
@@ -442,6 +522,13 @@
     }
 
 
+    /**
+     * 
+     * test the ToAttributes method.
+     *
+     * @throws InvalidNameException
+     * @throws NamingException
+     */
     @Test
     public void testToAttributes() throws InvalidNameException, NamingException
     {
@@ -471,6 +558,12 @@
     }
 
 
+    /**
+     * 
+     * Test the getValue method.
+     *
+     * @throws InvalidNameException
+     */
     @Test
     public void testGetValue() throws InvalidNameException
     {
@@ -480,6 +573,12 @@
     }
 
 
+    /**
+     * 
+     * Test the getType method.
+     *
+     * @throws InvalidNameException
+     */
     @Test
     public void testGetType() throws InvalidNameException
     {
@@ -489,6 +588,11 @@
     }
 
 
+    /**
+     * Test the getSize method.
+     *
+     * @throws InvalidNameException
+     */
     @Test
     public void testGetSize() throws InvalidNameException
     {
@@ -498,6 +602,10 @@
     }
 
 
+    /**
+     * Test the getSize method.
+     *
+     */
     @Test
     public void testGetSize0()
     {
@@ -507,6 +615,11 @@
     }
 
 
+    /**
+     * Test the equals method
+     *
+     * @throws InvalidNameException
+     */
     @Test
     public void testEquals() throws InvalidNameException
     {
@@ -640,7 +753,7 @@
 
 
     @Test
-    public void testEmptyIterator() throws InvalidNameException
+    public void testEmptyIterator()
     {
         Rdn rdn = new Rdn();
         Iterator<AttributeTypeAndValue> iterator = rdn.iterator();
@@ -692,7 +805,7 @@
 
 
     @Test
-    public void testEscapedAttributeValue() throws InvalidNameException
+    public void testEscapedAttributeValue()
     {
         // space doesn't need to be escaped in the middle of a string
         assertEquals( "a b", Rdn.escapeValue( "a b" ) );
@@ -749,7 +862,7 @@
 
 
     @Test
-    public void testNullRdnSerialization() throws NamingException, IOException, ClassNotFoundException
+    public void testNullRdnSerialization() throws IOException, ClassNotFoundException
     {
         Rdn rdn = new Rdn();
 
@@ -958,7 +1071,7 @@
 
 
     @Test
-    public void testNullRdnStaticSerialization() throws NamingException, IOException, ClassNotFoundException
+    public void testNullRdnStaticSerialization() throws IOException, ClassNotFoundException
     {
         Rdn rdn = new Rdn();
 



Mime
View raw message