directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414035 [7/8] - in /directory/trunks/apacheds: ./ core-plugin/ core-shared/ core-unit/ core-unit/src/main/java/org/apache/directory/server/core/unit/ core-unit/src/test/java/org/apache/directory/server/core/ core-unit/src/test/java/org/apac...
Date Wed, 14 Jun 2006 03:22:12 GMT
Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Tue Jun 13 20:22:05 2006
@@ -21,7 +21,6 @@
 
 import java.util.*;
 
-import javax.naming.Name;
 import javax.naming.NamingException;
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
@@ -35,15 +34,13 @@
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.DirectoryServiceListener;
-import org.apache.directory.server.core.authz.support.MaxImmSubFilter;
-import org.apache.directory.server.core.authz.support.OperationScope;
 import org.apache.directory.server.core.jndi.DeadContext;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -57,8 +54,8 @@
     private static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList() );
     private static final Set EMPTY_SET = Collections.unmodifiableSet( new HashSet() );
 
-    private static final Name ROOTDSE_NAME = new LdapName();
-    private static final Name ENTRY_NAME;
+    private static final LdapDN ROOTDSE_NAME = new LdapDN();
+    private static final LdapDN ENTRY_NAME;
     private static final Collection PROTECTED_ITEMS = new ArrayList();
     private static final Attributes ENTRY = new BasicAttributes();
 
@@ -66,7 +63,7 @@
     {
         try
         {
-            ENTRY_NAME = new LdapName( "ou=test, ou=system" );
+            ENTRY_NAME = new LdapDN( "ou=test, ou=system" );
         }
         catch ( NamingException e )
         {
@@ -154,15 +151,15 @@
         }
 
 
-        public NamingEnumeration search( Name base, Map env, ExprNode filter, SearchControls searchCtls )
+        public NamingEnumeration search( LdapDN base, Map env, ExprNode filter, SearchControls searchCtls )
             throws NamingException
         {
             return new BogusEnumeration( count );
         }
 
 
-        public NamingEnumeration search( Name base, Map env, ExprNode filter, SearchControls searchCtls,
-            Collection bypass ) throws NamingException
+        public NamingEnumeration search( LdapDN base, Map env, ExprNode filter, SearchControls searchCtls,
+                                         Collection bypass ) throws NamingException
         {
             return new BogusEnumeration( count );
         }

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java Tue Jun 13 20:22:05 2006
@@ -25,11 +25,9 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.naming.Name;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
@@ -47,8 +45,8 @@
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
 import org.apache.directory.shared.ldap.aci.ProtectedItem.MaxValueCountItem;
 import org.apache.directory.shared.ldap.aci.ProtectedItem.RestrictedByItem;
-import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -62,8 +60,8 @@
     private static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList() );
     private static final Set EMPTY_SET = Collections.unmodifiableSet( new HashSet() );
 
-    private static final Name GROUP_NAME;
-    private static final Name USER_NAME;
+    private static final LdapDN GROUP_NAME;
+    private static final LdapDN USER_NAME;
     private static final Set USER_NAMES = new HashSet();
     private static final Set GROUP_NAMES = new HashSet();
 
@@ -78,14 +76,14 @@
     {
         try
         {
-            GROUP_NAME = new LdapName( "ou=test,ou=groups,ou=system" );
-            USER_NAME = new LdapName( "ou=test, ou=users, ou=system" );
+            GROUP_NAME = new LdapDN( "ou=test,ou=groups,ou=system" );
+            USER_NAME = new LdapDN( "ou=test, ou=users, ou=system" );
 
             filterA = new RelatedProtectedItemFilter( new RefinementEvaluator( new RefinementLeafEvaluator(
-                OID_REGISTRY ) ), new ExpressionEvaluator( OID_REGISTRY, ATTR_TYPE_REGISTRY_A ) );
+                OID_REGISTRY ) ), new ExpressionEvaluator( OID_REGISTRY, ATTR_TYPE_REGISTRY_A ), OID_REGISTRY, ATTR_TYPE_REGISTRY_A );
 
             filterB = new RelatedProtectedItemFilter( new RefinementEvaluator( new RefinementLeafEvaluator(
-                OID_REGISTRY ) ), new ExpressionEvaluator( OID_REGISTRY, ATTR_TYPE_REGISTRY_B ) );
+                OID_REGISTRY ) ), new ExpressionEvaluator( OID_REGISTRY, ATTR_TYPE_REGISTRY_B ), OID_REGISTRY, ATTR_TYPE_REGISTRY_B );
         }
         catch ( NamingException e )
         {
@@ -109,7 +107,7 @@
         Collection tuples = getTuples( ProtectedItem.ENTRY );
 
         Assert.assertEquals( 1, filterA.filter( tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.NONE, null, null, null, null, null ).size() );
+            AuthenticationLevel.NONE, null, "ou", null, null, null ).size() );
     }
 
 
@@ -266,19 +264,23 @@
     }
 
 
+    /* this test requires a real registry with real values or the dummy registry
+     * needs to be altered to contain some usable mock data.  This is a result of
+     * using the registry now in this operation.    
     public void testRangeOfValues() throws Exception
     {
-        Attributes entry = new BasicAttributes();
+        Attributes entry = new BasicAttributes( true );
         entry.put( "attrA", "valueA" );
         Collection tuples = getTuples( new ProtectedItem.RangeOfValues( new PresenceNode( "attrA" ) ) );
 
         Assert.assertEquals( 1, filterA.filter( tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null,
-            new LdapName( "ou=testEntry" ), null, null, entry, null ).size() );
+            new LdapDN( "ou=testEntry" ), null, null, entry, null ).size() );
 
         entry.remove( "attrA" );
         Assert.assertEquals( 0, filterA.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, new LdapName( "ou=testEntry" ), null, null, entry, null ).size() );
+            null, null, new LdapDN( "ou=testEntry" ), null, null, entry, null ).size() );
     }
+    */
 
 
     public void testRestrictedBy() throws Exception
@@ -310,8 +312,8 @@
         attrTypes.add( "attrA" );
         Collection tuples = getTuples( new ProtectedItem.SelfValue( attrTypes ) );
 
