directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1053085 - in /directory/shared/branches/shared-AP/ldap/src: main/java/org/apache/directory/shared/ldap/util/tree/DnNode.java test/java/org/apache/directory/shared/ldap/util/tree/TestDnNode.java
Date Mon, 27 Dec 2010 15:24:18 GMT
Author: elecharny
Date: Mon Dec 27 15:24:17 2010
New Revision: 1053085

URL: http://svn.apache.org/viewvc?rev=1053085&view=rev
Log:
Modified the getParentWithElement() method to return the node contaning an element instead
of just returning the element.

Modified:
    directory/shared/branches/shared-AP/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnNode.java
    directory/shared/branches/shared-AP/ldap/src/test/java/org/apache/directory/shared/ldap/util/tree/TestDnNode.java

Modified: directory/shared/branches/shared-AP/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-AP/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnNode.java?rev=1053085&r1=1053084&r2=1053085&view=diff
==============================================================================
--- directory/shared/branches/shared-AP/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnNode.java
(original)
+++ directory/shared/branches/shared-AP/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnNode.java
Mon Dec 27 15:24:17 2010
@@ -791,12 +791,12 @@ public class DnNode<N> implements Clonea
      * @param dn the normalized distinguished name to resolve to a parent
      * @return the Node associated with the normalized dn
      */
-    public N getParentWithElement( DN dn )
+    public DnNode<N> getParentWithElement( DN dn )
     {
         List<RDN> rdns = dn.getRdns();
 
         DnNode<N> currentNode = this;
-        N element = null;
+        DnNode<N> element = null;
 
         // Iterate through all the RDN until we find the associated partition
         for ( int i = rdns.size() - 1; i >= 1; i-- )
@@ -814,7 +814,7 @@ public class DnNode<N> implements Clonea
 
                 if ( currentNode.hasElement() )
                 {
-                    element = currentNode.getElement();
+                    element = currentNode;
                 }
 
                 parent = currentNode;

Modified: directory/shared/branches/shared-AP/ldap/src/test/java/org/apache/directory/shared/ldap/util/tree/TestDnNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-AP/ldap/src/test/java/org/apache/directory/shared/ldap/util/tree/TestDnNode.java?rev=1053085&r1=1053084&r2=1053085&view=diff
==============================================================================
--- directory/shared/branches/shared-AP/ldap/src/test/java/org/apache/directory/shared/ldap/util/tree/TestDnNode.java
(original)
+++ directory/shared/branches/shared-AP/ldap/src/test/java/org/apache/directory/shared/ldap/util/tree/TestDnNode.java
Mon Dec 27 15:24:17 2010
@@ -833,9 +833,9 @@ public class TestDnNode
         dnLookupTree.add( org, org );
         
         assertTrue( dnLookupTree.hasParentElement( apache ) );
-        assertEquals( org, dnLookupTree.getParentWithElement( dn1 ) );
-        assertEquals( org, dnLookupTree.getParentWithElement( apache ) );
-        assertEquals( dn1, dnLookupTree.getParentWithElement( test ) );
+        assertEquals( org, dnLookupTree.getParentWithElement( dn1 ).getElement() );
+        assertEquals( org, dnLookupTree.getParentWithElement( apache ).getElement() );
+        assertEquals( dn1, dnLookupTree.getParentWithElement( test ).getElement() );
         assertNull( dnLookupTree.getParentWithElement( org ) );
     }
 }



Mime
View raw message