directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r987611 [2/13] - 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/event/ core-api/src/main/java/org/apache/dir...
Date Fri, 20 Aug 2010 19:32:02 GMT
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java Fri Aug 20 19:31:58 2010
@@ -56,15 +56,15 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.AddRequest;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.CompareRequest;
+import org.apache.directory.shared.ldap.message.DeleteRequest;
+import org.apache.directory.shared.ldap.message.ModifyDnRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.UnbindRequest;
 import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -85,15 +85,15 @@ public class MockCoreSession implements 
     private DirectoryService directoryService;
     private final LdapPrincipal authenticatedPrincipal;
     private LdapPrincipal authorizedPrincipal;
-    
-    
+
+
     public MockCoreSession( LdapPrincipal principal, DirectoryService directoryService )
     {
         this.directoryService = directoryService;
         this.authenticatedPrincipal = principal;
     }
 
-    
+
     /**
      * Set the ignoreRefferal flag for the current operationContext.
      *
@@ -111,8 +111,8 @@ public class MockCoreSession implements 
             opContext.throwReferral();
         }
     }
-    
-    
+
+
     /**
      * {@inheritDoc} 
      */
@@ -139,7 +139,7 @@ public class MockCoreSession implements 
         AddOperationContext addContext = new AddOperationContext( this, entry );
 
         addContext.setLogChange( log );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( addContext );
     }
@@ -154,7 +154,7 @@ public class MockCoreSession implements 
 
         addContext.setLogChange( log );
         setReferralHandling( addContext, ignoreReferral );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( addContext );
     }
@@ -163,43 +163,43 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void add( InternalAddRequest addRequest ) throws LdapException
+    public void add( AddRequest addRequest ) throws LdapException
     {
         add( addRequest, LogChange.TRUE );
     }
 
-    
+
     /**
      * {@inheritDoc} 
      */
-    public void add( InternalAddRequest addRequest, LogChange log ) throws LdapException
+    public void add( AddRequest addRequest, LogChange log ) throws LdapException
     {
         AddOperationContext addContext = new AddOperationContext( this, addRequest );
 
         addContext.setLogChange( log );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( addContext );
-        addRequest.getResultResponse().addAll( addContext.getResponseControls() );
+        addRequest.getResultResponse().addAllControls( addContext.getResponseControls() );
     }
 
-    
+
     private Value<?> convertToValue( String oid, Object value ) throws LdapException
     {
         Value<?> val = null;
-        
+
         AttributeType attributeType = directoryService.getSchemaManager().lookupAttributeTypeRegistry( oid );
-        
+
         // make sure we add the request controls to operation
         if ( attributeType.getSyntax().isHumanReadable() )
         {
             if ( value instanceof String )
             {
-                val = new StringValue( attributeType, (String)value );
+                val = new StringValue( attributeType, ( String ) value );
             }
             else if ( value instanceof byte[] )
             {
-                val = new StringValue( attributeType, StringTools.utf8ToString( (byte[])value ) );
+                val = new StringValue( attributeType, StringTools.utf8ToString( ( byte[] ) value ) );
             }
             else
             {
@@ -210,31 +210,30 @@ public class MockCoreSession implements 
         {
             if ( value instanceof String )
             {
-                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
+                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( ( String ) value ) );
             }
             else if ( value instanceof byte[] )
             {
-                val = new BinaryValue( attributeType, (byte[])value );
+                val = new BinaryValue( attributeType, ( byte[] ) value );
             }
             else
             {
                 throw new LdapException( I18n.err( I18n.ERR_309, oid ) );
             }
         }
-        
+
         return val;
     }
 
+
     /**
      * {@inheritDoc}
      */
     public boolean compare( DN dn, String oid, Object value ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
-        return operationManager.compare( 
-            new CompareOperationContext( this, dn, oid, 
-                convertToValue( oid, value ) ) );
+
+        return operationManager.compare( new CompareOperationContext( this, dn, oid, convertToValue( oid, value ) ) );
     }
 
 
@@ -243,12 +242,11 @@ public class MockCoreSession implements 
      */
     public boolean compare( DN dn, String oid, Object value, boolean ignoreReferral ) throws LdapException
     {
-        CompareOperationContext compareContext =  
-                new CompareOperationContext( this, dn, oid, 
-                    convertToValue( oid, value ) );
-        
+        CompareOperationContext compareContext = new CompareOperationContext( this, dn, oid,
+            convertToValue( oid, value ) );
+
         setReferralHandling( compareContext, ignoreReferral );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         return operationManager.compare( compareContext );
     }
@@ -280,7 +278,7 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void delete( DN dn, boolean ignoreReferral  ) throws LdapException
+    public void delete( DN dn, boolean ignoreReferral ) throws LdapException
     {
         delete( dn, ignoreReferral, LogChange.TRUE );
     }
@@ -292,7 +290,7 @@ public class MockCoreSession implements 
     public void delete( DN dn, boolean ignoreReferral, LogChange log ) throws LdapException
     {
         DeleteOperationContext deleteContext = new DeleteOperationContext( this, dn );
-        
+
         deleteContext.setLogChange( log );
         setReferralHandling( deleteContext, ignoreReferral );
 
@@ -357,7 +355,7 @@ public class MockCoreSession implements 
         {
             return authenticatedPrincipal;
         }
-        
+
         return authorizedPrincipal;
     }
 
@@ -400,8 +398,8 @@ public class MockCoreSession implements 
         // TODO Auto-generated method stub
         return true;
     }
-    
-    
+
+
     /**
      * TODO - perhaps we should just use a flag that is calculated on creation
      * of this session
@@ -410,7 +408,7 @@ public class MockCoreSession implements 
      */
     public boolean isAdministrator()
     {
-        String normName = getEffectivePrincipal().getName(); 
+        String normName = getEffectivePrincipal().getName();
         return normName.equals( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
     }
 
@@ -431,7 +429,7 @@ public class MockCoreSession implements 
         {
             return true;
         }
-        
+
         // TODO fix this so it checks groups
         return false;
     }
@@ -444,10 +442,10 @@ public class MockCoreSession implements 
         Set<AttributeTypeOptions> returningAttributes ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         ListOperationContext listContext = new ListOperationContext( this, dn, returningAttributes );
         listContext.setAliasDerefMode( aliasDerefMode );
-        
+
         return operationManager.list( listContext );
     }
 
@@ -464,7 +462,7 @@ public class MockCoreSession implements 
         listContext.setSizeLimit( sizeLimit );
         listContext.setTimeLimit( timeLimit );
         listContext.setAliasDerefMode( aliasDerefMode );
-     
+
         return operationManager.list( listContext );
     }
 
@@ -485,8 +483,7 @@ public class MockCoreSession implements 
     public Entry lookup( DN dn, String[] attrId ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        return operationManager.lookup( 
-            new LookupOperationContext( this, dn, attrId ) );
+        return operationManager.lookup( new LookupOperationContext( this, dn, attrId ) );
     }
 
 