-        Attributes entry = new BasicAttributes();
-        entry.put( "attrA", USER_NAME );
+        Attributes entry = new LockableAttributesImpl();
+        entry.put( "attrA", USER_NAME.toNormName() );
 
         // Test wrong scope
         Assert.assertEquals( 0, filterA.filter( tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java Tue Jun 13 20:22:05 2006
@@ -25,7 +25,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.naming.Name;
 import javax.naming.NamingException;
 
 import junit.framework.Assert;
@@ -37,7 +36,7 @@
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
 import org.apache.directory.shared.ldap.aci.UserClass;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -51,8 +50,8 @@
     private static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList() );
     private static final Set EMPTY_SET = Collections.unmodifiableSet( new HashSet() );
 
-    private static final Name GROUP_NAME;
-    private static final Name USER_NAME;
+    private static final LdapDN GROUP_NAME;
+    private static final LdapDN USER_NAME;
     private static final Set USER_NAMES = new HashSet();
     private static final Set GROUP_NAMES = new HashSet();
 
@@ -64,8 +63,8 @@
     {
         try
         {
-            GROUP_NAME = new LdapName( "ou=test,ou=groups,ou=system" );
-            USER_NAME = new LdapName( "ou=test, ou=users, ou=system" );
+            GROUP_NAME = new LdapDN( "ou=test,ou=groups,ou=system" );
+            USER_NAME = new LdapDN( "ou=test, ou=users, ou=system" );
         }
         catch ( NamingException e )
         {
@@ -100,7 +99,7 @@
         Assert.assertEquals( 1, filter.filter( tuples, OperationScope.ENTRY, null, null, USER_NAME, null,
             AuthenticationLevel.NONE, USER_NAME, null, null, null, null ).size() );
         Assert.assertEquals( 0, filter.filter( tuples, OperationScope.ENTRY, null, null, USER_NAME, null,
-            AuthenticationLevel.NONE, new LdapName( "ou=unrelated" ), null, null, null, null ).size() );
+            AuthenticationLevel.NONE, new LdapDN( "ou=unrelated" ), null, null, null, null ).size() );
     }
 
 
@@ -110,7 +109,7 @@
         Assert.assertEquals( 1, filter.filter( tuples, OperationScope.ENTRY, null, null, USER_NAME, null,
             AuthenticationLevel.NONE, null, null, null, null, null ).size() );
         Assert.assertEquals( 0, filter.filter( tuples, OperationScope.ENTRY, null, null,
-            new LdapName( "ou=unrelateduser, ou=users" ), null, AuthenticationLevel.NONE, USER_NAME, null, null, null,
+            new LdapDN( "ou=unrelateduser, ou=users" ), null, AuthenticationLevel.NONE, USER_NAME, null, null, null,
             null ).size() );
     }
 
@@ -122,7 +121,7 @@
             AuthenticationLevel.NONE, null, null, null, null, null ).size() );
 
         Set wrongGroupNames = new HashSet();
-        wrongGroupNames.add( new LdapName( "ou=unrelatedgroup" ) );
+        wrongGroupNames.add( new LdapDN( "ou=unrelatedgroup" ) );
 
         Assert.assertEquals( 0, filter.filter( tuples, OperationScope.ENTRY, null, wrongGroupNames, USER_NAME, null,
             AuthenticationLevel.NONE, USER_NAME, null, null, null, null ).size() );
