directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r953083 - /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
Date Wed, 09 Jun 2010 17:15:17 GMT
Author: elecharny
Date: Wed Jun  9 17:15:16 2010
New Revision: 953083

URL: http://svn.apache.org/viewvc?rev=953083&view=rev
Log:
Added tests for DN.isParentOf() and isChildOf()

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java?rev=953083&r1=953082&r2=953083&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
Wed Jun  9 17:15:16 2010
@@ -3659,4 +3659,36 @@ public class DNTest
         
         assertEquals( 3, count );
     }
+    
+    
+    @Test
+    public void testIsParentOfTrue() throws Exception
+    {
+        DN dn = new DN( "ou=example, dc=apache, dc=org" );
+        DN parent1 = new DN( "ou=example,dc=apache, dc=org" );
+        DN parent2 = new DN( "dc=apache, dc=org" );
+        DN parent3 = new DN( "dc=org" );
+        DN notParent = new DN( "ou=example,dc=apache, dc=com" );
+        
+        assertTrue( parent1.isParentOf( dn ) );
+        assertTrue( parent2.isParentOf( dn ) );
+        assertTrue( parent3.isParentOf( dn ) );
+        assertFalse( notParent.isParentOf( dn ) );
+    }
+    
+    
+    @Test
+    public void testIsChildOfTrue() throws Exception
+    {
+        DN dn = new DN( "ou=example, dc=apache, dc=org" );
+        DN parent1 = new DN( "ou=example,dc=apache, dc=org" );
+        DN parent2 = new DN( "dc=apache, dc=org" );
+        DN parent3 = new DN( "dc=org" );
+        DN notParent = new DN( "dc=apache, dc=com" );
+        
+        assertTrue( dn.isChildOf( parent1 ) );
+        assertTrue( dn.isChildOf( parent2 ) );
+        assertTrue( dn.isChildOf( parent3 ) );
+        assertFalse( notParent.isChildOf( dn ) );
+    }
 }



Mime
View raw message