You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/01/04 19:12:57 UTC
svn commit: r1055125 - in /directory:
apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/subtree/
apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/
shared/branches/shared-AP/...
Author: elecharny
Date: Tue Jan 4 18:12:56 2011
New Revision: 1055125
URL: http://svn.apache.org/viewvc?rev=1055125&view=rev
Log:
o Fixed a ugly bug in the IAP/SAP chain handling
o Added a method in DnNode to get the parent which has an element
o Added some helper methods in AbstractSubentryUnitTest
Modified:
directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/subtree/AbstractSubentryUnitTest.java
directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
directory/shared/branches/shared-AP/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnNode.java
Modified: directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/subtree/AbstractSubentryUnitTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/subtree/AbstractSubentryUnitTest.java?rev=1055125&r1=1055124&r2=1055125&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/subtree/AbstractSubentryUnitTest.java (original)
+++ directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/subtree/AbstractSubentryUnitTest.java Tue Jan 4 18:12:56 2011
@@ -142,6 +142,17 @@ public class AbstractSubentryUnitTest ex
assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
}
+
+ /**
+ * Create an entry using the admin connection
+ */
+ protected void createEntryAdmin( Entry entry ) throws LdapException
+ {
+ AddResponse response = adminConnection.add( entry );
+
+ assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+ }
+
// ---- AC methods -------------------------------------------------------------------
Modified: directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1055125&r1=1055124&r2=1055125&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Tue Jan 4 18:12:56 2011
@@ -749,7 +749,8 @@ public class SubentryInterceptor extends
}
// Go down one level
- apNode = apNode.getParentWithElement( apNode.getDn() );
+ apNode = apNode.getParentWithElement();
+ adminPoint = apNode.getElement();
} while ( !sapFound );
// If we have updated the entry, create the list of modifications to apply
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=1055125&r1=1055124&r2=1055125&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 Tue Jan 4 18:12:56 2011
@@ -830,6 +830,34 @@ public class DnNode<N> implements Clonea
/**
+ * Get the closest Node for a given DN which has an element, if present in the tree.<br>
+ * For instance, if we have stored dc=acme, dc=org into the tree,
+ * the DN: ou=example, dc=acme, dc=org will have a parent, and
+ * dc=acme, dc=org will be returned if it has an associated element.
+ * <br>For the DN ou=apache, dc=org, there is no parent, so null will be returned.
+ *
+ * @param dn the normalized distinguished name to resolve to a parent
+ * @return the Node associated with the normalized dn
+ */
+ public DnNode<N> getParentWithElement()
+ {
+ DnNode<N> currentNode = parent;
+
+ while ( currentNode != null )
+ {
+ if ( currentNode.nodeElement != null )
+ {
+ return currentNode;
+ }
+
+ currentNode = currentNode.parent;
+ }
+
+ return null;
+ }
+
+
+ /**
* rename the DnNode's DN
*
* @param newRdn the new RDN of this node