@@ -508,14 +505,14 @@ public class MockCoreSession implements 
         {
             return;
         }
-        
+
         List<Modification> serverModifications = new ArrayList<Modification>( mods.size() );
-        
-        for ( Modification mod:mods )
+
+        for ( Modification mod : mods )
         {
             serverModifications.add( new DefaultModification( directoryService.getSchemaManager(), mod ) );
         }
-        
+
         ModifyOperationContext modifyContext = new ModifyOperationContext( this, dn, serverModifications );
 
         modifyContext.setLogChange( log );
@@ -543,16 +540,16 @@ public class MockCoreSession implements 
         {
             return;
         }
-        
+
         List<Modification> serverModifications = new ArrayList<Modification>( mods.size() );
-        
-        for ( Modification mod:mods )
+
+        for ( Modification mod : mods )
         {
             serverModifications.add( new DefaultModification( directoryService.getSchemaManager(), mod ) );
         }
 
         ModifyOperationContext modifyContext = new ModifyOperationContext( this, dn, serverModifications );
-        
+
         setReferralHandling( modifyContext, ignoreReferral );
         modifyContext.setLogChange( log );
 
@@ -576,7 +573,7 @@ public class MockCoreSession implements 
     public void move( DN dn, DN newParent, LogChange log ) throws LdapException
     {
         MoveOperationContext moveContext = new MoveOperationContext( this, dn, newParent );
-        
+
         moveContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -600,7 +597,7 @@ public class MockCoreSession implements 
     {
         OperationManager operationManager = directoryService.getOperationManager();
         MoveOperationContext moveContext = new MoveOperationContext( this, dn, newParent );
-        
+
         setReferralHandling( moveContext, ignoreReferral );
         moveContext.setLogChange( log );
 
@@ -620,11 +617,12 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, LogChange log ) throws LdapException
+    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, LogChange log )
+        throws LdapException
     {
-        MoveAndRenameOperationContext moveAndRenameContext = 
-            new MoveAndRenameOperationContext( this, dn, newParent, newRdn, deleteOldRdn );
-        
+        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn, newParent,
+            newRdn, deleteOldRdn );
+
         moveAndRenameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -635,7 +633,8 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral ) throws LdapException
+    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral )
+        throws LdapException
     {
         moveAndRename( dn, newParent, newRdn, deleteOldRdn, ignoreReferral, LogChange.TRUE );
     }
@@ -644,11 +643,13 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log ) throws LdapException
+    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral,
+        LogChange log ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn, newParent, newRdn, deleteOldRdn );
-        
+        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn, newParent,
+            newRdn, deleteOldRdn );
+
         moveAndRenameContext.setLogChange( log );
         setReferralHandling( moveAndRenameContext, ignoreReferral );
 
@@ -671,7 +672,7 @@ public class MockCoreSession implements 
     public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, LogChange log ) throws LdapException
     {
         RenameOperationContext renameContext = new RenameOperationContext( this, dn, newRdn, deleteOldRdn );
-        
+
         renameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -691,11 +692,12 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log ) throws LdapException
+    public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log )
+        throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
         RenameOperationContext renameContext = new RenameOperationContext( this, dn, newRdn, deleteOldRdn );
-        
+
         renameContext.setLogChange( log );
         setReferralHandling( renameContext, ignoreReferral );
 
@@ -719,24 +721,24 @@ public class MockCoreSession implements 
     {
         OperationManager operationManager = directoryService.getOperationManager();
         ExprNode filterNode = null;
-        
+
         try
         {
-            FilterParser.parse( directoryService.getSchemaManager(), filter ); 
+            FilterParser.parse( directoryService.getSchemaManager(), filter );
         }
         catch ( ParseException pe )
         {
             throw new LdapInvalidSearchFilterException( pe.getMessage() );
         }
-        
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, 
-            filterNode, null );
+
+        SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, filterNode,
+            null );
         searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
         setReferralHandling( searchContext, ignoreReferrals );
 
         return operationManager.search( searchContext );
     }
-    
+
 
     /* (non-Javadoc)
      * @see org.apache.directory.server.core.CoreSession#search(org.apache.directory.shared.ldap.name.DN, org.apache.directory.shared.ldap.filter.SearchScope, org.apache.directory.shared.ldap.filter.ExprNode, org.apache.directory.shared.ldap.message.AliasDerefMode, java.util.Set)
@@ -745,9 +747,8 @@ public class MockCoreSession implements 
         Set<AttributeTypeOptions> returningAttributes ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, 
-            filter, returningAttributes );
+
+        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
         searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
 
         return operationManager.search( searchContext );
@@ -761,7 +762,7 @@ public class MockCoreSession implements 
         Set<AttributeTypeOptions> returningAttributes, long sizeLimit, int timeLimit ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
         searchContext.setSizeLimit( sizeLimit );
         searchContext.setTimeLimit( timeLimit );
@@ -780,12 +781,12 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public boolean compare( InternalCompareRequest compareRequest ) throws LdapException
+    public boolean compare( CompareRequest compareRequest ) throws LdapException
     {
         CompareOperationContext compareContext = new CompareOperationContext( this, compareRequest );
         OperationManager operationManager = directoryService.getOperationManager();
         boolean result = operationManager.compare( compareContext );
-        compareRequest.getResultResponse().addAll( compareContext.getResponseControls() );
+        compareRequest.getResultResponse().addAllControls( compareContext.getResponseControls() );
         return result;
     }
 
@@ -793,7 +794,7 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void delete( InternalDeleteRequest deleteRequest ) throws LdapException
+    public void delete( DeleteRequest deleteRequest ) throws LdapException
     {
         delete( deleteRequest, LogChange.TRUE );
     }
@@ -802,15 +803,15 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void delete( InternalDeleteRequest deleteRequest, LogChange log ) throws LdapException
+    public void delete( DeleteRequest deleteRequest, LogChange log ) throws LdapException
     {
         DeleteOperationContext deleteContext = new DeleteOperationContext( this, deleteRequest );
-        
+
         deleteContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.delete( deleteContext );
-        deleteRequest.getResultResponse().addAll( deleteContext.getResponseControls() );
+        deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
     }
 
 
@@ -825,7 +826,7 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void modify( InternalModifyRequest modifyRequest ) throws LdapException
+    public void modify( ModifyRequest modifyRequest ) throws LdapException
     {
         modify( modifyRequest, LogChange.TRUE );
     }
@@ -834,7 +835,7 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void modify( InternalModifyRequest modifyRequest, LogChange log ) throws LdapException
+    public void modify( ModifyRequest modifyRequest, LogChange log ) throws LdapException
     {
         ModifyOperationContext modifyContext = new ModifyOperationContext( this, modifyRequest );
 
@@ -842,14 +843,14 @@ public class MockCoreSession implements 
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.modify( modifyContext );
-        modifyRequest.getResultResponse().addAll( modifyContext.getResponseControls() );
+        modifyRequest.getResultResponse().addAllControls( modifyContext.getResponseControls() );
     }
 
 
     /**
      * {@inheritDoc} 
      */
