You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2005/09/12 22:52:27 UTC
svn commit: r280419 - in /directory:
apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/
apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/
apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/
apacheds/trunk...
Author: akarasulu
Date: Mon Sep 12 13:52:12 2005
New Revision: 280419
URL: http://svn.apache.org/viewcvs?rev=280419&view=rev
Log:
changes ...
o fixed problem with test case in ExceptionServiceTest that used existing g
attribute in Modify operation with add op but was rejected thanks to new
checks for this
o fixed getPrefix() and getSuffix() issues where they were reversed as filed
in the following jira issue but Trustin in DIREVE-248 here:
http://issues.apache.org/jira/browse/DIREVE-248
Modified:
directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java
directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java
directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java
directory/apacheds/trunk/core/src/test/org/apache/ldap/server/exception/ExceptionServiceTest.java
directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java
directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/util/NamespaceTools.java
directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/exception/ExceptionService.java Mon Sep 12 13:52:12 2005
@@ -82,13 +82,13 @@
throw ne;
}
- Name parentDn = normName.getSuffix( 1 );
+ Name parentDn = normName.getPrefix( 1 );
// check if we don't have the parent to add to
assertHasEntry( nextInterceptor, "Attempt to add under non-existant parent: ", parentDn );
// check if we're trying to add to a parent that is an alias
- Attributes attrs = nextInterceptor.lookup( normName.getSuffix( 1 ) );
+ Attributes attrs = nextInterceptor.lookup( normName.getPrefix( 1 ) );
Attribute objectClass = attrs.get( "objectClass" );
if ( objectClass.contains( "alias" ) )
{
@@ -252,7 +252,7 @@
assertHasEntry( nextInterceptor, msg, dn );
// check to see if target entry exists
- Name target = dn.getSuffix( 1 ).add( newRn );
+ Name target = dn.getPrefix( 1 ).add( newRn );
if ( nextInterceptor.hasEntry( target ) )
{
LdapNameAlreadyBoundException e = null;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java Mon Sep 12 13:52:12 2005
@@ -454,9 +454,9 @@
throw new LdapNoPermissionException( "can't rename the rootDSE" );
}
- Name oldBase = oldName.getSuffix( 1 );
+ Name oldBase = oldName.getPrefix( 1 );
- Name newBase = newName.getSuffix( 1 );
+ Name newBase = newName.getPrefix( 1 );
String newRdn = newName.get( newName.size() - 1 );
@@ -493,7 +493,7 @@
}
else
{
- Name parent = newDn.getSuffix( 1 );
+ Name parent = newDn.getPrefix( 1 );
if ( newRdn.equalsIgnoreCase( oldRdn ) )
{
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java Mon Sep 12 13:52:12 2005
@@ -173,7 +173,7 @@
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- Name newDn = name.getSuffix( 1 ).add( newRn );
+ Name newDn = name.getPrefix( 1 ).add( newRn );
nexus.modify( newDn, DirContext.REPLACE_ATTRIBUTE, attributes );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java Mon Sep 12 13:52:12 2005
@@ -417,7 +417,7 @@
return dn;
}
- dn = dn.getSuffix( 1 );
+ dn = dn.getPrefix( 1 );
}
return dn;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java Mon Sep 12 13:52:12 2005
@@ -609,7 +609,7 @@
String targetDn = ( String ) aliasIdx.reverseLookup( aliasId );
BigInteger targetId = getEntryId( targetDn );
String aliasDn = getEntryDn( aliasId );
- Name ancestorDn = new LdapName( aliasDn ).getSuffix( 1 );
+ Name ancestorDn = new LdapName( aliasDn ).getPrefix( 1 );
BigInteger ancestorId = getEntryId( ancestorDn.toString() );
/*
@@ -628,7 +628,7 @@
while ( ! ancestorDn.equals( upSuffix ) )
{
- ancestorDn = ancestorDn.getSuffix( 1 );
+ ancestorDn = ancestorDn.getPrefix( 1 );
ancestorId = getEntryId( ancestorDn.toString() );
subAliasIdx.drop( ancestorId, targetId );
@@ -749,7 +749,7 @@
* index. If the target is not a sibling of the alias then we add the
* index entry maping the parent's id to the aliased target id.
*/
- ancestorDn = aliasDn.getSuffix( 1 );
+ ancestorDn = aliasDn.getPrefix( 1 );
ancestorId = getEntryId( ancestorDn.toString() );
if ( ! NamespaceTools.isSibling( targetDn, aliasDn ) )
@@ -774,7 +774,7 @@
subAliasIdx.add( ancestorId, targetId );
}
- ancestorDn = ancestorDn.getSuffix( 1 );
+ ancestorDn = ancestorDn.getPrefix( 1 );
ancestorId = getEntryId( ancestorDn.toString() );
}
}
@@ -799,13 +799,13 @@
}
else
{
- parentId = getEntryId( dn.getSuffix( 1 ).toString() );
+ parentId = getEntryId( dn.getPrefix( 1 ).toString() );
}
// don't keep going if we cannot find the parent Id
if ( parentId == null )
{
- throw new LdapNameNotFoundException( "Id for parent '" + dn.getSuffix( 1 ).toString() + "' not found!" );
+ throw new LdapNameNotFoundException( "Id for parent '" + dn.getPrefix( 1 ).toString() + "' not found!" );
}
Attribute objectClass = entry.get( "objectClass" );
@@ -1576,7 +1576,7 @@
* Start droping index tuples with the first ancestor right above the
* moved base. This is the first ancestor effected by the move.
*/
- Name ancestorDn = movedBase.getSuffix( 1 );
+ Name ancestorDn = movedBase.getPrefix( 1 );
BigInteger ancestorId = getEntryId( ancestorDn.toString() );
/*
@@ -1600,7 +1600,7 @@
while ( ! ancestorDn.equals( upSuffix ) )
{
- ancestorDn = ancestorDn.getSuffix( 1 );
+ ancestorDn = ancestorDn.getPrefix( 1 );
ancestorId = getEntryId( ancestorDn.toString() );
subAliasIdx.drop( ancestorId, targetId );
Modified: directory/apacheds/trunk/core/src/test/org/apache/ldap/server/exception/ExceptionServiceTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/test/org/apache/ldap/server/exception/ExceptionServiceTest.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/org/apache/ldap/server/exception/ExceptionServiceTest.java (original)
+++ directory/apacheds/trunk/core/src/test/org/apache/ldap/server/exception/ExceptionServiceTest.java Mon Sep 12 13:52:12 2005
@@ -295,7 +295,6 @@
{
Attributes attrs = new BasicAttributes( true );
Attribute attr = new BasicAttribute( "ou" );
- attr.add( "users" );
attr.add( "dummyValue" );
attrs.put( attr );
sysRoot.modifyAttributes( "ou=users", DirContext.ADD_ATTRIBUTE, attrs );
@@ -303,6 +302,7 @@
assertTrue( ou.contains( "users" ) );
assertTrue( ou.contains( "dummyValue" ) );
+ attr = new BasicAttribute( "ou" );
attr.add( "another" );
ModificationItem[] mods = new ModificationItem[] {
new ModificationItem( DirContext.ADD_ATTRIBUTE, attr )
Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java (original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java Mon Sep 12 13:52:12 2005
@@ -309,7 +309,7 @@
/**
- * Creates a name whose components consist of a prefix of the components of
+ * Creates a name whose components consist of a suffix of the components of
* this name. Subsequent changes to this name will not affect the name that
* is returned and vice versa.
*
@@ -321,7 +321,7 @@
* @throws ArrayIndexOutOfBoundsException
* if posn is outside the specified range
*/
- public Name getPrefix( int a_posn )
+ public Name getSuffix( int a_posn )
{
ArrayList list = new ArrayList();
list.addAll( m_list.subList( size() - a_posn, size() ) );
@@ -330,7 +330,7 @@
/**
- * Creates a name whose components consist of a suffix of the
+ * Creates a name whose components consist of a prefix of the
* components in this name. Subsequent changes to
* this name do not affect the name that is returned and vice versa.
*
@@ -343,7 +343,7 @@
* @throws IndexOutOfBoundsException
* if posn is outside the specified range
*/
- public Name getSuffix( int a_posn )
+ public Name getPrefix( int a_posn )
{
ArrayList list = new ArrayList();
list.addAll( m_list.subList( a_posn, m_list.size() ) );
Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/util/NamespaceTools.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/util/NamespaceTools.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/util/NamespaceTools.java (original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/util/NamespaceTools.java Mon Sep 12 13:52:12 2005
@@ -389,7 +389,7 @@
{
if ( a_name1.size() == a_name2.size() )
{
- return a_name2.startsWith( a_name1.getSuffix( 1 ) ) ;
+ return a_name2.startsWith( a_name1.getPrefix( 1 ) ) ;
}
return false ;
Modified: directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java?rev=280419&r1=280418&r2=280419&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java (original)
+++ directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java Mon Sep 12 13:52:12 2005
@@ -533,44 +533,44 @@
/**
- * Class to test for getPrefix
+ * Class to test for getSuffix
* @throws Exception anything goes wrong
*/
- public void testGetPrefix()
+ public void testGetXSuffix()
throws Exception
{
Name l_name =
m_parser.parse( "cn=HomeDir,cn=John,ou=Marketing,ou=East" ) ;
- assertEquals( "", l_name.getPrefix( 0 ).toString() ) ;
- assertEquals( "ou=East", l_name.getPrefix( 1 ).toString() ) ;
+ assertEquals( "", l_name.getSuffix( 0 ).toString() ) ;
+ assertEquals( "ou=East", l_name.getSuffix( 1 ).toString() ) ;
assertEquals( "ou=Marketing,ou=East",
- l_name.getPrefix( 2 ).toString() ) ;
+ l_name.getSuffix( 2 ).toString() ) ;
assertEquals( "cn=John,ou=Marketing,ou=East",
- l_name.getPrefix( 3 ).toString() ) ;
+ l_name.getSuffix( 3 ).toString() ) ;
assertEquals( "cn=HomeDir,cn=John,ou=Marketing,ou=East",
- l_name.getPrefix( 4 ).toString() ) ;
+ l_name.getSuffix( 4 ).toString() ) ;
}
/**
- * Class to test for getSuffix
+ * Class to test for getPrefix
* @throws Exception anything goes wrong
*/
- public void testGetSuffix()
+ public void testGetPrefix()
throws Exception
{
Name l_name =
m_parser.parse( "cn=HomeDir,cn=John,ou=Marketing,ou=East" ) ;
assertEquals( "cn=HomeDir,cn=John,ou=Marketing,ou=East",
- l_name.getSuffix( 0 ).toString() ) ;
+ l_name.getPrefix( 0 ).toString() ) ;
assertEquals( "cn=John,ou=Marketing,ou=East",
- l_name.getSuffix( 1 ).toString() ) ;
+ l_name.getPrefix( 1 ).toString() ) ;
assertEquals( "ou=Marketing,ou=East",
- l_name.getSuffix( 2 ).toString() ) ;
+ l_name.getPrefix( 2 ).toString() ) ;
assertEquals( "ou=East",
- l_name.getSuffix( 3 ).toString() ) ;
+ l_name.getPrefix( 3 ).toString() ) ;
assertEquals( "",
- l_name.getSuffix( 4 ).toString() ) ;
+ l_name.getPrefix( 4 ).toString() ) ;
}