@@ -185,7 +184,7 @@
             Set names = new HashSet();
             try
             {
-                names.add( new LdapName( "dummy=dummy" ) );
+                names.add( new LdapDN( "dummy=dummy" ) );
             }
             catch ( NamingException e )
             {

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Tue Jun 13 20:22:05 2006
@@ -25,20 +25,14 @@
 import org.apache.directory.server.core.configuration.DirectoryPartitionConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
-import org.apache.directory.server.core.interceptor.Interceptor;
-import org.apache.directory.server.core.interceptor.InterceptorChain;
-import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.DeadContext;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.name.LdapName;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.NamingException;
-import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.Context;
 import javax.naming.directory.Attributes;
@@ -58,7 +52,6 @@
     private final MockInterceptor[] interceptorArray =
         { new MockInterceptor( "0" ), new MockInterceptor( "1" ), new MockInterceptor( "2" ),
             new MockInterceptor( "3" ), new MockInterceptor( "4" ) };
-    //    private final static Logger log = LoggerFactory.getLogger( InterceptorChainTest.class );
     private InterceptorChain chain;
     private List interceptors = new ArrayList( interceptorArray.length );
 
@@ -86,7 +79,7 @@
 
     public void testNoBypass() throws NamingException
     {
-        Name dn = new LdapName( "ou=system" );
+        LdapDN dn = new LdapDN( "ou=system" );
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         DirectoryPartitionNexusProxy proxy = new DirectoryPartitionNexusProxy( ctx, ds );
@@ -112,7 +105,7 @@
 
     public void testSingleBypass() throws NamingException
     {
-        Name dn = new LdapName( "ou=system" );
+        LdapDN dn = new LdapDN( "ou=system" );
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         DirectoryPartitionNexusProxy proxy = new DirectoryPartitionNexusProxy( ctx, ds );
@@ -142,7 +135,7 @@
 
     public void testAdjacentDoubleBypass() throws NamingException
     {
-        Name dn = new LdapName( "ou=system" );
+        LdapDN dn = new LdapDN( "ou=system" );
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         DirectoryPartitionNexusProxy proxy = new DirectoryPartitionNexusProxy( ctx, ds );
@@ -176,7 +169,7 @@
 
     public void testFrontAndBackDoubleBypass() throws NamingException
     {
-        Name dn = new LdapName( "ou=system" );
+        LdapDN dn = new LdapDN( "ou=system" );
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         DirectoryPartitionNexusProxy proxy = new DirectoryPartitionNexusProxy( ctx, ds );
@@ -206,7 +199,7 @@
 
     public void testDoubleBypass() throws NamingException
     {
-        Name dn = new LdapName( "ou=system" );
+        LdapDN dn = new LdapDN( "ou=system" );
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         DirectoryPartitionNexusProxy proxy = new DirectoryPartitionNexusProxy( ctx, ds );
@@ -236,7 +229,7 @@
 
     public void testCompleteBypass() throws NamingException
     {
-        Name dn = new LdapName( "ou=system" );
+        LdapDN dn = new LdapDN( "ou=system" );
         Context ctx = new DeadContext();
         DirectoryService ds = new MockDirectoryService();
         DirectoryPartitionNexusProxy proxy = new DirectoryPartitionNexusProxy( ctx, ds );
@@ -290,24 +283,24 @@
         }
 
 
-        public Name getMatchedName( NextInterceptor next, Name name, boolean normalized ) throws NamingException
+        public LdapDN getMatchedName ( NextInterceptor next, LdapDN name ) throws NamingException
         {
             interceptors.add( this );
-            return next.getMatchedName( name, normalized );
+            return next.getMatchedName( name );
         }
 
 
-        public Name getSuffix( NextInterceptor next, Name name, boolean normalized ) throws NamingException
+        public LdapDN getSuffix ( NextInterceptor next, LdapDN name ) throws NamingException
         {
             interceptors.add( this );
-            return next.getSuffix( name, normalized );
+            return next.getSuffix( name );
         }
 
 
-        public Iterator listSuffixes( NextInterceptor next, boolean normalized ) throws NamingException
+        public Iterator listSuffixes ( NextInterceptor next ) throws NamingException
         {
             interceptors.add( this );
-            return next.listSuffixes( normalized );
+            return next.listSuffixes();
         }
 
 
@@ -319,57 +312,57 @@
         }
 
 
-        public void removeContextPartition( NextInterceptor next, Name suffix ) throws NamingException
+        public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
         {
             interceptors.add( this );
             next.removeContextPartition( suffix );
         }
 
 
-        public boolean compare( NextInterceptor next, Name name, String oid, Object value ) throws NamingException
+        public boolean compare( NextInterceptor next, LdapDN name, String oid, Object value ) throws NamingException
         {
             interceptors.add( this );
             return next.compare( name, oid, value );
         }
 
 
-        public void delete( NextInterceptor next, Name name ) throws NamingException
+        public void delete( NextInterceptor next, LdapDN name ) throws NamingException
         {
             interceptors.add( this );
             next.delete( name );
         }
 
 
-        public void add( NextInterceptor next, String userProvidedName, Name normalizedName, Attributes entry )
+        public void add(NextInterceptor next, LdapDN name, Attributes entry)
             throws NamingException
         {
             interceptors.add( this );
-            next.add( userProvidedName, normalizedName, entry );
+            next.add(name, entry );
         }
 
 
-        public void modify( NextInterceptor next, Name name, int modOp, Attributes attributes ) throws NamingException
+        public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes attributes ) throws NamingException
         {
             interceptors.add( this );
             next.modify( name, modOp, attributes );
         }
 
 
-        public void modify( NextInterceptor next, Name name, ModificationItem[] items ) throws NamingException
+        public void modify( NextInterceptor next, LdapDN name, ModificationItem[] items ) throws NamingException
         {
             interceptors.add( this );
             next.modify( name, items );
         }
 
 
-        public NamingEnumeration list( NextInterceptor next, Name baseName ) throws NamingException
+        public NamingEnumeration list( NextInterceptor next, LdapDN baseName ) throws NamingException
         {
             interceptors.add( this );
             return next.list( baseName );
         }
 
 
-        public NamingEnumeration search( NextInterceptor next, Name baseName, Map environment, ExprNode filter,
+        public NamingEnumeration search( NextInterceptor next, LdapDN baseName, Map environment, ExprNode filter,
             SearchControls searchControls ) throws NamingException
         {
             interceptors.add( this );
@@ -377,35 +370,35 @@
         }
 
 
-        public Attributes lookup( NextInterceptor next, Name name ) throws NamingException
+        public Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException
         {
             interceptors.add( this );
             return next.lookup( name );
         }
 
 
-        public Attributes lookup( NextInterceptor next, Name dn, String[] attrIds ) throws NamingException
+        public Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException
         {
             interceptors.add( this );
             return next.lookup( dn, attrIds );
         }
 
 
-        public boolean hasEntry( NextInterceptor next, Name name ) throws NamingException
+        public boolean hasEntry( NextInterceptor next, LdapDN name ) throws NamingException
         {
             interceptors.add( this );
             return next.hasEntry( name );
         }
 
 
-        public boolean isSuffix( NextInterceptor next, Name name ) throws NamingException
+        public boolean isSuffix( NextInterceptor next, LdapDN name ) throws NamingException
         {
             interceptors.add( this );
             return next.isSuffix( name );
         }
 
 
-        public void modifyRn( NextInterceptor next, Name name, String newRn, boolean deleteOldRn )
+        public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn )
             throws NamingException
         {
             interceptors.add( this );
@@ -413,14 +406,14 @@
         }
 
 
-        public void move( NextInterceptor next, Name oldName, Name newParentName ) throws NamingException
+        public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName ) throws NamingException
         {
             interceptors.add( this );
             next.move( oldName, newParentName );
         }
 
 
-        public void move( NextInterceptor next, Name oldName, Name newParentName, String newRn, boolean deleteOldRn )
+        public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName, String newRn, boolean deleteOldRn )
             throws NamingException
         {
             interceptors.add( this );
@@ -428,7 +421,7 @@
         }
 
 
-        public void bind( NextInterceptor next, Name bindDn, byte[] credentials, List mechanisms, String saslAuthId )
+        public void bind( NextInterceptor next, LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId )
             throws NamingException
         {
             interceptors.add( this );
@@ -436,7 +429,7 @@
         }
 
 
-        public void unbind( NextInterceptor next, Name bindDn ) throws NamingException
+        public void unbind( NextInterceptor next, LdapDN bindDn ) throws NamingException
         {
             interceptors.add( this );
             next.unbind( bindDn );

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/prefs/PreferencesUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/prefs/PreferencesUtilsTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/prefs/PreferencesUtilsTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/prefs/PreferencesUtilsTest.java Tue Jun 13 20:22:05 2006
@@ -17,10 +17,10 @@
 package org.apache.directory.server.core.prefs;
 
 
-import javax.naming.Name;
 import javax.naming.NamingException;
 
 import org.apache.directory.server.core.prefs.PreferencesUtils;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import junit.framework.TestCase;
 
@@ -45,35 +45,35 @@
 
         String test = "/org/apache/kerberos/";
 
-        Name dn = PreferencesUtils.toSysDn( test );
+        LdapDN dn = ( LdapDN ) PreferencesUtils.toSysDn( test );
 
-        assertEquals( dn.toString(), "prefNodeName=kerberos,prefNodeName=apache,prefNodeName=org,"
+        assertEquals( dn.toUpName(), "prefNodeName=kerberos,prefNodeName=apache,prefNodeName=org,"
             + PreferencesUtils.SYSPREF_BASE );
 
         // simple test without trailing '/'
 
         test = "/org/apache/kerberos";
 
-        dn = PreferencesUtils.toSysDn( test );
+        dn = ( LdapDN ) PreferencesUtils.toSysDn( test );
 
-        assertEquals( dn.toString(), "prefNodeName=kerberos,prefNodeName=apache,prefNodeName=org,"
+        assertEquals( dn.toUpName(), "prefNodeName=kerberos,prefNodeName=apache,prefNodeName=org,"
             + PreferencesUtils.SYSPREF_BASE );
 
         // basis condition tests
 
         test = "/";
 
-        dn = PreferencesUtils.toSysDn( test );
+        dn = ( LdapDN ) PreferencesUtils.toSysDn( test );
 
-        assertEquals( dn.toString(), PreferencesUtils.SYSPREF_BASE );
+        assertEquals( dn.toUpName(), PreferencesUtils.SYSPREF_BASE );
 
         // endpoint tests
 
         test = "//////";
 
-        dn = PreferencesUtils.toSysDn( test );
+        dn = ( LdapDN ) PreferencesUtils.toSysDn( test );
 
-        assertEquals( dn.toString(), PreferencesUtils.SYSPREF_BASE );
+        assertEquals( dn.toUpName(), PreferencesUtils.SYSPREF_BASE );
 
     }
 }

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/referral/ReferralLutTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/referral/ReferralLutTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/referral/ReferralLutTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/referral/ReferralLutTest.java Tue Jun 13 20:22:05 2006
@@ -17,11 +17,10 @@
 package org.apache.directory.server.core.referral;
 
 
-import javax.naming.Name;
 import javax.naming.NamingException;
 
 import org.apache.directory.server.core.referral.ReferralLut;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import junit.framework.TestCase;
 
@@ -47,7 +46,7 @@
         }
         try
         {
-            lut.isReferral( ( Name ) null );
+            lut.isReferral( ( LdapDN ) null );
             fail( "can't get here" );
         }
         catch ( IllegalArgumentException e )
@@ -55,7 +54,7 @@
         }
         try
         {
-            lut.getFarthestReferralAncestor( ( Name ) null );
+            lut.getFarthestReferralAncestor( ( LdapDN ) null );
             fail( "can't get here" );
         }
         catch ( IllegalArgumentException e )
@@ -63,7 +62,7 @@
         }
         try
         {
-            lut.getNearestReferralAncestor( ( Name ) null );
+            lut.getNearestReferralAncestor( ( LdapDN ) null );
             fail( "can't get here" );
         }
         catch ( IllegalArgumentException e )
