directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r980948 [3/3] - in /directory/apacheds/trunk: all/ core-annotations/ core-api/ core-api/src/main/java/org/apache/directory/server/core/ core-api/src/main/java/org/apache/directory/server/core/interceptor/context/ core-api/src/main/java/org/...
Date Fri, 30 Jul 2010 20:45:00 GMT
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Fri Jul 30 20:44:57 2010
@@ -30,6 +30,7 @@ import javax.naming.directory.SearchCont
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.DefaultCoreSession;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.LdapPrincipal;
@@ -233,12 +234,12 @@ public class SubentryInterceptor extends
         controls.setReturningAttributes( new String[]
             { SchemaConstants.SUBTREE_SPECIFICATION_AT, SchemaConstants.OBJECT_CLASS_AT } );
 
-        DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN, schemaManager );
+        DN adminDn = DNFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN, schemaManager );
 
         // search each namingContext for subentries
         for ( String suffix : suffixes )
         {
-            DN suffixDn = new DN( suffix, schemaManager );
+            DN suffixDn = DNFactory.create( suffix, schemaManager );
 
             CoreSession adminSession = new DefaultCoreSession(
                 new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
@@ -906,8 +907,8 @@ public class SubentryInterceptor extends
              * operational attributes calculated above.
              * ----------------------------------------------------------------
              */
-            DN baseDn = ( DN ) apDn.clone();
-            baseDn.addAll( subentry.getSubtreeSpecification().getBase() );
+            DN baseDn = apDn;
+            baseDn = baseDn.addAll( subentry.getSubtreeSpecification().getBase() );
             
             updateEntries( OperationEnum.ADD, addContext.getSession(), dn, apDn, subentry.getSubtreeSpecification(), baseDn, operationalAttributes );
 
@@ -994,8 +995,8 @@ public class SubentryInterceptor extends
              * ----------------------------------------------------------------
              */
             DN apDn = dn.getParent();
-            DN baseDn = ( DN ) apDn.clone();
-            baseDn.addAll( removedSubentry.getSubtreeSpecification().getBase() );
+            DN baseDn = apDn;
+            baseDn = baseDn.addAll( removedSubentry.getSubtreeSpecification().getBase() );
 
             // Remove all the references to this removed subentry from all the selected entries
             updateEntries( OperationEnum.REMOVE, deleteContext.getSession(), dn, apDn, removedSubentry.getSubtreeSpecification(), baseDn, null );
@@ -1090,8 +1091,8 @@ public class SubentryInterceptor extends
 
             // search for all entries selected by the old SS and remove references to subentry
             DN apName = dn.getParent();
-            DN oldBaseDn = ( DN ) apName.clone();
-            oldBaseDn.addAll( ssOld.getBase() );
+            DN oldBaseDn = apName;
+            oldBaseDn = oldBaseDn.addAll( ssOld.getBase() );
             
             ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
@@ -1127,8 +1128,8 @@ public class SubentryInterceptor extends
             // search for all selected entries by the new SS and add references to subentry
             subentry = subentryCache.getSubentry( dn );
             List<EntryAttribute> operationalAttributes = getSubentryOperationalAttributes( dn, subentry );
-            DN newBaseDn = ( DN ) apName.clone();
-            newBaseDn.addAll( ssNew.getBase() );
+            DN newBaseDn = apName;
+            newBaseDn = newBaseDn.addAll( ssNew.getBase() );
 
             searchOperationContext = new SearchOperationContext( modifyContext.getSession(), newBaseDn, filter, controls );
             searchOperationContext.setAliasDerefMode( AliasDerefMode.NEVER_DEREF_ALIASES );
@@ -1222,10 +1223,10 @@ public class SubentryInterceptor extends
             Subentry subentry = subentryCache.removeSubentry( oldDn );
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             DN apName = oldDn.getParent();
-            DN baseDn = ( DN ) apName.clone();
-            baseDn.addAll( ss.getBase() );
-            DN newName = (DN)newSuperiorDn.clone();
-            newName.add( oldDn.getRdn() );
+            DN baseDn = apName;
+            baseDn = baseDn.addAll( ss.getBase() );
+            DN newName = newSuperiorDn;
+            newName = newName.add( oldDn.getRdn() );
             newName.normalize( schemaManager.getNormalizerMapping() );
 
             subentryCache.addSubentry( newName, subentry );
@@ -1313,11 +1314,11 @@ public class SubentryInterceptor extends
             Subentry subentry = subentryCache.removeSubentry( oldDn );
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             DN apName = oldDn.getParent();
-            DN baseDn = ( DN ) apName.clone();
-            baseDn.addAll( ss.getBase() );
+            DN baseDn = apName;
+            baseDn = baseDn.addAll( ss.getBase() );
             DN newName = newSuperiorDn.getParent();
 
-            newName.add( moveAndRenameContext.getNewRdn() );
+            newName = newName.add( moveAndRenameContext.getNewRdn() );
             newName.normalize( schemaManager.getNormalizerMapping() );
 
             subentryCache.addSubentry( newName, subentry );
@@ -1396,11 +1397,11 @@ public class SubentryInterceptor extends
             Subentry subentry = subentryCache.removeSubentry( oldDn );
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             DN apName = oldDn.getParent();
-            DN baseDn = ( DN ) apName.clone();
-            baseDn.addAll( ss.getBase() );
+            DN baseDn = apName;
+            baseDn = baseDn.addAll( ss.getBase() );
             DN newName = oldDn.getParent();
 
-            newName.add( renameContext.getNewRdn() );
+            newName = newName.add( renameContext.getNewRdn() );
             newName.normalize( schemaManager.getNormalizerMapping() );
 
             subentryCache.addSubentry( newName, subentry );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java Fri Jul 30 20:44:57 2010
@@ -78,8 +78,8 @@ public class SubtreeEvaluator
          */
         // First construct the subtree base, which is the concatenation of the
         // AP DN and the subentry base
-        DN subentryBaseDn = (DN)apDn.clone();
-        subentryBaseDn.addAll( subtree.getBase() );
+        DN subentryBaseDn = apDn;
+        subentryBaseDn = subentryBaseDn.addAll( subtree.getBase() );
         
         if ( !entryDn.isChildOf( subentryBaseDn ) )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java Fri Jul 30 20:44:57 2010
@@ -27,6 +27,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.ByPassConstants;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -54,7 +55,7 @@ public abstract class AbstractStoredProc
     protected DN getOperationPrincipal() throws LdapInvalidDnException
     {
         Principal principal = opContext.getSession().getEffectivePrincipal();
-        DN userName = new DN( principal.getName() );
+        DN userName = DNFactory.create( principal.getName() );
         return userName;
     }
     

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java Fri Jul 30 20:44:57 2010
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
 
 import java.util.Map;
 
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -53,7 +54,7 @@ public class AddStoredProcedureParameter
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( addedEntryName.getName() );
+            return DNFactory.create( addedEntryName.getName() );
         }
     };
     

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java Fri Jul 30 20:44:57 2010
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
 
 import java.util.Map;
 
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.ByPassConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
@@ -52,7 +53,7 @@ public class DeleteStoredProcedureParame
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( deletedEntryName.getName() );
+            return DNFactory.create( deletedEntryName.getName() );
         }
     };
     

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java Fri Jul 30 20:44:57 2010
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
 
 import java.util.Map;
 
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.name.DN;
@@ -47,10 +48,10 @@ public class ModifyDNStoredProcedurePara
         this.deleteOldRn = deleteOldRn;
         this.oldRDN = (RDN)oldRDN.clone();
         this.newRDN = (RDN)newRDN.clone();