-    public void move( InternalModifyDnRequest modifyDnRequest ) throws LdapException
+    public void move( ModifyDnRequest modifyDnRequest ) throws LdapException
     {
         move( modifyDnRequest, LogChange.TRUE );
     }
@@ -858,22 +859,22 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void move( InternalModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
+    public void move( ModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
     {
         MoveOperationContext moveContext = new MoveOperationContext( this, modifyDnRequest );
-        
+
         moveContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.move( moveContext );
-        modifyDnRequest.getResultResponse().addAll( moveContext.getResponseControls() );
+        modifyDnRequest.getResultResponse().addAllControls( moveContext.getResponseControls() );
     }
 
 
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( InternalModifyDnRequest modifyDnRequest ) throws LdapException
+    public void moveAndRename( ModifyDnRequest modifyDnRequest ) throws LdapException
     {
         moveAndRename( modifyDnRequest, LogChange.TRUE );
     }
@@ -882,7 +883,7 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( InternalModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
+    public void moveAndRename( ModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
     {
         MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, modifyDnRequest );
 
@@ -890,14 +891,14 @@ public class MockCoreSession implements 
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.moveAndRename( moveAndRenameContext );
-        modifyDnRequest.getResultResponse().addAll( moveAndRenameContext.getResponseControls() );
+        modifyDnRequest.getResultResponse().addAllControls( moveAndRenameContext.getResponseControls() );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void rename( InternalModifyDnRequest modifyDnRequest ) throws LdapException
+    public void rename( ModifyDnRequest modifyDnRequest ) throws LdapException
     {
         rename( modifyDnRequest, LogChange.TRUE );
     }
@@ -906,7 +907,7 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void rename( InternalModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
+    public void rename( ModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
     {
         RenameOperationContext renameContext = new RenameOperationContext( this, modifyDnRequest );
 
@@ -914,17 +915,17 @@ public class MockCoreSession implements 
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.rename( renameContext );
-        modifyDnRequest.getResultResponse().addAll( renameContext.getResponseControls() );
+        modifyDnRequest.getResultResponse().addAllControls( renameContext.getResponseControls() );
     }
 
 
-    public EntryFilteringCursor search( InternalSearchRequest searchRequest ) throws LdapException
+    public EntryFilteringCursor search( SearchRequest searchRequest ) throws LdapException
     {
         SearchOperationContext searchContext = new SearchOperationContext( this, searchRequest );
         OperationManager operationManager = directoryService.getOperationManager();
         EntryFilteringCursor cursor = operationManager.search( searchContext );
-        searchRequest.getResultResponse().addAll( searchContext.getResponseControls() );
-        
+        searchRequest.getResultResponse().addAllControls( searchContext.getResponseControls() );
+
         return cursor;
     }
 
@@ -936,10 +937,10 @@ public class MockCoreSession implements 
     }
 
 
-    public void unbind( InternalUnbindRequest unbindRequest )
+    public void unbind( UnbindRequest unbindRequest )
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 

Propchange: directory/apacheds/trunk/core-avl/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 20 19:31:58 2010
@@ -1,2 +1,2 @@
+/directory/apacheds/branches/apacheds-codec-merge/core-avl:982369-987590
 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-avl:980138-980934
-/directory/apacheds/trunk/core-avl:980025-980137

Propchange: directory/apacheds/trunk/core-constants/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 20 19:31:58 2010
@@ -1,2 +1,2 @@
+/directory/apacheds/branches/apacheds-codec-merge/core-constants:982369-987590
 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-constants:980138-980934
-/directory/apacheds/trunk/core-constants:980025-980137

Propchange: directory/apacheds/trunk/core-integ/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 20 19:31:58 2010
@@ -1 +1,2 @@
+/directory/apacheds/branches/apacheds-codec-merge/core-integ:982369-987590
 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-integ:980138-980934

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java Fri Aug 20 19:31:58 2010
@@ -25,11 +25,6 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.AddResponse;
-import org.apache.directory.ldap.client.api.message.ModifyDnResponse;
-import org.apache.directory.ldap.client.api.message.ModifyResponse;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
@@ -39,7 +34,12 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.message.AddResponse;
+import org.apache.directory.shared.ldap.message.ModifyDnResponse;
+import org.apache.directory.shared.ldap.message.ModifyResponse;
+import org.apache.directory.shared.ldap.message.Response;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -51,7 +51,7 @@ import org.junit.runner.RunWith;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
 public class AdministrativePointServiceIT extends AbstractLdapTestUnit
 {
     // The shared LDAP connection
@@ -74,15 +74,16 @@ public class AdministrativePointServiceI
 
     private Entry getAdminRole( String dn ) throws Exception
     {
-        SearchResponse lookup = connection.lookup( dn, "administrativeRole" );
+        Response lookup = connection.lookup( dn, "administrativeRole" );
 
         assertTrue( lookup instanceof SearchResultEntry );
 
-        Entry entry = ((SearchResultEntry)lookup).getEntry();
+        Entry entry = ( ( SearchResultEntry ) lookup ).getEntry();
 
         return entry;
     }
 
+
     // -------------------------------------------------------------------
     // Test the Add operation
     // -------------------------------------------------------------------
@@ -93,13 +94,8 @@ public class AdministrativePointServiceI
     @Test
     public void testAddAutonomousArea() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea",
-            "administrativeRole: autonomousArea"
-            );
+        Entry autonomousArea = LdifUtils.createEntry( "ou=autonomousArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea", "administrativeRole: autonomousArea" );
 
         // It should succeed
         AddResponse response = connection.add( autonomousArea );
@@ -115,17 +111,11 @@ public class AdministrativePointServiceI
         assertFalse( entry.contains( "administrativeRole", "2.5.23.4" ) );
         assertFalse( entry.contains( "administrativeRole", "triggerExecutionSpecificArea" ) );
 
-        autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea2, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea2",
-            "administrativeRole: autonomousArea",
-            "administrativeRole: accessControlSpecificArea",
-            "administrativeRole: collectiveAttributeInnerArea",
+        autonomousArea = LdifUtils.createEntry( "ou=autonomousArea2, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea2", "administrativeRole: autonomousArea",
+            "administrativeRole: accessControlSpecificArea", "administrativeRole: collectiveAttributeInnerArea",
             "administrativeRole: 2.5.23.4", // This is the subSchemaSpecificArea OID
-            "administrativeRole: TRIGGEREXECUTIONSPECIFICAREA"
-            );
+            "administrativeRole: TRIGGEREXECUTIONSPECIFICAREA" );
 
         // It should fail, as an autonomous area is already defining the specific areas
         response = connection.add( autonomousArea );
@@ -141,14 +131,9 @@ public class AdministrativePointServiceI
     @Test
     public void testAddSpecificAreas() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea",
-            "administrativeRole: accessControlSpecificArea",
-            "administrativeRole: TRIGGEREXECUTIONSPECIFICAREA"
-            );
+        Entry autonomousArea = LdifUtils.createEntry( "ou=autonomousArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea", "administrativeRole: accessControlSpecificArea",
+            "administrativeRole: TRIGGEREXECUTIONSPECIFICAREA" );
 
         AddResponse response = connection.add( autonomousArea );
 
@@ -157,7 +142,6 @@ public class AdministrativePointServiceI
         // Check that the entry is containing all the roles
         Entry entry = getAdminRole( "ou=autonomousArea, ou=system" );
 
-
         assertFalse( entry.contains( "administrativeRole", "autonomousArea" ) );
         assertTrue( entry.contains( "administrativeRole", "accessControlSpecificArea" ) );
         assertFalse( entry.contains( "administrativeRole", "collectiveAttributeSpecificArea" ) );
@@ -173,14 +157,9 @@ public class AdministrativePointServiceI
     @Test
     public void testAddInnerAreas() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea",
-            "administrativeRole: accessControlINNERArea",
-            "administrativeRole: TRIGGEREXECUTIONINNERAREA"
-            );
+        Entry autonomousArea = LdifUtils.createEntry( "ou=autonomousArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea", "administrativeRole: accessControlINNERArea",
+            "administrativeRole: TRIGGEREXECUTIONINNERAREA" );
 
         AddResponse response = connection.add( autonomousArea );
 
@@ -202,14 +181,9 @@ public class AdministrativePointServiceI
     @Test
     public void testAddInvalidRole() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea",
-            "administrativeRole: accessControlBadArea",
-            "administrativeRole: TRIGGEREXECUTIONINNERAREA"
-            );
+        Entry autonomousArea = LdifUtils.createEntry( "ou=autonomousArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea", "administrativeRole: accessControlBadArea",
+            "administrativeRole: TRIGGEREXECUTIONINNERAREA" );
 
         AddResponse response = connection.add( autonomousArea );
 
@@ -224,14 +198,9 @@ public class AdministrativePointServiceI
     @Test
     public void testAddInnerAndSpecificRole() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea",
-            "administrativeRole: accessControlSpecificArea",
-            "administrativeRole: accessControlInnerArea"
-            );
+        Entry autonomousArea = LdifUtils.createEntry( "ou=autonomousArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea", "administrativeRole: accessControlSpecificArea",
+            "administrativeRole: accessControlInnerArea" );
 
         AddResponse response = connection.add( autonomousArea );
 