@@ -71,7 +70,7 @@
         }
         try
         {
-            lut.referralAdded( ( Name ) null );
+            lut.referralAdded( ( LdapDN ) null );
             fail( "can't get here" );
         }
         catch ( IllegalArgumentException e )
@@ -87,7 +86,7 @@
         }
         try
         {
-            lut.referralDeleted( ( Name ) null );
+            lut.referralDeleted( ( LdapDN ) null );
             fail( "can't get here" );
         }
         catch ( IllegalArgumentException e )
@@ -103,7 +102,7 @@
         }
         try
         {
-            lut.referralChanged( ( Name ) null, ( Name ) null );
+            lut.referralChanged( ( LdapDN ) null, ( LdapDN ) null );
             fail( "can't get here" );
         }
         catch ( IllegalArgumentException e )
@@ -119,7 +118,7 @@
         }
         try
         {
-            lut.referralChanged( ( Name ) null, ( String ) null );
+            lut.referralChanged( ( LdapDN ) null, ( String ) null );
             fail( "can't get here" );
         }
         catch ( IllegalArgumentException e )
@@ -127,7 +126,7 @@
         }
         try
         {
-            lut.referralChanged( ( String ) null, ( Name ) null );
+            lut.referralChanged( ( String ) null, ( LdapDN ) null );
             fail( "can't get here" );
         }
         catch ( IllegalArgumentException e )
@@ -139,7 +138,7 @@
     public void testUpdateOperations() throws NamingException
     {
         String dn = "ou=users,ou=system";
-        Name name = new LdapName( dn );
+        LdapDN name = new LdapDN( dn );
         ReferralLut lut = new ReferralLut();
 
         // some add delete tests
@@ -181,7 +180,7 @@
 
         // change (rename and move) tests
         String newDn = "ou=people,ou=system";
-        Name newName = new LdapName( newDn );
+        LdapDN newName = new LdapDN( newDn );
 
         assertFalse( lut.isReferral( dn ) );
         lut.referralAdded( dn );
@@ -219,10 +218,10 @@
 
     public void testReferralAncestors() throws NamingException
     {
-        Name ancestor = new LdapName( "ou=users,ou=system" );
-        Name farthest = new LdapName( "ou=system" );
-        Name nearest = new LdapName( "ou=apache,ou=users,ou=system" );
-        Name testDn = new LdapName( "cn=Alex Karasulu,ou=apache,ou=users,ou=system" );
+        LdapDN ancestor = new LdapDN( "ou=users,ou=system" );
+        LdapDN farthest = new LdapDN( "ou=system" );
+        LdapDN nearest = new LdapDN( "ou=apache,ou=users,ou=system" );
+        LdapDN testDn = new LdapDN( "cn=Alex Karasulu,ou=apache,ou=users,ou=system" );
         ReferralLut lut = new ReferralLut();
         assertNull( lut.getNearestReferralAncestor( testDn ) );
         assertNull( lut.getFarthestReferralAncestor( testDn ) );

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java Tue Jun 13 20:22:05 2006
@@ -20,7 +20,6 @@
 import junit.framework.TestCase;
 
 import javax.naming.directory.*;
-import javax.naming.Name;
 import javax.naming.NamingException;
 
 import org.apache.directory.server.core.schema.ObjectClassRegistry;
@@ -29,8 +28,13 @@
 import org.apache.directory.server.core.schema.global.GlobalRegistries;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.StringTools;
 
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.HashSet;
 
@@ -111,7 +115,7 @@
      */
     public void testPreventStructuralClassRemovalOnModifyReplace() throws Exception
     {
-        Name name = new LdapName( "uid=akarasulu,ou=users,dc=example,dc=com" );
+        LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REPLACE_ATTRIBUTE;
         Attributes modifyAttributes = new BasicAttributes( true );
         modifyAttributes.put( new BasicAttribute( "cn" ) );
@@ -166,7 +170,7 @@
      */
     public void testPreventStructuralClassRemovalOnModifyRemove() throws Exception
     {
-        Name name = new LdapName( "uid=akarasulu,ou=users,dc=example,dc=com" );
+        LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REMOVE_ATTRIBUTE;
         Attributes modifyAttributes = new BasicAttributes( true );
         Attribute entryObjectClasses = new BasicAttribute( "objectClass" );
@@ -231,7 +235,7 @@
     public void testPreventRdnChangeOnModifyRemove() throws Exception
     {
         int mod = DirContext.REMOVE_ATTRIBUTE;
-        Name name = new LdapName( "ou=user,dc=example,dc=com" );
+        LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
         Attributes attributes = new BasicAttributes( true );
         attributes.put( "cn", "does not matter" );
 
@@ -251,7 +255,7 @@
         }
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
-        name = new LdapName( "ou=users+cn=system users,dc=example,dc=com" );
+        name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
         attributes = new BasicAttributes( true );
         attributes.put( "sn", "does not matter" );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes );
@@ -296,7 +300,7 @@
     public void testPreventRdnChangeOnModifyReplace() throws Exception
     {
         int mod = DirContext.REPLACE_ATTRIBUTE;
-        Name name = new LdapName( "ou=user,dc=example,dc=com" );
+        LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
         Attributes attributes = new BasicAttributes( true );
         attributes.put( "cn", "does not matter" );
 
@@ -316,7 +320,7 @@
         }
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
-        name = new LdapName( "ou=users+cn=system users,dc=example,dc=com" );
+        name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
         attributes = new BasicAttributes( true );
         attributes.put( "sn", "does not matter" );
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes );
@@ -368,7 +372,7 @@
         ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
 
         // this should pass
-        Name name = new LdapName( "uid=akarasulu,ou=users,dc=example,dc=com" );
+        LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REPLACE_ATTRIBUTE;
         SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, new BasicAttribute( "cn" ) );
 
@@ -412,7 +416,7 @@
      */
     public void testPreventStructuralClassRemovalOnModifyRemoveAttribute() throws Exception
     {
-        Name name = new LdapName( "uid=akarasulu,ou=users,dc=example,dc=com" );
+        LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REMOVE_ATTRIBUTE;
         Attribute entryObjectClasses = new BasicAttribute( "objectClass" );
         entryObjectClasses.add( "top" );
@@ -468,16 +472,18 @@
      */
     public void testPreventRdnChangeOnModifyRemoveAttribute() throws Exception
     {
+        OidRegistry registry = new MockOidRegistry();
         int mod = DirContext.REMOVE_ATTRIBUTE;
-        Name name = new LdapName( "ou=user,dc=example,dc=com" );
+        LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
 
         // postive test which should pass
-        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "cn", "does not matter" ) );
+        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
+            new BasicAttribute( "cn", "does not matter", true ), registry );
 
         // test should fail since we are removing the ou attribute
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "ou" ) );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "ou", true ), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown" );
         }
         catch ( LdapSchemaViolationException e )
