directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1071976 - in /directory/shared/branches/m1: integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
Date Fri, 18 Feb 2011 12:13:06 GMT
Author: elecharny
Date: Fri Feb 18 12:13:06 2011
New Revision: 1071976

URL: http://svn.apache.org/viewvc?rev=1071976&view=rev
Log:
o Renamed the hasSuffic(Dn) method to hasDescendant(Dn)
o Improved the Javadoc

Modified:
    directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java
    directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java

Modified: directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java?rev=1071976&r1=1071975&r2=1071976&view=diff
==============================================================================
--- directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java
(original)
+++ directory/shared/branches/m1/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java
Fri Feb 18 12:13:06 2011
@@ -1135,7 +1135,7 @@ public class DnTest
     public void testDnEndsWithNull() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( true, dn.hasSuffix( (Dn) null ) );
+        assertEquals( true, dn.isDescendantOf( (Dn) null ) );
     }
 
 
@@ -1146,7 +1146,7 @@ public class DnTest
     public void testDnEndsWithEmpty() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( true, dn.hasSuffix( new Dn() ) );
+        assertEquals( true, dn.hasDescendant( new Dn() ) );
     }
 
 
@@ -1157,7 +1157,7 @@ public class DnTest
     public void testDnEndsWithSimple() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( true, dn.hasSuffix( new Dn( "a=b" ) ) );
+        assertEquals( true, dn.hasDescendant( new Dn( "a=b" ) ) );
     }
 
 
@@ -1168,7 +1168,7 @@ public class DnTest
     public void testDnEndsWithComplex() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( true, dn.hasSuffix( new Dn( "a =  b, c =  d" ) ) );
+        assertEquals( true, dn.hasDescendant( new Dn( "a =  b, c =  d" ) ) );
     }
 
 
@@ -1179,7 +1179,7 @@ public class DnTest
     public void testDnEndsWithComplexMixedCase() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( false, dn.hasSuffix( new Dn( "a =  B, C =  d" ) ) );
+        assertEquals( false, dn.hasDescendant( new Dn( "a =  B, C =  d" ) ) );
     }
 
 
@@ -1190,7 +1190,7 @@ public class DnTest
     public void testDnEndsWithFull() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( true, dn.hasSuffix( new Dn( "a=  b; c =  d, e =  f" ) ) );
+        assertEquals( true, dn.hasDescendant( new Dn( "a=  b; c =  d, e =  f" ) ) );
     }
 
 
@@ -1201,7 +1201,7 @@ public class DnTest
     public void testDnEndsWithWrong() throws LdapException
     {
         Dn dn = new Dn( "a=b, c=d,e = f" );
-        assertEquals( false, dn.hasSuffix( new Dn( "a =  b, e =  f" ) ) );
+        assertEquals( false, dn.hasDescendant( new Dn( "a =  b, e =  f" ) ) );
     }
 
 
@@ -2012,15 +2012,15 @@ public class DnTest
         Dn name7 = new Dn( "cn=HomeDir,cn=John" );
         Dn name8 = new Dn( "cn=HomeDir,cn=John,ou=Marketing" );
 
-        assertTrue( name0.hasSuffix( name1 ) );
-        assertTrue( !name0.hasSuffix( name2 ) );
-        assertTrue( !name0.hasSuffix( name3 ) );
-        assertTrue( !name0.hasSuffix( name4 ) );
-        assertTrue( name0.hasSuffix( name5 ) );
-
-        assertTrue( name0.hasSuffix( name6 ) );
-        assertTrue( name0.hasSuffix( name7 ) );
-        assertTrue( name0.hasSuffix( name8 ) );
+        assertTrue( name0.hasDescendant( name1 ) );
+        assertTrue( !name0.hasDescendant( name2 ) );
+        assertTrue( !name0.hasDescendant( name3 ) );
+        assertTrue( !name0.hasDescendant( name4 ) );
+        assertTrue( name0.hasDescendant( name5 ) );
+
+        assertTrue( name0.hasDescendant( name6 ) );
+        assertTrue( name0.hasDescendant( name7 ) );
+        assertTrue( name0.hasDescendant( name8 ) );
     }
 
 