@@ -250,20 +219,14 @@ public class AdministrativePointServiceI
     public void testModifyAddSpecificArea() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.ADD_ATTRIBUTE,
-                                            new DefaultEntryAttribute( "administrativeRole", "accessControlSpecificArea" ) );
+        Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "accessControlSpecificArea" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
@@ -282,21 +245,14 @@ public class AdministrativePointServiceI
     public void testModifyAddInnerArea() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.ADD_ATTRIBUTE,
-                                            new DefaultEntryAttribute(
-                                                "administrativeRole", "accessControlInnerArea" ) );
+        Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "accessControlInnerArea" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
@@ -315,21 +271,14 @@ public class AdministrativePointServiceI
     public void testModifyAddInnerAreaToSameSpecificArea() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.ADD_ATTRIBUTE,
-                                            new DefaultEntryAttribute(
-                                                "administrativeRole", "collectiveAttributeInnerArea" ) );
+        Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "collectiveAttributeInnerArea" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
@@ -344,21 +293,14 @@ public class AdministrativePointServiceI
     public void testModifyAddSameSpecificArea() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.ADD_ATTRIBUTE,
-                                            new DefaultEntryAttribute(
-                                                "administrativeRole", "collectiveAttributeSpecificArea" ) );
+        Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "collectiveAttributeSpecificArea" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         assertEquals( ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS, response.getLdapResult().getResultCode() );
@@ -373,21 +315,15 @@ public class AdministrativePointServiceI
     public void testModifyDeleteAll() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea",
-            "administrativeRole: accessControlSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.REMOVE_ATTRIBUTE,
-                                            new DefaultEntryAttribute( "administrativeRole" ) );
+        Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
@@ -405,23 +341,16 @@ public class AdministrativePointServiceI
     public void testModifyDeleteAll2() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea",
-            "administrativeRole: accessControlSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.REMOVE_ATTRIBUTE,
-                                            new DefaultEntryAttribute(
-                                                "administrativeRole",
-                                                    "collectiveAttributeSpecificArea", "accessControlSpecificArea" ) );
+        Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "collectiveAttributeSpecificArea",
+                "accessControlSpecificArea" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
@@ -439,23 +368,15 @@ public class AdministrativePointServiceI
     public void testModifyDeleteSomeRole() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea",
-            "administrativeRole: accessControlSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.REMOVE_ATTRIBUTE,
-                                            new DefaultEntryAttribute(
-                                                "administrativeRole",
-                                                    "accessControlSpecificArea" ) );
+        Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "accessControlSpecificArea" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
@@ -475,23 +396,15 @@ public class AdministrativePointServiceI
     public void testModifyDeleteSomeInexistingRole() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea",
-            "administrativeRole: accessControlSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.REMOVE_ATTRIBUTE,
-                                            new DefaultEntryAttribute(
-                                                "administrativeRole",
-                                                    "triggerExecutionSpecificArea" ) );
+        Modification modification = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "triggerExecutionSpecificArea" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         assertEquals( ResultCodeEnum.NO_SUCH_ATTRIBUTE, response.getLdapResult().getResultCode() );
@@ -506,30 +419,20 @@ public class AdministrativePointServiceI
     public void testModifyCombined() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea",
-            "administrativeRole: accessControlSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea" );
 
         connection.add( caArea );
 
         // Add another specific area
-        Modification modification1 = new DefaultModification(
-            ModificationOperation.ADD_ATTRIBUTE,
-            new DefaultEntryAttribute(
-                "administrativeRole",
-                    "triggerExecutionSpecificArea" ) );
-        Modification modification2 = new DefaultModification(
-            ModificationOperation.REMOVE_ATTRIBUTE,
-            new DefaultEntryAttribute(
-                "administrativeRole",
-                    "triggerExecutionSpecificArea" ) );
+        Modification modification1 = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "triggerExecutionSpecificArea" ) );
+        Modification modification2 = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "triggerExecutionSpecificArea" ) );
 
-        ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification1, modification2, modification1);
+        ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification1, modification2,
+            modification1 );
 
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
         Entry entry = getAdminRole( "ou=caArea, ou=system" );
@@ -549,20 +452,14 @@ public class AdministrativePointServiceI
     public void testModifyReplace() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
-            "ou=caArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: caArea",
-            "administrativeRole: collectiveAttributeSpecificArea"
-            );
+        Entry caArea = LdifUtils.createEntry( "ou=caArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: caArea", "administrativeRole: collectiveAttributeSpecificArea" );
 
         connection.add( caArea );
 
         // Try to modify it to an InnerArea