-        this.oldSuperiorDN = (DN)oldSuperiorDN.clone();
-        this.newSuperiorDN = (DN)newSuperiorDN.clone();
-        this.oldDN = (DN)oldDN.clone();
-        this.newDN = (DN)newDN.clone();
+        this.oldSuperiorDN = oldSuperiorDN;
+        this.newSuperiorDN = newSuperiorDN;
+        this.oldDN = oldDN;
+        this.newDN = newDN;
         
         Map<Class<?>, MicroInjector> injectors = super.getInjectors();
         injectors.put( StoredProcedureParameter.ModifyDN_ENTRY.class, $entryInjector );
@@ -70,7 +71,7 @@ public class ModifyDNStoredProcedurePara
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( oldDN.getName() );
+            return DNFactory.create( oldDN.getName() );
         }
     };
 
@@ -82,7 +83,7 @@ public class ModifyDNStoredProcedurePara
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( newRDN.getName() );
+            return DNFactory.create( newRDN.getName() );
         }
     };
 
@@ -106,7 +107,7 @@ public class ModifyDNStoredProcedurePara
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( newSuperiorDN.getName() );
+            return DNFactory.create( newSuperiorDN.getName() );
         }
     };
     
@@ -118,7 +119,7 @@ public class ModifyDNStoredProcedurePara
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( oldRDN.getName() );
+            return DNFactory.create( oldRDN.getName() );
         }
     };
     