@@ -486,13 +492,14 @@
         }
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
-        name = new LdapName( "ou=users+cn=system users,dc=example,dc=com" );
-        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "sn", "does not matter" ) );
+        name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
+        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
+            new BasicAttribute( "sn", "does not matter" ), registry );
 
         // test for failure when modifying Rdn attribute in multi attribute Rdn
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "cn" ) );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "cn" ), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown" );
         }
         catch ( LdapSchemaViolationException e )
@@ -502,12 +509,12 @@
 
         // should succeed since the value being deleted from the rdn attribute is
         // is not used when composing the Rdn
-        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "ou", "container" ) );
+        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "ou", "container" ), registry );
 
         // now let's make it fail again just by providing the right value for ou (users)
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "ou", "users" ) );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "ou", "users" ), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown" );
         }
         catch ( LdapSchemaViolationException e )
@@ -524,7 +531,7 @@
     public void testPreventRdnChangeOnModifyReplaceAttribute() throws Exception
     {
         int mod = DirContext.REPLACE_ATTRIBUTE;
-        Name name = new LdapName( "ou=user,dc=example,dc=com" );
+        LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
 
         // postive test which should pass
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new BasicAttribute( "cn", "does not matter" ) );
@@ -541,7 +548,7 @@
         }
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
-        name = new LdapName( "ou=users+cn=system users,dc=example,dc=com" );
+        name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new BasicAttribute( "sn", "does not matter" ) );
 
         // test for failure when modifying Rdn attribute in multi attribute Rdn
@@ -573,6 +580,49 @@
         catch ( LdapSchemaViolationException e )
         {
             assertEquals( ResultCodeEnum.NOTALLOWEDONRDN, e.getResultCode() );
+        }
+    }
+
+
+    class MockOidRegistry implements OidRegistry
+    {
+        public String getOid( String name ) throws NamingException
+        {
+            return StringTools.deepTrimToLower( name );
+        }
+
+        public boolean hasOid( String id )
+        {
+            return true;
+        }
+
+        public String getPrimaryName( String oid ) throws NamingException
+        {
+            return oid;
+        }
+
+        public List getNameSet( String oid ) throws NamingException
+        {
+            return Collections.singletonList( oid );
+        }
+
+        public Iterator list()
+        {
+            return Collections.EMPTY_LIST.iterator();
+        }
+
+        public void register( String name, String oid )
+        {
+        }
+
+        public Map getOidByName()
+        {
+            return null;
+        }
+
+        public Map getNameByOid()
+        {
+            return null;
         }
     }
 }

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java Tue Jun 13 20:22:05 2006
@@ -26,7 +26,7 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationModifier;
 
@@ -85,16 +85,16 @@
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        Name apDn = new LdapName( "ou=system" );
-        Name entryDn = new LdapName( "ou=users,ou=system" );
+        Name apDn = new LdapDN( "ou=system" );
+        Name entryDn = new LdapDN( "ou=users,ou=system" );
         Attribute objectClasses = new BasicAttribute( "objectClass" );
 
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=system" );
+        entryDn = new LdapDN( "ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=abc" );
+        entryDn = new LdapDN( "ou=abc" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
     }
 