-        Modification modification = new DefaultModification(
-                                            ModificationOperation.REPLACE_ATTRIBUTE,
-                                            new DefaultEntryAttribute( "administrativeRole", "collectiveAttributeSpecificArea" ) );
+        Modification modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
+            new DefaultEntryAttribute( "administrativeRole", "collectiveAttributeSpecificArea" ) );
         ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification );
 
         // Should fail
@@ -581,13 +478,8 @@ public class AdministrativePointServiceI
     public void testMoveAutonomousArea() throws Exception
     {
         // Inject an AAA
-        Entry autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea",
-            "administrativeRole: autonomousArea"
-            );
+        Entry autonomousArea = LdifUtils.createEntry( "ou=autonomousArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea", "administrativeRole: autonomousArea" );
 
         connection.add( autonomousArea );
 
@@ -609,18 +501,14 @@ public class AdministrativePointServiceI
     public void testMoveAndRenameAutonomousArea() throws Exception
     {
         // Inject an AAA
-        Entry autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea",
-            "administrativeRole: autonomousArea"
-            );
+        Entry autonomousArea = LdifUtils.createEntry( "ou=autonomousArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea", "administrativeRole: autonomousArea" );
 
         connection.add( autonomousArea );
 
         // It should fail, as we haven't injected all the roles
-        ModifyDnResponse response = connection.moveAndRename( "ou=autonomousArea, ou=system", "ou=new autonomousArea, uid=admin, ou=system" );
+        ModifyDnResponse response = connection.moveAndRename( "ou=autonomousArea, ou=system",
+            "ou=new autonomousArea, uid=admin, ou=system" );
 
         assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
     }