@@ -130,7 +131,7 @@ public class ModifyDNStoredProcedurePara
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( oldSuperiorDN.getName() );
+            return DNFactory.create( oldSuperiorDN.getName() );
         }
     };
     
@@ -142,7 +143,7 @@ public class ModifyDNStoredProcedurePara
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( newDN.getName() );
+            return DNFactory.create( newDN.getName() );
         }
     };
     

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java Fri Jul 30 20:44:57 2010
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.partition.ByPassConstants;
@@ -61,7 +62,7 @@ public class ModifyStoredProcedureParame
         public Object inject( OperationContext opContext, StoredProcedureParameter param ) throws LdapInvalidDnException
         {
             // Return a safe copy constructed with user provided name.
-            return new DN( modifiedEntryName.getName() );
+            return DNFactory.create( modifiedEntryName.getName() );
         }
     };
     

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java Fri Jul 30 20:44:57 2010
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
@@ -35,7 +36,7 @@ public class SimpleTriggerExecutionAutho
     {
         try
         {
-            adminName = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+            adminName = DNFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
         }
         catch ( LdapInvalidDnException e )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Fri Jul 30 20:44:57 2010
@@ -135,8 +135,8 @@ public class TriggerInterceptor extends 
          */
         if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
-            DN parentDn = ( DN ) dn.clone();
-            parentDn.remove( dn.size() - 1 );
+            DN parentDn = dn;
+            parentDn = parentDn.remove( dn.size() - 1 );
 
             entry = opContext.lookup( parentDn, ByPassConstants.LOOKUP_BYPASS );
         }
@@ -387,12 +387,12 @@ public class TriggerInterceptor extends 
 
         // @TODO : To be completely reviewed !!!
         RDN oldRDN = name.getRdn();
-        DN oldSuperiorDN = ( DN ) name.clone();
-        oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
+        DN oldSuperiorDN = ( DN ) name;
+        oldSuperiorDN = oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
         DN newSuperiorDN = oldSuperiorDN;
         DN oldDN = name;
-        DN newDN = ( DN ) name.clone();
-        newDN.add( newRdn );
+        DN newDN = name;
+        newDN = newDN.add( newRdn );
 
         StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector( renameContext,
             deleteOldRn, oldRDN, newRdn, oldSuperiorDN, newSuperiorDN, oldDN, newDN );
@@ -432,8 +432,8 @@ public class TriggerInterceptor extends 
         Entry movedEntry = moveAndRenameContext.getOriginalEntry();
 
         RDN oldRDN = oldDn.getRdn();
-        DN oldSuperiorDN = ( DN ) oldDn.clone();
-        oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
+        DN oldSuperiorDN = oldDn;
+        oldSuperiorDN = oldSuperiorDN.remove( oldSuperiorDN.size() - 1 );
         DN oldDN = oldDn;
         DN newDN = moveAndRenameContext.getNewDn();
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Fri Jul 30 20:44:57 2010
@@ -33,6 +33,7 @@ import javax.naming.directory.SearchCont
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.DefaultCoreSession;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.LdapPrincipal;
@@ -123,13 +124,13 @@ public class TriggerSpecCache
         
         for ( String suffix:suffixes )
         {
-            DN baseDn = new DN( suffix );
+            DN baseDn = DNFactory.create( suffix );
             ExprNode filter = new EqualityNode<String>( objectClassAt, 
                     new StringValue( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC ) );
             SearchControls ctls = new SearchControls();
             ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             
-            DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED, directoryService.getSchemaManager() );
+            DN adminDn = DNFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED, directoryService.getSchemaManager() );
             CoreSession adminSession = new DefaultCoreSession( 
                 new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
 

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Fri Jul 30 20:44:57 2010
@@ -31,6 +31,7 @@ import java.util.Set;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.MockOperation;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
@@ -92,7 +93,7 @@ public class MaxImmSubFilterTest
             fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
         }
 