@@ -102,18 +102,18 @@
     public void testWithBase() throws Exception
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
-        modifier.setBase( new LdapName( "ou=users" ) );
+        modifier.setBase( new LdapDN( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        Name apDn = new LdapName( "ou=system" );
-        Name entryDn = new LdapName( "ou=users,ou=system" );
+        Name apDn = new LdapDN( "ou=system" );
+        Name entryDn = new LdapDN( "ou=users,ou=system" );
         Attribute objectClasses = new BasicAttribute( "objectClass" );
 
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=system" );
+        entryDn = new LdapDN( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
     }
 
@@ -123,27 +123,27 @@
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new LdapName( "ou=users" ) );
+        modifier.setBase( new LdapDN( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        Name apDn = new LdapName( "ou=system" );
-        Name entryDn = new LdapName( "ou=users,ou=system" );
+        Name apDn = new LdapDN( "ou=system" );
+        Name entryDn = new LdapDN( "ou=users,ou=system" );
         Attribute objectClasses = new BasicAttribute( "objectClass" );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=system" );
+        entryDn = new LdapDN( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
     }
 
@@ -152,32 +152,32 @@
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         Set chopAfter = new HashSet();
-        chopAfter.add( new LdapName( "uid=Tori Amos" ) );
-        chopAfter.add( new LdapName( "ou=twolevels,uid=akarasulu" ) );
+        chopAfter.add( new LdapDN( "uid=Tori Amos" ) );
+        chopAfter.add( new LdapDN( "ou=twolevels,uid=akarasulu" ) );
         modifier.setChopAfterExclusions( chopAfter );
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new LdapName( "ou=users" ) );
+        modifier.setBase( new LdapDN( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        Name apDn = new LdapName( "ou=system" );
-        Name entryDn = new LdapName( "ou=users,ou=system" );
+        Name apDn = new LdapDN( "ou=system" );
+        Name entryDn = new LdapDN( "ou=users,ou=system" );
         Attribute objectClasses = new BasicAttribute( "objectClass" );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=system" );
+        entryDn = new LdapDN( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
     }
 
@@ -186,32 +186,32 @@
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         Set chopBefore = new HashSet();
-        chopBefore.add( new LdapName( "uid=Tori Amos" ) );
-        chopBefore.add( new LdapName( "ou=threelevels,ou=twolevels,uid=akarasulu" ) );
+        chopBefore.add( new LdapDN( "uid=Tori Amos" ) );
+        chopBefore.add( new LdapDN( "ou=threelevels,ou=twolevels,uid=akarasulu" ) );
         modifier.setChopBeforeExclusions( chopBefore );
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new LdapName( "ou=users" ) );
+        modifier.setBase( new LdapDN( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        Name apDn = new LdapName( "ou=system" );
-        Name entryDn = new LdapName( "ou=users,ou=system" );
+        Name apDn = new LdapDN( "ou=system" );
+        Name entryDn = new LdapDN( "ou=users,ou=system" );
         Attribute objectClasses = new BasicAttribute( "objectClass" );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=system" );
+        entryDn = new LdapDN( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
     }
 
@@ -225,27 +225,27 @@
         modifier.setRefinement( refinement );
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new LdapName( "ou=users" ) );
+        modifier.setBase( new LdapDN( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        Name apDn = new LdapName( "ou=system" );
-        Name entryDn = new LdapName( "ou=users,ou=system" );
+        Name apDn = new LdapDN( "ou=system" );
+        Name entryDn = new LdapDN( "ou=users,ou=system" );
         Attribute objectClasses = new BasicAttribute( "objectClass", "person" );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=system" );
+        entryDn = new LdapDN( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
         // now change the refinement so the entry is rejected
@@ -253,19 +253,19 @@
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=system" );
+        entryDn = new LdapDN( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
-        entryDn = new LdapName( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = new LdapDN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, objectClasses ) );
 
     }

Propchange: directory/trunks/apacheds/kerberos-shared/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -10,3 +10,5 @@
 classes
 .classpath
 .project
+
+nbproject

Modified: directory/trunks/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/AddPrincipal.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/AddPrincipal.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/AddPrincipal.java (original)
+++ directory/trunks/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/AddPrincipal.java Tue Jun 13 20:22:05 2006
@@ -31,7 +31,7 @@
 
 import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
 import org.apache.directory.server.protocol.shared.store.ContextOperation;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -68,13 +68,9 @@
         {
             DirStateFactory factory = new PrincipalStateFactory();
             Result result = factory.getStateToBind( entry, null, null, null, null );
-
             Attributes attrs = result.getAttributes();
-
-            LdapName name = new LdapName( "uid=" + entry.getUserId() + ",ou=Users" );
-
+            LdapDN name = new LdapDN( "uid=" + entry.getUserId() + ",ou=Users" );
             ctx.rebind( name, null, attrs );
-
             return name.toString();
         }
         catch ( NamingException ne )

Propchange: directory/trunks/apacheds/protocol-changepw/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -11,3 +11,5 @@
 bin
 .classpath
 .project
+
+nbproject

Propchange: directory/trunks/apacheds/protocol-dhcp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -11,3 +11,5 @@
 classes
 .classpath
 .project
+
+nbproject

Propchange: directory/trunks/apacheds/protocol-dns/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -11,3 +11,5 @@
 *.iws
 *.log
 .project
+
+nbproject

Propchange: directory/trunks/apacheds/protocol-kerberos/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -12,3 +12,5 @@
 bin
 build
 classes
+
+nbproject

Propchange: directory/trunks/apacheds/protocol-ldap/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 13 20:22:05 2006
@@ -9,3 +9,5 @@
 *.iml
 *.ser
 *.log
+
+nbproject

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AddHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AddHandler.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AddHandler.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/AddHandler.java Tue Jun 13 20:22:05 2006
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.message.ManageDsaITControl;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.demux.MessageHandler;
@@ -117,7 +118,7 @@
                 && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )
                     || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-                result.setMatchedDn( e.getResolvedName().toString() );
+                result.setMatchedDn( (LdapDN)e.getResolvedName() );
             }
 
             session.write( req.getResultResponse() );

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java Tue Jun 13 20:22:05 2006
@@ -32,8 +32,8 @@
 import org.apache.directory.shared.ldap.message.LdapResult;
 import org.apache.directory.shared.ldap.message.ManageDsaITControl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.demux.MessageHandler;
 
@@ -45,7 +45,6 @@
  * A single reply handler for {@link org.apache.directory.shared.ldap.message.BindRequest}s.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
  */
 public class BindHandler implements MessageHandler
 {
@@ -69,14 +68,11 @@
             return;
         }
 
-        boolean emptyDn = StringTools.isEmpty( req.getName() );
-
         // clone the environment first then add the required security settings
-        String dn = ( emptyDn ? "" : req.getName() );
         byte[] creds = req.getCredentials();
 
         Hashtable cloned = ( Hashtable ) env.clone();
-        cloned.put( Context.SECURITY_PRINCIPAL, dn );
+        cloned.put( Context.SECURITY_PRINCIPAL, req.getName() );
         cloned.put( Context.SECURITY_CREDENTIALS, creds );
         cloned.put( Context.SECURITY_AUTHENTICATION, "simple" );
 
@@ -135,7 +131,7 @@
                 && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )
                     || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-                result.setMatchedDn( e.getResolvedName().toString() );
+                result.setMatchedDn( (LdapDN)e.getResolvedName() );
             }
 
             result.setErrorMessage( msg );

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/CompareHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/CompareHandler.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/CompareHandler.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/CompareHandler.java Tue Jun 13 20:22:05 2006
@@ -31,7 +31,7 @@
 import org.apache.directory.shared.ldap.message.ManageDsaITControl;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.demux.MessageHandler;
@@ -61,6 +61,7 @@
         {
             LdapContext ctx = SessionRegistry.getSingleton().getLdapContext( session, null, true );
             ServerLdapContext newCtx = ( ServerLdapContext ) ctx.lookup( "" );
+            
             if ( req.getControls().containsKey( ManageDsaITControl.CONTROL_OID ) )
             {
                 newCtx.addToEnvironment( Context.REFERRAL, "ignore" );
@@ -71,8 +72,7 @@
             }
             newCtx.setRequestControls( ( Control[] ) req.getControls().values().toArray( EMPTY_CONTROLS ) );
 
-            LdapName name = new LdapName( req.getName() );
-            if ( newCtx.compare( name, req.getAttributeId(), req.getAssertionValue() ) )
+            if ( newCtx.compare( req.getName(), req.getAttributeId(), req.getAssertionValue() ) )
             {
                 result.setResultCode( ResultCodeEnum.COMPARETRUE );
             }
@@ -87,13 +87,15 @@
             result.setReferral( refs );
             result.setResultCode( ResultCodeEnum.REFERRAL );
             result.setErrorMessage( "Encountered referral attempting to handle compare request." );
-            /* coming up null causing a NPE */
-            // result.setMatchedDn( e.getResolvedName().toString() );
+
+            result.setMatchedDn( (LdapDN)e.getResolvedName() );
+            
             do
             {
                 refs.addLdapUrl( ( String ) e.getReferralInfo() );
             }
             while ( e.skipReferral() );
+            
             session.write( req.getResultResponse() );
             return;
         }
@@ -128,7 +130,7 @@
                     && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )
                         || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
                 {
-                    result.setMatchedDn( ne.getResolvedName().toString() );
+                    result.setMatchedDn( (LdapDN)ne.getResolvedName() );
                 }
             }
 

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DeleteHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DeleteHandler.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DeleteHandler.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DeleteHandler.java Tue Jun 13 20:22:05 2006
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.message.ManageDsaITControl;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.demux.MessageHandler;
@@ -110,7 +111,7 @@
                 && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )
                     || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-                result.setMatchedDn( e.getResolvedName().toString() );