@@ -637,13 +525,8 @@ public class AdministrativePointServiceI
     public void testRenameAutonomousArea() throws Exception
     {
         // Inject an AAA
-        Entry autonomousArea = LdifUtils.createEntry(
-            "ou=autonomousArea, ou=system",
-            "ObjectClass: top",
-            "ObjectClass: organizationalUnit",
-            "ou: autonomousArea",
-            "administrativeRole: autonomousArea"
-            );
+        Entry autonomousArea = LdifUtils.createEntry( "ou=autonomousArea, ou=system", "ObjectClass: top",
+            "ObjectClass: organizationalUnit", "ou: autonomousArea", "administrativeRole: autonomousArea" );
 
         connection.add( autonomousArea );
 

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java Fri Aug 20 19:31:58 2010
@@ -29,16 +29,17 @@ import static org.junit.Assert.assertTru
 
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.BindResponse;
-import org.apache.directory.ldap.client.api.message.ModifyRequest;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.message.BindResponse;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.After;
@@ -53,7 +54,7 @@ import org.junit.runner.RunWith;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(FrameworkRunner.class)
-@CreateDS( name="SimpleAuthenticationIT-DS" )
+@CreateDS(name = "SimpleAuthenticationIT-DS")
 public class SimpleAuthenticationIT extends AbstractLdapTestUnit
 {
     /**
@@ -202,7 +203,8 @@ public class SimpleAuthenticationIT exte
         assertTrue( entry.get( "roomnumber" ).contains( "4612" ) );
 
         // now modify the password for akarasulu
-        ModifyRequest modReq = new ModifyRequest( new DN( userDn ) );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( new DN( userDn ) );
         modReq.replace( "userPassword", "newpwd" );
         connection.modify( modReq );
 
@@ -252,7 +254,8 @@ public class SimpleAuthenticationIT exte
         assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using SHA
-        ModifyRequest modReq = new ModifyRequest( new DN( userDn ) );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( new DN( userDn ) );
         modReq.replace( "userPassword", "{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ=" );
         connection.modify( modReq );
 
@@ -293,7 +296,8 @@ public class SimpleAuthenticationIT exte
         assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using SHA
-        ModifyRequest modReq = new ModifyRequest( new DN( userDn ) );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( new DN( userDn ) );
         modReq.replace( "userPassword", "{SSHA}mjVVxasFkk59wMW4L1Ldt+YCblfhULHs03WW7g==" );
         connection.modify( modReq );
 
@@ -332,7 +336,8 @@ public class SimpleAuthenticationIT exte
         assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'test123', encrypted using SHA with a 4 bytes salt
-        ModifyRequest modReq = new ModifyRequest( new DN( userDn ) );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( new DN( userDn ) );
         modReq.replace( "userPassword", "{SSHA}0TT388zsWzHKtMEpIU/8/W68egchNEWp" );
         connection.modify( modReq );
 
@@ -371,7 +376,8 @@ public class SimpleAuthenticationIT exte
         assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using MD5
-        ModifyRequest modReq = new ModifyRequest( new DN( userDn ) );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( new DN( userDn ) );
         modReq.replace( "userPassword", "{MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ==" );
         connection.modify( modReq );
 
@@ -411,7 +417,8 @@ public class SimpleAuthenticationIT exte
         assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using SMD5
-        ModifyRequest modReq = new ModifyRequest( new DN( userDn ) );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( new DN( userDn ) );
         modReq.replace( "userPassword", "{SMD5}tQ9wo/VBuKsqBtylMMCcORbnYOJFMyDJ" );
         connection.modify( modReq );
 
@@ -450,7 +457,8 @@ public class SimpleAuthenticationIT exte
         assertTrue( entry.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using CRYPT
-        ModifyRequest modReq = new ModifyRequest( new DN( userDn ) );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( new DN( userDn ) );
         modReq.replace( "userPassword", "{crypt}qFkH8Z1woBlXw" );
         connection.modify( modReq );
 
@@ -490,7 +498,8 @@ public class SimpleAuthenticationIT exte
         connection.bind( adminUserDn, "secret" );
 
         // now modify the password for akarasulu (while we're admin)
-        ModifyRequest modReq = new ModifyRequest( new DN( userDn ) );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( new DN( userDn ) );
         modReq.replace( "userPassword", "newpwd" );
         connection.modify( modReq );
         connection.close();

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java Fri Aug 20 19:31:58 2010
@@ -32,11 +32,6 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.AbstractResponseWithResult;
-import org.apache.directory.ldap.client.api.message.AddRequest;
-import org.apache.directory.ldap.client.api.message.AddResponse;
-import org.apache.directory.ldap.client.api.message.ModifyRequest;
-import org.apache.directory.ldap.client.api.message.ModifyResponse;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.CreateDS;
@@ -56,6 +51,13 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.message.AddRequest;
+import org.apache.directory.shared.ldap.message.AddRequestImpl;
+import org.apache.directory.shared.ldap.message.AddResponse;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
+import org.apache.directory.shared.ldap.message.ModifyResponse;
+import org.apache.directory.shared.ldap.message.Response;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.control.Control;
 import org.apache.directory.shared.ldap.name.DN;
@@ -65,21 +67,17 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+
 /**
  * Test cases for testing PasswordPolicy implementation.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(FrameworkRunner.class)
-@CreateLdapServer ( 
-    transports = 
-    {
-        @CreateTransport( protocol = "LDAP" ), 
-        @CreateTransport( protocol = "LDAPS" ) 
-    })
-
+@CreateLdapServer(transports =
+    { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
 // disable changelog, for more info see DIRSERVER-1528
-@CreateDS( enableChangeLog=false)
+@CreateDS(enableChangeLog = false)
 public class PasswordPolicyTest extends AbstractLdapTestUnit
 {
     private PasswordPolicyConfiguration policyConfig;
@@ -93,7 +91,7 @@ public class PasswordPolicyTest extends 
     public void setPwdPolicy() throws LdapException
     {
         policyConfig = new PasswordPolicyConfiguration();
-        
+
         policyConfig.setPwdMaxAge( 110 );
         policyConfig.setPwdFailureCountInterval( 30 );
         policyConfig.setPwdMaxFailure( 2 );
@@ -108,7 +106,7 @@ public class PasswordPolicyTest extends 
         AuthenticationInterceptor authInterceptor = ( AuthenticationInterceptor ) service
             .getInterceptor( AuthenticationInterceptor.class.getName() );
         authInterceptor.setPwdPolicyConfig( policyConfig );
-        
+
         authInterceptor.loadPwdPolicyStateAtributeTypes();
     }
 
@@ -126,17 +124,14 @@ public class PasswordPolicyTest extends 
         LdapConnection connection = getAdminNetworkConnection( ldapServer );
 
         DN userDn = new DN( "cn=user,ou=system" );
-        Entry userEntry = LdifUtils.createEntry( userDn, 
-            "ObjectClass: top",
-            "ObjectClass: person",
-            "cn: user",
-            "sn: user_sn",
-            "userPassword: 1234" ); 
+        Entry userEntry = LdifUtils.createEntry( userDn, "ObjectClass: top", "ObjectClass: person", "cn: user",
+            "sn: user_sn", "userPassword: 1234" );
 
-        AddRequest addReq = new AddRequest( userEntry );
-        addReq.add( PP_REQ_CTRL );
+        AddRequest addRequest = new AddRequestImpl();
+        addRequest.setEntry( userEntry );
+        addRequest.addControl( PP_REQ_CTRL );
 
-        AddResponse addResp = connection.add( addReq );
+        AddResponse addResp = connection.add( addRequest );
         assertEquals( ResultCodeEnum.CONSTRAINT_VIOLATION, addResp.getLdapResult().getResultCode() );
 
         PasswordPolicyResponseControl respCtrl = getPwdRespCtrl( addResp );
@@ -146,8 +141,8 @@ public class PasswordPolicyTest extends 
         EntryAttribute pwdAt = userEntry.get( SchemaConstants.USER_PASSWORD_AT );
         pwdAt.clear();
         pwdAt.add( "12345" );
-        
-        addResp = connection.add( addReq );
+
+        addResp = connection.add( addRequest );
         assertEquals( ResultCodeEnum.SUCCESS, addResp.getLdapResult().getResultCode() );
         respCtrl = getPwdRespCtrl( addResp );
         assertNull( respCtrl );
@@ -163,10 +158,11 @@ public class PasswordPolicyTest extends 
     {
         LdapConnection connection = getAdminNetworkConnection( ldapServer );
 
-        byte[] password = PasswordUtil.encryptPassword( "12345".getBytes(), LdapSecurityConstants.HASH_METHOD_CRYPT, null );
+        byte[] password = PasswordUtil.encryptPassword( "12345".getBytes(), LdapSecurityConstants.HASH_METHOD_CRYPT,
+            null );
         String strPwd = "{crypt}" + StringTools.utf8ToString( password );
         password = strPwd.getBytes();
-        
+
         DN userDn = new DN( "cn=hashedpwd,ou=system" );
         Entry userEntry = new DefaultEntry( userDn );
         userEntry.add( SchemaConstants.OBJECT_CLASS, SchemaConstants.PERSON_OC );
@@ -174,10 +170,11 @@ public class PasswordPolicyTest extends 
         userEntry.add( SchemaConstants.SN_AT, "hashedpwd_sn" );
         userEntry.add( SchemaConstants.USER_PASSWORD_AT, password );
 
-        AddRequest addReq = new AddRequest( userEntry );
-        addReq.add( PP_REQ_CTRL );
+        AddRequest addRequest = new AddRequestImpl();
+        addRequest.setEntry( userEntry );
+        addRequest.addControl( PP_REQ_CTRL );
 
-        AddResponse addResp = connection.add( addReq );
+        AddResponse addResp = connection.add( addRequest );
         assertEquals( ResultCodeEnum.CONSTRAINT_VIOLATION, addResp.getLdapResult().getResultCode() );
 
         PasswordPolicyResponseControl respCtrl = getPwdRespCtrl( addResp );
@@ -188,65 +185,66 @@ public class PasswordPolicyTest extends 
         EntryAttribute pwdAt = userEntry.get( SchemaConstants.USER_PASSWORD_AT );
         pwdAt.clear();
         pwdAt.add( password );
-        
-        addResp = connection.add( addReq );
+
+        addResp = connection.add( addRequest );
         assertEquals( ResultCodeEnum.SUCCESS, addResp.getLdapResult().getResultCode() );
         respCtrl = getPwdRespCtrl( addResp );
         assertNull( respCtrl );
 
-        LdapConnection userConnection = getNetworkConnectionAs( ldapServer, userDn.getName(), StringTools.utf8ToString( password ) );
+        LdapConnection userConnection = getNetworkConnectionAs( ldapServer, userDn.getName(), StringTools
+            .utf8ToString( password ) );
         assertNotNull( userConnection );
         assertTrue( userConnection.isAuthenticated() );
     }
 
-    
+
     @Test
     public void testPwdMinAge() throws Exception
     {
         policyConfig.setPwdMinAge( 5 );
-        
+
         LdapConnection connection = getAdminNetworkConnection( ldapServer );
-        
+
         DN userDn = new DN( "cn=userMinAge,ou=system" );
-        Entry userEntry = LdifUtils.createEntry( userDn, 
-            "ObjectClass: top",
-            "ObjectClass: person",
-            "cn: userMinAge",
-            "sn: userMinAge_sn",
-            "userPassword: 12345" ); 
+        Entry userEntry = LdifUtils.createEntry( userDn, "ObjectClass: top", "ObjectClass: person", "cn: userMinAge",
+            "sn: userMinAge_sn", "userPassword: 12345" );
 
-        AddRequest addReq = new AddRequest( userEntry );
-        addReq.add( PP_REQ_CTRL );
+        AddRequest addRequest = new AddRequestImpl();
+        addRequest.setEntry( userEntry );
+        addRequest.addControl( PP_REQ_CTRL );
 
-        AddResponse addResp = connection.add( addReq );
+        AddResponse addResp = connection.add( addRequest );
         assertEquals( ResultCodeEnum.SUCCESS, addResp.getLdapResult().getResultCode() );
 
         PasswordPolicyResponseControl respCtrl = getPwdRespCtrl( addResp );
         assertNull( respCtrl );
-        
-        ModifyRequest modReq = new ModifyRequest( userDn );
-        modReq.add( PP_REQ_CTRL );
+
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( userDn );
+        modReq.addControl( PP_REQ_CTRL );
         modReq.replace( SchemaConstants.USER_PASSWORD_AT, "123456" );
-        
+
         ModifyResponse modResp = connection.modify( modReq );
         assertEquals( ResultCodeEnum.CONSTRAINT_VIOLATION, modResp.getLdapResult().getResultCode() );
-        
+
         respCtrl = getPwdRespCtrl( modResp );
         assertEquals( PASSWORD_TOO_YOUNG, respCtrl.getPasswordPolicyError() );
-        
+
         Thread.sleep( 5000 );
-      
+
         modResp = connection.modify( modReq );
         assertEquals( ResultCodeEnum.SUCCESS, modResp.getLdapResult().getResultCode() );
-        
+
         LdapConnection userConnection = getNetworkConnectionAs( ldapServer, userDn.getName(), "123456" );
         assertNotNull( userConnection );
         assertTrue( userConnection.isAuthenticated() );
     }
 
-    private PasswordPolicyResponseControl getPwdRespCtrl( AbstractResponseWithResult resp ) throws Exception
+
+    private PasswordPolicyResponseControl getPwdRespCtrl( Response resp ) throws Exception
     {
-        Control ctrl = resp.getControl( PP_REQ_CTRL.getOid() );
+        Control ctrl = resp.getControls().get( PP_REQ_CTRL.getOid() );
+
         if ( ctrl == null )
         {
             return null;

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java Fri Aug 20 19:31:58 2010
@@ -28,7 +28,6 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.AddResponse;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
@@ -36,6 +35,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.AddResponse;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.After;
@@ -49,7 +49,7 @@ import org.junit.runner.RunWith;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
 public class AddAuthorizationIT extends AbstractLdapTestUnit
 {
 
@@ -59,15 +59,15 @@ public class AddAuthorizationIT extends 
         AutzIntegUtils.service = service;
         service.setAccessControlEnabled( true );
     }
-    
-    
+
+
     @After
     public void closeConnections()
     {
         IntegrationUtils.closeConnections();
     }
-    
-    
+
+
     /**
      * Checks if a simple entry (organizationalUnit) can be added to the DIT at an
      * RDN relative to ou=system by a specific non-admin user.  If a permission exception
@@ -92,17 +92,17 @@ public class AddAuthorizationIT extends 
             Entry entry = new DefaultEntry( new DN( "ou=testou,ou=system" ) );
             entry.add( SchemaConstants.OU_AT, "testou" );
             entry.add( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit" );
-            
+
             AddResponse resp = connection.add( entry );
-            
-            if( resp.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
+
+            if ( resp.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
             {
                 return false;
             }
 
             connection.delete( entry.getDn() );
             connection.close();
-            
+
             return true;
         }
         catch ( LdapException e )
@@ -128,24 +128,11 @@ public class AddAuthorizationIT extends 
 
         // Gives grantAdd perm to all users in the Administrators group for
         // entries and all attribute types and values
-        createAccessControlSubentry( 
-            "administratorAdd", 
-            "{ " + 
-            "  identificationTag \"addAci\", " + 
-            "  precedence 14, " +
-            "  authenticationLevel none, " + 
-            "  itemOrUserFirst userFirst: " +
-            "  { " +
-            "    userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " + 
-            "    userPermissions " +
-            "    { " +
-            "      { " +
-            "        protectedItems {entry, allUserAttributeTypesAndValues}, " +
-            "        grantsAndDenials { grantAdd, grantBrowse } " +
-            "      } " +
-            "    } " +
-            "  } " +
-            "}" );
+        createAccessControlSubentry( "administratorAdd", "{ " + "  identificationTag \"addAci\", "
+            + "  precedence 14, " + "  authenticationLevel none, " + "  itemOrUserFirst userFirst: " + "  { "
+            + "    userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " + "    userPermissions "
+            + "    { " + "      { " + "        protectedItems {entry, allUserAttributeTypesAndValues}, "
+            + "        grantsAndDenials { grantAdd, grantBrowse } " + "      } " + "    } " + "  } " + "}" );
 
         // see if we can now add that test entry which we could not before
         // add op should still fail since billd is not in the admin group
@@ -174,24 +161,11 @@ public class AddAuthorizationIT extends 
         assertFalse( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
 
         // now add a subentry that enables user billyd to add an entry below ou=system
-        createAccessControlSubentry( 
-            "billydAdd", 
-            "{ " + 
-            "  identificationTag \"addAci\", " + 
-            "  precedence 14, " +
-            "  authenticationLevel none, " + 
-            "  itemOrUserFirst userFirst: " +
-            "  { " +
-            "    userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " + 
-            "    userPermissions " +
-            "    { " +
-            "      { " +
-            "        protectedItems {entry, allUserAttributeTypesAndValues}, " +
-            "        grantsAndDenials { grantAdd, grantBrowse } " +
-            "      } " +
-            "    } " +
-            "  } " +
-            "}" );
+        createAccessControlSubentry( "billydAdd", "{ " + "  identificationTag \"addAci\", " + "  precedence 14, "
+            + "  authenticationLevel none, " + "  itemOrUserFirst userFirst: " + "  { "
+            + "    userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " + "    userPermissions " + "    { "
+            + "      { " + "        protectedItems {entry, allUserAttributeTypesAndValues}, "
+            + "        grantsAndDenials { grantAdd, grantBrowse } " + "      } " + "    } " + "  } " + "}" );
 
         // should work now that billyd is authorized by name
         assertTrue( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
@@ -213,27 +187,12 @@ public class AddAuthorizationIT extends 
         assertFalse( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
 
         // now add a subentry that enables user billyd to add an entry below ou=system
-        createAccessControlSubentry( 
-            "billyAddBySubtree", 
-            "{ " + 
-            "  identificationTag \"addAci\", " + 
-            "  precedence 14, " +
-            "  authenticationLevel none, " + 
-            "  itemOrUserFirst userFirst: " +
-            "  { " +
-            "    userClasses " +
-            "    { " +
-            "      subtree { { base \"ou=users,ou=system\" } } " +
-            "    }, " + 
-            "    userPermissions " +
-            "    { " +
-            "      { " +
-            "        protectedItems {entry, allUserAttributeTypesAndValues}, " +
-            "        grantsAndDenials { grantAdd, grantBrowse } " +
-            "      } " +
-            "    } " +
-            "  } " +
-            "}" );
+        createAccessControlSubentry( "billyAddBySubtree", "{ " + "  identificationTag \"addAci\", "
+            + "  precedence 14, " + "  authenticationLevel none, " + "  itemOrUserFirst userFirst: " + "  { "
+            + "    userClasses " + "    { " + "      subtree { { base \"ou=users,ou=system\" } } " + "    }, "
+            + "    userPermissions " + "    { " + "      { "
+            + "        protectedItems {entry, allUserAttributeTypesAndValues}, "
+            + "        grantsAndDenials { grantAdd, grantBrowse } " + "      } " + "    } " + "  } " + "}" );
 
         // should work now that billyd is authorized by the subtree userClass
         assertTrue( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
@@ -255,24 +214,11 @@ public class AddAuthorizationIT extends 
         assertFalse( checkCanAddEntryAs( "billyd", "billyd", "ou=testou" ) );
 
         // now add a subentry that enables anyone to add an entry below ou=system
-        createAccessControlSubentry( 
-            "anybodyAdd", 
-            "{ " + 
-            "  identificationTag \"addAci\", " + 
-            "  precedence 14, " +
-            "  authenticationLevel none, " + 
-            "  itemOrUserFirst userFirst: " +
-            "  { " + 
-            "    userClasses { allUsers }, " +
-            "    userPermissions " +
-            "    { " +
-            "      { " + 
-            "        protectedItems {entry, allUserAttributeTypesAndValues}, " +
-            "        grantsAndDenials { grantAdd, grantBrowse } " +
-            "      } " +
-            "    } " +
-            "  } " +
-            "}" );
+        createAccessControlSubentry( "anybodyAdd", "{ " + "  identificationTag \"addAci\", " + "  precedence 14, "
+            + "  authenticationLevel none, " + "  itemOrUserFirst userFirst: " + "  { "
+            + "    userClasses { allUsers }, " + "    userPermissions " + "    { " + "      { "
+            + "        protectedItems {entry, allUserAttributeTypesAndValues}, "
+            + "        grantsAndDenials { grantAdd, grantBrowse } " + "      } " + "    } " + "  } " + "}" );
 
         // see if we can now add that test entry which we could not before
         // should work now with billyd now that all users are authorized

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java Fri Aug 20 19:31:58 2010
@@ -27,11 +27,11 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.After;
 import org.junit.Before;
@@ -45,33 +45,34 @@ import org.junit.runner.RunWith;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
 public class AdministratorsGroupIT extends AbstractLdapTestUnit
 {
-    
+
     @Before
     public void setService()
     {
-       AutzIntegUtils.service = service;
+        AutzIntegUtils.service = service;
     }
-    
-    
+
+
     @After
     public void closeConnections()
     {
         IntegrationUtils.closeConnections();
     }
-    
-    
+
+
     boolean canReadAdministrators( LdapConnection connection ) throws Exception
     {
-        SearchResultEntry res = ( SearchResultEntry ) connection.lookup( "cn=Administrators,ou=groups,ou=system" );
-        
-        if( res == null )
+        SearchResultEntry res = ( SearchResultEntry ) connection
+            .lookup( "cn=Administrators,ou=groups,ou=system" );
+
+        if ( res == null )
         {
             return false;
         }
-        
+
         return true;
     }
 
@@ -86,7 +87,7 @@ public class AdministratorsGroupIT exten
      * @throws Exception on failures
      */
     @Test
-    @CreateDS ( enableAccessControl=true, name="testNonAdminReadAccessToGroups-method" )
+    @CreateDS(enableAccessControl = true, name = "testNonAdminReadAccessToGroups-method")
     public void testNonAdminReadAccessToGroups() throws Exception
     {
         DN billydDn = createUser( "billyd", "s3kr3t" );
@@ -96,7 +97,7 @@ public class AdministratorsGroupIT exten
         LdapConnection connection = getConnectionAs( billydDn, "s3kr3t" );
         assertTrue( connection.isAuthenticated() );
         assertFalse( canReadAdministrators( connection ) );
-        
+
         // add billyd to administrators and try again
         addUserToGroup( "billyd", "Administrators" );
 
@@ -114,7 +115,7 @@ public class AdministratorsGroupIT exten
      * @throws Exception on failure
      */
     @Test
-    @CreateDS ( name="testDefaultNonAdminReadAccessToGroups-method" )
+    @CreateDS(name = "testDefaultNonAdminReadAccessToGroups-method")
     public void testDefaultNonAdminReadAccessToGroups() throws Exception
     {
         DN billydDn = createUser( "billyd", "s3kr3t" );

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java?rev=987611&r1=987610&r2=987611&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java Fri Aug 20 19:31:58 2010
@@ -29,11 +29,6 @@ import java.util.HashSet;
 
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.DeleteResponse;
-import org.apache.directory.ldap.client.api.message.ModifyDnResponse;
-import org.apache.directory.ldap.client.api.message.ModifyRequest;
-import org.apache.directory.ldap.client.api.message.SearchResponse;
-import org.apache.directory.ldap.client.api.message.SearchResultEntry;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
@@ -41,7 +36,13 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.cursor.Cursor;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.DeleteResponse;
+import org.apache.directory.shared.ldap.message.ModifyDnResponse;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
+import org.apache.directory.shared.ldap.message.Response;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -73,8 +74,8 @@ public class AuthorizationServiceAsAdmin
     {
         IntegrationUtils.closeConnections();
     }
-    
-    
+
+
     /**
      * Makes sure the admin cannot delete the admin account.
      *
@@ -110,15 +111,16 @@ public class AuthorizationServiceAsAdmin
     public void testModifyOnAdminByAdmin() throws Exception
     {
         LdapConnection connection = getAdminConnection();
-        DN adminDN = new DN( "uid=admin,ou=system" );
-        ModifyRequest req = new ModifyRequest( adminDN );
+        DN adminDn = new DN( "uid=admin,ou=system" );
+        ModifyRequest modReq = new ModifyRequestImpl();
+        modReq.setName( adminDn );
         String newPwd = "replaced";
-        req.replace( SchemaConstants.USER_PASSWORD_AT, newPwd );
-        connection.modify( req );
+        modReq.replace( SchemaConstants.USER_PASSWORD_AT, newPwd );
+        connection.modify( modReq );
         connection.close();
 
-        connection = getConnectionAs( adminDN, newPwd );
-        Entry entry = ( ( SearchResultEntry ) connection.lookup( adminDN.getName() ) ).getEntry();
+        connection = getConnectionAs( adminDn, newPwd );
+        Entry entry = ( ( SearchResultEntry ) connection.lookup( adminDn.getName() ) ).getEntry();
         assertTrue( ArrayUtils.isEquals( StringTools.getBytesUtf8( newPwd ), entry.get( "userPassword" ).get()
             .getBytes() ) );
     }
@@ -136,7 +138,7 @@ public class AuthorizationServiceAsAdmin
 
         HashSet<String> set = new HashSet<String>();
 
-        Cursor<SearchResponse> cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "*" );
+        Cursor<Response> cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE, "*" );
 
         while ( cursor.next() )
         {



Mime
View raw message