-        ENTRY_NAME = new DN( "ou=test, ou=system" );
+        ENTRY_NAME = DNFactory.create( "ou=test, ou=system" );
         PROTECTED_ITEMS.add( new MaxImmSubItem( 2 ) );
         ENTRY = new DefaultEntry( schemaManager, ENTRY_NAME );
     }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java Fri Jul 30 20:44:57 2010
@@ -31,6 +31,7 @@ import java.util.Set;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
@@ -90,7 +91,7 @@ public class MaxValueCountFilterTest
             fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
         }
 
-        DN entryName = new DN( "ou=test, ou=system" );
+        DN entryName = DNFactory.create( "ou=test, ou=system" );
         ENTRY = new DefaultEntry( schemaManager, entryName );
         FULL_ENTRY = new DefaultEntry( schemaManager, entryName );
         

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java Fri Jul 30 20:44:57 2010
@@ -31,6 +31,7 @@ import java.util.Set;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.event.ExpressionEvaluator;
 import org.apache.directory.server.core.subtree.RefinementEvaluator;
 import org.apache.directory.server.core.subtree.RefinementLeafEvaluator;
@@ -111,8 +112,8 @@ public class RelatedProtectedItemFilterT
             fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
         }
 
-        GROUP_NAME = new DN( "ou=test,ou=groups,ou=system" );
-        USER_NAME = new DN( "ou=test, ou=users, ou=system" );
+        GROUP_NAME = DNFactory.create( "ou=test,ou=groups,ou=system" );
+        USER_NAME = DNFactory.create( "ou=test, ou=users, ou=system" );
         
         filterA = new RelatedProtectedItemFilter( new RefinementEvaluator( new RefinementLeafEvaluator(
             schemaManager ) ), new ExpressionEvaluator( schemaManager ), schemaManager );
@@ -392,11 +393,11 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( new ProtectedItem.RangeOfValues( new PresenceNode( "cn" ) ) );
 
         Assert.assertEquals( 1, filterA.filter( tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null,
-            new DN( "ou=testEntry" ), null, null, entry, null ).size() );
+            DNFactory.create( "ou=testEntry" ), null, null, entry, null ).size() );
 
         entry.remove( "cn" );
         Assert.assertEquals( 0, filterA.filter( service.getRegistries(), tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, new DN( "ou=testEntry" ), null, null, entry, null ).size() );