+                result.setMatchedDn( (LdapDN)e.getResolvedName() );
             }
 
             session.write( req.getResultResponse() );

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ModifyDnHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ModifyDnHandler.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ModifyDnHandler.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ModifyDnHandler.java Tue Jun 13 20:22:05 2006
@@ -30,9 +30,8 @@
 import org.apache.directory.shared.ldap.message.ModifyDnRequest;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.demux.MessageHandler;
 
@@ -62,7 +61,7 @@
             LOG.debug( "req.getName() == [" + req.getName() + "]" );
         }
 
-        if ( req.getName() == null || req.getName().length() == 0 )
+        if ( req.getName().isEmpty() )
         {
             // it is not allowed to modify the name of the Root DSE
             String msg = "Modify DN is not allowed on Root DSE.";
@@ -75,6 +74,7 @@
             try
             {
                 LdapContext ctx = SessionRegistry.getSingleton().getLdapContext( session, null, true );
+                
                 if ( req.getControls().containsKey( ManageDsaITControl.CONTROL_OID ) )
                 {
                     ctx.addToEnvironment( Context.REFERRAL, "ignore" );
@@ -83,23 +83,32 @@
                 {
                     ctx.addToEnvironment( Context.REFERRAL, "throw" );
                 }
+                
                 ctx.setRequestControls( ( Control[] ) req.getControls().values().toArray( EMPTY_CONTROLS ) );
                 String deleteRDN = String.valueOf( req.getDeleteOldRdn() );
                 ctx.addToEnvironment( "java.naming.ldap.deleteRDN", deleteRDN );
 
                 if ( req.isMove() )
                 {
-                    LdapName oldDn = new LdapName( req.getName() );
-                    LdapName newDn = null;
+                    LdapDN oldDn = req.getName();
+                    LdapDN newDn = null;
 
-                    String newSuperior = req.getNewSuperior();
-                    if ( StringTools.isEmpty( newSuperior ) )
+                    LdapDN newSuperior = req.getNewSuperior();
+                    
+                    if ( newSuperior.isEmpty() )
                     {
-                        newDn = ( LdapName ) oldDn.getPrefix( 1 );
+                        if ( oldDn.isEmpty() )
+                        {
+                            newDn = oldDn;
+                        }
+                        else
+                        {
+                            newDn = (LdapDN)oldDn.getPrefix( oldDn.size() - 1 );
+                        }
                     }
                     else
                     {
-                        newDn = new LdapName( req.getNewSuperior() );
+                        newDn = newSuperior;
                     }
 
                     if ( req.getNewRdn() != null )
@@ -111,14 +120,14 @@
                         newDn.add( oldDn.getRdn() );
                     }
 
-                    ctx.rename( new LdapName( req.getName() ), newDn );
+                    ctx.rename( req.getName(), newDn );
                 }
                 else
                 {
-                    LdapName newDn = new LdapName( req.getName() );
+                    LdapDN newDn = ( LdapDN ) req.getName().clone();
                     newDn.remove( newDn.size() - 1 );
                     newDn.add( req.getNewRdn() );
-                    ctx.rename( new LdapName( req.getName() ), newDn );
+                    ctx.rename( req.getName(), newDn );
                 }
             }
             catch ( ReferralException e )
@@ -127,13 +136,14 @@
                 result.setReferral( refs );
                 result.setResultCode( ResultCodeEnum.REFERRAL );
                 result.setErrorMessage( "Encountered referral attempting to handle modifyDn request." );
-                /* coming up null causing a NPE */
-                // result.setMatchedDn( e.getResolvedName().toString() );
+                result.setMatchedDn( (LdapDN)e.getResolvedName() );
+
                 do
                 {
                     refs.addLdapUrl( ( String ) e.getReferralInfo() );
                 }
                 while ( e.skipReferral() );
+                
                 session.write( req.getResultResponse() );
                 return;
             }
@@ -146,6 +156,7 @@
                 }
 
                 ResultCodeEnum code;
+                
                 if ( e instanceof LdapException )
                 {
                     code = ( ( LdapException ) e ).getResultCode();
@@ -157,11 +168,12 @@
 
                 result.setResultCode( code );
                 result.setErrorMessage( msg );
+                
                 if ( ( e.getResolvedName() != null )
                     && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )
                         || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
                 {
-                    result.setMatchedDn( e.getResolvedName().toString() );
+                    result.setMatchedDn( (LdapDN)e.getResolvedName() );
                 }
 
                 session.write( req.getResultResponse() );

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ModifyHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ModifyHandler.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ModifyHandler.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ModifyHandler.java Tue Jun 13 20:22:05 2006
@@ -31,6 +31,7 @@
 import org.apache.directory.shared.ldap.message.ModifyRequest;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.demux.MessageHandler;
@@ -108,11 +109,12 @@
 
             result.setResultCode( code );
             result.setErrorMessage( msg );
+            
             if ( ( e.getResolvedName() != null )
                 && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )
                     || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-                result.setMatchedDn( e.getResolvedName().toString() );
+                result.setMatchedDn( (LdapDN)e.getResolvedName() );
             }
 
             session.write( req.getResultResponse() );

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java Tue Jun 13 20:22:05 2006
@@ -16,6 +16,7 @@
 package org.apache.directory.server.ldap.support;
 
 
+import javax.naming.InvalidNameException;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.event.NamespaceChangeListener;
@@ -37,6 +38,7 @@
 import org.apache.directory.shared.ldap.message.SearchRequest;
 import org.apache.directory.shared.ldap.message.SearchResponseEntry;
 import org.apache.directory.shared.ldap.message.SearchResponseEntryImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
 import org.apache.mina.common.IoSession;
 
@@ -136,6 +138,7 @@
         }
 
         ResultCodeEnum code = null;