@@ -2569,19 +2569,19 @@ public class DnTest
         Dn n2 = new Dn( "cn=two" );
         Dn n1 = new Dn( "cn=one" );
 
-        assertTrue( n3210.hasSuffix( n3 ) );
-        assertTrue( n3210.hasSuffix( n32 ) );
-        assertTrue( n3210.hasSuffix( n321 ) );
-        assertTrue( n3210.hasSuffix( n3210 ) );
-
-        assertTrue( n210.hasSuffix( n2 ) );
-        assertTrue( n210.hasSuffix( n21 ) );
-        assertTrue( n210.hasSuffix( n210 ) );
+        assertTrue( n3210.hasDescendant( n3 ) );
+        assertTrue( n3210.hasDescendant( n32 ) );
+        assertTrue( n3210.hasDescendant( n321 ) );
+        assertTrue( n3210.hasDescendant( n3210 ) );
+
+        assertTrue( n210.hasDescendant( n2 ) );
+        assertTrue( n210.hasDescendant( n21 ) );
+        assertTrue( n210.hasDescendant( n210 ) );
 
-        assertTrue( n10.hasSuffix( n1 ) );
-        assertTrue( n10.hasSuffix( n10 ) );
+        assertTrue( n10.hasDescendant( n1 ) );
+        assertTrue( n10.hasDescendant( n10 ) );
 
-        assertTrue( n0.hasSuffix( n0 ) );
+        assertTrue( n0.hasDescendant( n0 ) );
     }
 
 

Modified: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1071976&r1=1071975&r2=1071976&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
(original)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
Fri Feb 18 12:13:06 2011
@@ -843,7 +843,7 @@ public final class Dn implements Iterabl
 
     /**
      * Tells if the current Dn is a parent of another Dn.<br>
-     * For instance, <b>dc=com</b> is a parent
+     * For instance, <b>dc=com</b> is a ancestor
      * of <b>dc=example, dc=com</b>
      *
      * @param dn The child
@@ -864,7 +864,7 @@ public final class Dn implements Iterabl
 
     /**
      * Tells if the current Dn is a parent of another Dn.<br>
-     * For instance, <b>dc=com</b> is a parent
+     * For instance, <b>dc=com</b> is a ancestor 
      * of <b>dc=example, dc=com</b>
      *
      * @param dn The child
@@ -883,7 +883,7 @@ public final class Dn implements Iterabl
 
     /**
      * Tells if a Dn is a child of another Dn.<br>
-     * For instance, <b>dc=example, dc=com</b> is a child
+     * For instance, <b>dc=example, dc=com</b> is a descendant
      * of <b>dc=com</b>
      *
      * @param dn The parent
@@ -904,7 +904,7 @@ public final class Dn implements Iterabl
 
     /**
      * Tells if a Dn is a child of another Dn.<br>
-     * For instance, <b>dc=example, dc=apache, dc=com</b> is a child
+     * For instance, <b>dc=example, dc=apache, dc=com</b> is a descendant
      * of <b>dc=com</b>
      *
      * @param dn The parent
@@ -942,17 +942,17 @@ public final class Dn implements Iterabl
 
 
     /**
-     * Determines whether this name has a specific suffix. A name
-     * <tt>name</tt> has a Dn as a suffix if its right part contains the given
Dn
-     *
-     * Be aware that for a specific
-     * Dn like : <b>cn=xxx, ou=yyy</b> the hasSuffix method will return false
with
+     * Determines whether this name has a specific descendant. A name
+     * <tt>name</tt> has a Dn as a decendant if its left part contains the given
Dn.
+     *<br/>
+     * For instance, for a Dn like : <b>cn=xxx, ou=yyy</b> the 
+     * hasDescendnat method will return false with
      * <b>ou=yyy</b>, and true with <b>cn=xxx</b>
      *
      * @param dn the name to check
      * @return true if <tt>dn</tt> is a suffix of this name, false otherwise
      */
-    public boolean hasSuffix( Dn dn )
+    public boolean hasDescendant( Dn dn )
     {
         if ( dn == null )
         {



Mime
View raw message