+            null, null, DNFactory.create( "ou=testEntry" ), null, null, entry, null ).size() );
     }
     */
 

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java Fri Jul 30 20:44:57 2010
@@ -30,6 +30,7 @@ import java.util.Set;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.subtree.SubtreeEvaluator;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
@@ -75,8 +76,8 @@ public class RelatedUserClassFilterTest
         
         try
         {
-            GROUP_NAME = new DN( "ou=test,ou=groups,ou=system" );
-            USER_NAME = new DN( "ou=test, ou=users, ou=system" );
+            GROUP_NAME = DNFactory.create( "ou=test,ou=groups,ou=system" );
+            USER_NAME = DNFactory.create( "ou=test, ou=users, ou=system" );
         }
         catch ( LdapInvalidDnException e )
         {
@@ -127,7 +128,7 @@ public class RelatedUserClassFilterTest
         aciContext.setAciTuples( tuples );
         aciContext.setUserDn( USER_NAME );
         aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
-        aciContext.setEntryDn( new DN( "ou=unrelated" ) );
+        aciContext.setEntryDn( DNFactory.create( "ou=unrelated" ) );
 
         assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
@@ -142,7 +143,7 @@ public class RelatedUserClassFilterTest
         aciContext.setAciTuples( tuples );
         aciContext.setUserDn( USER_NAME );
         aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
-        aciContext.setEntryDn( new DN( "ou=phoneBook, ou=test, ou=users, ou=system" ) );
+        aciContext.setEntryDn( DNFactory.create( "ou=phoneBook, ou=test, ou=users, ou=system" ) );
 
         assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
@@ -150,7 +151,7 @@ public class RelatedUserClassFilterTest
         aciContext.setAciTuples( tuples );
         aciContext.setUserDn( USER_NAME );
         aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
-        aciContext.setEntryDn( new DN( "ou=unrelated" ) );
+        aciContext.setEntryDn( DNFactory.create( "ou=unrelated" ) );
 
         assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
@@ -170,7 +171,7 @@ public class RelatedUserClassFilterTest
 
         aciContext = new AciContext( null, null );
         aciContext.setAciTuples( tuples );
-        aciContext.setUserDn( new DN( "ou=unrelateduser, ou=users" ) );
+        aciContext.setUserDn( DNFactory.create( "ou=unrelateduser, ou=users" ) );
         aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
         aciContext.setEntryDn( USER_NAME );
 
@@ -192,7 +193,7 @@ public class RelatedUserClassFilterTest
         assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         Set<DN> wrongGroupNames = new HashSet<DN>();
-        wrongGroupNames.add( new DN( "ou=unrelatedgroup" ) );
+        wrongGroupNames.add( DNFactory.create( "ou=unrelatedgroup" ) );
 
         aciContext = new AciContext( null, null );
         aciContext.setAciTuples( tuples );
@@ -286,7 +287,7 @@ public class RelatedUserClassFilterTest
             
             try
             {
-                names.add( new DN( "dummy=dummy" ) );
+                names.add( DNFactory.create( "dummy=dummy" ) );
             }
             catch ( LdapInvalidDnException e )
             {

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java Fri Jul 30 20:44:57 2010
@@ -31,6 +31,7 @@ import java.util.Set;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
@@ -94,7 +95,7 @@ public class RestrictedByFilterTest
             fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
         }
 
-        DN entryName = new DN( "ou=test, ou=system" );
+        DN entryName = DNFactory.create( "ou=test, ou=system" );
         PROTECTED_ITEMS.add( new MaxImmSubItem( 2 ) );
         ENTRY = new DefaultEntry( schemaManager, entryName );
 

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java Fri Jul 30 20:44:57 2010
@@ -34,6 +34,7 @@ import java.util.Map;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.LdapPrincipal;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -107,7 +108,7 @@ public class MemoryChangeLogStoreTest
         forward.putAttribute( "objectClass", "organizationalUnit" );
         forward.putAttribute( "ou", "system" );
 
-        LdifEntry reverse = LdifRevertor.reverseAdd( new DN( forward.getDn() ) );
+        LdifEntry reverse = LdifRevertor.reverseAdd( DNFactory.create( forward.getDn() ) );
         assertEquals( 1, store.log( new LdapPrincipal(), forward, reverse ).getRevision() );
         assertEquals( 1, store.getCurrentRevision() );
     }
@@ -116,10 +117,10 @@ public class MemoryChangeLogStoreTest
     @Test
     public void testChangeLogSerialization() throws LdapException, IOException, ClassNotFoundException
     {
-        DN systemDn = new DN( "ou=system" );
+        DN systemDn = DNFactory.create( "ou=system" );
         systemDn.normalize( oidsMap );
         
-        DN adminDn = new DN( "uid=admin, ou=system" );
+        DN adminDn = DNFactory.create( "uid=admin, ou=system" );
         adminDn.normalize( oidsMap );
 
         LdifEntry forward = new LdifEntry();
@@ -128,7 +129,7 @@ public class MemoryChangeLogStoreTest
         forward.putAttribute( "objectClass", "organizationalUnit" );
         forward.putAttribute( "ou", "system" );
         
-        DN reverseDn = new DN( forward.getDn() );
+        DN reverseDn = DNFactory.create( forward.getDn() );
         reverseDn.normalize( oidsMap );
 
         LdifEntry reverse = LdifRevertor.reverseAdd( reverseDn );

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Fri Jul 30 20:44:57 2010
@@ -28,6 +28,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.DefaultCoreSession;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.LdapPrincipal;
@@ -86,7 +87,7 @@ public class InterceptorChainTest
     @Test
     public void testNoBypass() throws Exception
     {
-        DN dn = new DN( "ou=system" );
+        DN dn = DNFactory.create( "ou=system" );
         DirectoryService ds = new MockDirectoryService();
         DefaultCoreSession session = new DefaultCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ),
             ds );
@@ -112,7 +113,7 @@ public class InterceptorChainTest
     @Test
     public void testSingleBypass() throws Exception
     {
-        DN dn = new DN( "ou=system" );
+        DN dn = DNFactory.create( "ou=system" );
         DirectoryService ds = new MockDirectoryService();
         DefaultCoreSession session = new DefaultCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ),
             ds );
@@ -139,7 +140,7 @@ public class InterceptorChainTest
     @Test
     public void testAdjacentDoubleBypass() throws Exception
     {
-        DN dn = new DN( "ou=system" );
+        DN dn = DNFactory.create( "ou=system" );
         DirectoryService ds = new MockDirectoryService();
         DefaultCoreSession session = new DefaultCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ),
             ds );