+        
         if ( evt.getException() instanceof LdapException )
         {
             code = ( ( LdapException ) evt.getException() ).getResultCode();
@@ -148,12 +151,14 @@
         LdapResult result = req.getResultResponse().getLdapResult();
         result.setResultCode( code );
         result.setErrorMessage( msg );
+        
         if ( ( evt.getException().getResolvedName() != null )
             && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )
                 || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
         {
-            result.setMatchedDn( evt.getException().getResolvedName().toString() );
+            result.setMatchedDn( (LdapDN)evt.getException().getResolvedName() );
         }
+        
         session.write( req.getResultResponse() );
     }
 
@@ -200,50 +205,101 @@
             ecControl = new EntryChangeControl();
             respEntry.add( ecControl );
         }
+        
+        LdapDN newBinding = null;
+        LdapDN oldBinding = null;
+        
+        if ( evt.getNewBinding() != null )
+        {
+            try
+            {
+                newBinding = new LdapDN( evt.getNewBinding().getName() );
+            }
+            catch ( InvalidNameException ine )
+            {
+                newBinding = LdapDN.EMPTY_LDAPDN;
+            }
+        }
+
+        if ( evt.getOldBinding() != null )
+        {
+            try
+            {
+                oldBinding = new LdapDN( evt.getOldBinding().getName() );
+            }
+            catch ( InvalidNameException ine )
+            {
+                oldBinding = LdapDN.EMPTY_LDAPDN;
+            }
+        }
 
         switch ( evt.getType() )
         {
             case ( NamingEvent.OBJECT_ADDED  ):
                 if ( !control.isNotificationEnabled( ChangeType.ADD ) )
+                {
                     return;
-                respEntry.setObjectName( evt.getNewBinding().getName() );
+                }
+            
+                respEntry.setObjectName( newBinding );
                 respEntry.setAttributes( ( Attributes ) evt.getChangeInfo() );
+                
                 if ( ecControl != null )
                 {
                     ecControl.setChangeType( ChangeType.ADD );
                 }
+                
                 break;
+                
             case ( NamingEvent.OBJECT_CHANGED  ):
                 if ( !control.isNotificationEnabled( ChangeType.MODIFY ) )
+                {
                     return;
-                respEntry.setObjectName( evt.getOldBinding().getName() );
+                }
+            
+                respEntry.setObjectName( oldBinding );
                 respEntry.setAttributes( ( Attributes ) evt.getOldBinding().getObject() );
+
                 if ( ecControl != null )
                 {
                     ecControl.setChangeType( ChangeType.MODIFY );
                 }
+                
                 break;
+                
             case ( NamingEvent.OBJECT_REMOVED  ):
                 if ( !control.isNotificationEnabled( ChangeType.DELETE ) )
+                {
                     return;
-                respEntry.setObjectName( evt.getOldBinding().getName() );
+                }
+            
+                respEntry.setObjectName( oldBinding );
                 respEntry.setAttributes( ( Attributes ) evt.getOldBinding().getObject() );
+
                 if ( ecControl != null )
                 {
                     ecControl.setChangeType( ChangeType.DELETE );
                 }
+                
                 break;
+                
             case ( NamingEvent.OBJECT_RENAMED  ):
                 if ( !control.isNotificationEnabled( ChangeType.MODDN ) )
+                {
                     return;
-                respEntry.setObjectName( evt.getNewBinding().getName() );
+                }
+            
+                respEntry.setObjectName( newBinding );
                 respEntry.setAttributes( ( Attributes ) evt.getNewBinding().getObject() );
+
                 if ( ecControl != null )
                 {
                     ecControl.setChangeType( ChangeType.MODDN );
-                    ecControl.setPreviousDn( evt.getOldBinding().getName() );
+                    ecControl.setPreviousDn( oldBinding );
                 }
+                
                 break;
+
             default:
                 return;
         }

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java?rev=414035&r1=414034&r2=414035&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java Tue Jun 13 20:22:05 2006
@@ -46,11 +46,12 @@
 import org.apache.directory.shared.ldap.message.ScopeEnum;
 import org.apache.directory.shared.ldap.message.SearchRequest;
 import org.apache.directory.shared.ldap.message.SearchResponseDone;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.demux.MessageHandler;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -96,7 +97,7 @@
      */
     private static boolean isRootDSESearch( SearchRequest req )
     {
-        boolean isBaseIsRoot = req.getBase().trim().equals( "" );
+        boolean isBaseIsRoot = req.getBase().isEmpty();
         boolean isBaseScope = req.getScope() == ScopeEnum.BASEOBJECT;
         boolean isRootDSEFilter = false;
         if ( req.getFilter() instanceof PresenceNode )
@@ -209,7 +210,7 @@
 
                 if ( !psearchControl.isChangesOnly() )
                 {
-                    list = ( ( ServerLdapContext ) ctx ).search( new LdapName( req.getBase() ), req.getFilter(),
+                    list = ( ( ServerLdapContext ) ctx ).search( req.getBase(), req.getFilter(),
                         controls );
                     if ( list instanceof AbandonListener )
                     {
@@ -217,7 +218,7 @@
                     }
                     if ( list.hasMore() )
                     {
-                        Iterator it = new SearchResponseIterator( req, ctx, list, controls.getSearchScope() );
+                        Iterator it = new SearchResponseIterator( req, ctx, list, controls.getSearchScope(), session );
                         while ( it.hasNext() )
                         {
                             Response resp = ( Response ) it.next();
@@ -262,7 +263,7 @@
              * Iterate through all search results building and sending back responses 
              * for each search result returned.  
              */
-            list = ( ( ServerLdapContext ) ctx ).search( new LdapName( req.getBase() ), req.getFilter(), controls );
+            list = ( ( ServerLdapContext ) ctx ).search( req.getBase(), req.getFilter(), controls );
             if ( list instanceof AbandonListener )
             {
                 req.addAbandonListener( ( AbandonListener ) list );
@@ -270,7 +271,7 @@
 
             if ( list.hasMore() )
             {
-                Iterator it = new SearchResponseIterator( req, ctx, list, controls.getSearchScope() );
+                Iterator it = new SearchResponseIterator( req, ctx, list, controls.getSearchScope(), session );
                 while ( it.hasNext() )
                 {
                     session.write( it.next() );
@@ -351,7 +352,7 @@
                 && ( ( code == ResultCodeEnum.NOSUCHOBJECT ) || ( code == ResultCodeEnum.ALIASPROBLEM )
                     || ( code == ResultCodeEnum.INVALIDDNSYNTAX ) || ( code == ResultCodeEnum.ALIASDEREFERENCINGPROBLEM ) ) )
             {
-                result.setMatchedDn( e.getResolvedName().toString() );
+                result.setMatchedDn( (LdapDN)e.getResolvedName() );
             }
 
             Iterator it = Collections.singleton( req.getResultResponse() ).iterator();



Mime
View raw message