@@ -169,7 +170,7 @@ public class InterceptorChainTest
     @Test
     public void testFrontAndBackDoubleBypass() throws Exception
     {
-        DN dn = new DN( "ou=system" );
+        DN dn = DNFactory.create( "ou=system" );
         DirectoryService ds = new MockDirectoryService();
         DefaultCoreSession session = new DefaultCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ),
             ds );
@@ -198,7 +199,7 @@ public class InterceptorChainTest
     @Test
     public void testDoubleBypass() throws Exception
     {
-        DN dn = new DN( "ou=system" );
+        DN dn = DNFactory.create( "ou=system" );
         DirectoryService ds = new MockDirectoryService();
         DefaultCoreSession session = new DefaultCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ),
             ds );
@@ -227,7 +228,7 @@ public class InterceptorChainTest
     @Test
     public void testCompleteBypass() throws Exception
     {
-        DN dn = new DN( "ou=system" );
+        DN dn = DNFactory.create( "ou=system" );
         DirectoryService ds = new MockDirectoryService( 0 );
         DefaultCoreSession session = new DefaultCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ),
             ds );

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java Fri Jul 30 20:44:57 2010
@@ -31,6 +31,7 @@ import java.util.Map;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
 import org.apache.directory.shared.ldap.entry.Entry;
@@ -101,7 +102,7 @@ public class SchemaCheckerTest
     @Test
     public void testPreventStructuralClassRemovalOnModifyReplace() throws Exception
     {
-        DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
+        DN name = DNFactory.create( "uid=akarasulu,ou=users,dc=example,dc=com" );
         ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
         Entry modifyAttributes = new DefaultEntry( schemaManager );
         AttributeType atCN = schemaManager.lookupAttributeTypeRegistry( "cn" );
@@ -160,7 +161,7 @@ public class SchemaCheckerTest
      *
     public void testPreventStructuralClassRemovalOnModifyRemove() throws Exception
     {
-        DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
+        DN name = DNFactory.create( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REMOVE_ATTRIBUTE;
         Attributes modifyAttributes = new AttributesImpl( true );
         Attribute entryObjectClasses = new AttributeImpl( "objectClass" );
@@ -226,7 +227,7 @@ public class SchemaCheckerTest
     public void testPreventRdnChangeOnModifyRemove() throws Exception
     {
         ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
-        DN name = new DN( "ou=user,dc=example,dc=com" );
+        DN name = DNFactory.create( "ou=user,dc=example,dc=com" );
         Entry attributes = new DefaultEntry( schemaManager, name );
         attributes.put( "cn", "does not matter" );
 
@@ -248,7 +249,7 @@ public class SchemaCheckerTest
         }
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
-        name = new DN( "ou=users+cn=system users,dc=example,dc=com" );
+        name = DNFactory.create( "ou=users+cn=system users,dc=example,dc=com" );
         attributes = new DefaultEntry( schemaManager, name );
         attributes.put( "sn", "does not matter" );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, schemaManager );
@@ -296,7 +297,7 @@ public class SchemaCheckerTest
     public void testPreventRdnChangeOnModifyReplace() throws Exception
     {
         ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
-        DN name = new DN( "ou=user,dc=example,dc=com" );
+        DN name = DNFactory.create( "ou=user,dc=example,dc=com" );
         Entry attributes = new DefaultEntry( schemaManager, name );
         attributes.put( "cn", "does not matter" );
 
@@ -317,7 +318,7 @@ public class SchemaCheckerTest
         }
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
-        name = new DN( "ou=users+cn=system users,dc=example,dc=com" );
+        name = DNFactory.create( "ou=users+cn=system users,dc=example,dc=com" );
         attributes = new DefaultEntry( schemaManager, name );
         attributes.put( "sn", "does not matter" );
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
@@ -372,7 +373,7 @@ public class SchemaCheckerTest
         AttributeType CN_AT = schemaManager.lookupAttributeTypeRegistry( "cn" );
 
         // this should pass
-        DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
+        DN name = DNFactory.create( "uid=akarasulu,ou=users,dc=example,dc=com" );
         ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
         SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod,
             new DefaultEntryAttribute( "cn", CN_AT ) );
@@ -420,7 +421,7 @@ public class SchemaCheckerTest
     @Test
     public void testPreventStructuralClassRemovalOnModifyRemoveAttribute() throws Exception
     {
-        DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
+        DN name = DNFactory.create( "uid=akarasulu,ou=users,dc=example,dc=com" );
         ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
         AttributeType ocAt = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
 
@@ -478,7 +479,7 @@ public class SchemaCheckerTest
     {
         Map<String, OidNormalizer> oidNormalizers = schemaManager.getAttributeTypeRegistry().getNormalizerMapping();
         ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
-        DN name = new DN( "ou=user,dc=example,dc=com", schemaManager );
+        DN name = DNFactory.create( "ou=user,dc=example,dc=com", schemaManager );
         AttributeType cnAt = schemaManager.lookupAttributeTypeRegistry( "cn" );
         AttributeType ouAt = schemaManager.lookupAttributeTypeRegistry( "ou" );
         AttributeType snAt = schemaManager.lookupAttributeTypeRegistry( "sn" );
@@ -500,7 +501,7 @@ public class SchemaCheckerTest
         }
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
-        name = new DN( "ou=users+cn=system users,dc=example,dc=com" );
+        name = DNFactory.create( "ou=users+cn=system users,dc=example,dc=com" );
         name.normalize( oidNormalizers );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new DefaultEntryAttribute( "sn", snAt,
             "does not matter" ), schemaManager );
@@ -542,7 +543,7 @@ public class SchemaCheckerTest
     //    public void testPreventRdnChangeOnModifyReplaceAttribute() throws Exception
     //    {
     //        int mod = DirContext.REPLACE_ATTRIBUTE;
-    //        DN name = new DN( "ou=user,dc=example,dc=com" );
+    //        DN name = DNFactory.create( "ou=user,dc=example,dc=com" );
     //
     //        // postive test which should pass
     //        SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "cn", "does not matter" ), registries.getOidRegistry() );
@@ -559,7 +560,7 @@ public class SchemaCheckerTest
     //        }
     //
     //        // test success using more than one attribute for the Rdn but not modifying rdn attribute
-    //        name = new DN( "ou=users+cn=system users,dc=example,dc=com" );
+    //        name = DNFactory.create( "ou=users+cn=system users,dc=example,dc=com" );
     //        SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "sn", "does not matter" ), registries.getOidRegistry() );
     //
     //        // test for failure when modifying Rdn attribute in multi attribute Rdn

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?rev=980948&r1=980947&r2=980948&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java Fri Jul 30 20:44:57 2010
@@ -30,6 +30,7 @@ import java.util.Set;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.server.core.DNFactory;
 import org.apache.directory.server.core.normalization.FilterNormalizingVisitor;
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.entry.Entry;
@@ -118,16 +119,16 @@ public class SubtreeEvaluatorTest
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        DN apDn = new DN( "ou=system" );
-        DN entryDn = new DN( "ou=users,ou=system" );
+        DN apDn = DNFactory.create( "ou=system" );
+        DN entryDn = DNFactory.create( "ou=users,ou=system" );
         Entry entry = new DefaultEntry( schemaManager, entryDn, "objectClass" );
 
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=system" );
+        entryDn = DNFactory.create( "ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=abc" );
+        entryDn = DNFactory.create( "ou=abc" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
     }
 
@@ -136,18 +137,18 @@ public class SubtreeEvaluatorTest
     public void testWithBase() throws Exception
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
-        modifier.setBase( new DN( "ou=users" ) );
+        modifier.setBase( DNFactory.create( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        DN apDn = new DN( "ou=system" );
-        DN entryDn = new DN( "ou=users,ou=system" );
+        DN apDn = DNFactory.create( "ou=system" );
+        DN entryDn = DNFactory.create( "ou=users,ou=system" );
         Entry entry = new DefaultEntry( schemaManager, entryDn, "objectClass" );
 
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=system" );
+        entryDn = DNFactory.create( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
     }
 
@@ -158,27 +159,27 @@ public class SubtreeEvaluatorTest
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new DN( "ou=users" ) );
+        modifier.setBase( DNFactory.create( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        DN apDn = new DN( "ou=system" );
-        DN entryDn = new DN( "ou=users,ou=system" );
+        DN apDn = DNFactory.create( "ou=system" );
+        DN entryDn = DNFactory.create( "ou=users,ou=system" );
         Entry entry = new DefaultEntry( schemaManager, entryDn, "objectClass" );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=system" );
+        entryDn = DNFactory.create( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
     }
 
@@ -188,32 +189,32 @@ public class SubtreeEvaluatorTest
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         Set<DN> chopAfter = new HashSet<DN>();
-        chopAfter.add( new DN( "uid=Tori Amos" ) );
-        chopAfter.add( new DN( "ou=twolevels,uid=akarasulu" ) );
+        chopAfter.add( DNFactory.create( "uid=Tori Amos" ) );
+        chopAfter.add( DNFactory.create( "ou=twolevels,uid=akarasulu" ) );
         modifier.setChopAfterExclusions( chopAfter );
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new DN( "ou=users" ) );
+        modifier.setBase( DNFactory.create( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        DN apDn = new DN( "ou=system" );
-        DN entryDn = new DN( "ou=users,ou=system" );
+        DN apDn = DNFactory.create( "ou=system" );
+        DN entryDn = DNFactory.create( "ou=users,ou=system" );
         Entry entry = new DefaultEntry( schemaManager, entryDn, "objectClass" );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=system" );
+        entryDn = DNFactory.create( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
     }
 
@@ -223,32 +224,32 @@ public class SubtreeEvaluatorTest
     {
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
         Set<DN> chopBefore = new HashSet<DN>();
-        chopBefore.add( new DN( "uid=Tori Amos" ) );
-        chopBefore.add( new DN( "ou=threelevels,ou=twolevels,uid=akarasulu" ) );
+        chopBefore.add( DNFactory.create( "uid=Tori Amos" ) );
+        chopBefore.add( DNFactory.create( "ou=threelevels,ou=twolevels,uid=akarasulu" ) );
         modifier.setChopBeforeExclusions( chopBefore );
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new DN( "ou=users" ) );
+        modifier.setBase( DNFactory.create( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        DN apDn = new DN( "ou=system" );
-        DN entryDn = new DN( "ou=users,ou=system" );
+        DN apDn = DNFactory.create( "ou=system" );
+        DN entryDn = DNFactory.create( "ou=users,ou=system" );
         Entry entry = new DefaultEntry( schemaManager, entryDn, "objectClass" );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=system" );
+        entryDn = DNFactory.create( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
     }
 
@@ -263,28 +264,28 @@ public class SubtreeEvaluatorTest
         modifier.setRefinement( refinement );
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new DN( "ou=users" ) );
+        modifier.setBase( DNFactory.create( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        DN apDn = new DN( "ou=system" );
-        DN entryDn = new DN( "ou=users,ou=system" );
+        DN apDn = DNFactory.create( "ou=system" );
+        DN entryDn = DNFactory.create( "ou=users,ou=system" );
         Entry entry = new DefaultEntry( schemaManager, entryDn );
         entry.put( "objectClass", "person" );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=system" );
+        entryDn = DNFactory.create( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
         // now change the refinement so the entry is rejected
@@ -293,19 +294,19 @@ public class SubtreeEvaluatorTest
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=system" );
+        entryDn = DNFactory.create( "ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
+        entryDn = DNFactory.create( "ou=fourlevels,ou=threelevels,ou=twolevels,uid=akarasulu,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
     }
@@ -321,10 +322,10 @@ public class SubtreeEvaluatorTest
         modifier.setRefinement( filter );
         modifier.setMinBaseDistance( 1 );
         modifier.setMaxBaseDistance( 3 );
-        modifier.setBase( new DN( "ou=users" ) );
+        modifier.setBase( DNFactory.create( "ou=users" ) );
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
-        DN apDn = new DN( "ou=system" );
-        DN entryDn = new DN( "ou=users,ou=system" );
+        DN apDn = DNFactory.create( "ou=system" );
+        DN entryDn = DNFactory.create( "ou=users,ou=system" );
 
         Entry entry = new DefaultEntry( schemaManager, entryDn );;
         entry.put( "objectClass", "person" );
@@ -332,7 +333,7 @@ public class SubtreeEvaluatorTest
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "cn=Ersin,ou=users,ou=system" );
+        entryDn = DNFactory.create( "cn=Ersin,ou=users,ou=system" );
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
         // now change the filter so the entry is rejected
@@ -342,7 +343,7 @@ public class SubtreeEvaluatorTest
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
-        entryDn = new DN( "cn=Alex,ou=users,ou=system" );
+        entryDn = DNFactory.create( "cn=Alex,ou=users,ou=system" );
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
     }
 }



Mime
View raw message