directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r960593 [2/2] - in /directory/apacheds/trunk: core-integ/src/test/java/org/apache/directory/server/core/authz/ core/src/main/java/org/apache/directory/server/core/authz/ core/src/main/java/org/apache/directory/server/core/authz/support/ cor...
Date Mon, 05 Jul 2010 13:18:54 GMT
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=960593&r1=960592&r2=960593&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 Mon Jul  5 13:18:53 2010
@@ -108,11 +108,19 @@ public class MaxImmSubFilterTest
 
         tuples = Collections.unmodifiableCollection( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, null, null, null,
-            ENTRY_NAME, null, null, ENTRY, null, null ) );
+        AciContext aciContext = new AciContext( schemaManager, null );
+        aciContext.setEntryDn( ENTRY_NAME );
+        aciContext.setAciTuples( tuples );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ) );
+
+        aciContext = new AciContext( schemaManager, null );
+        aciContext.setEntryDn( ENTRY_NAME );
+        aciContext.setAciTuples( tuples );
+        aciContext.setEntry( ENTRY );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
-            null, null, ENTRY_NAME, null, null, ENTRY, null, null ) );
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ) );
     }
 
 
@@ -127,8 +135,12 @@ public class MaxImmSubFilterTest
 
         tuples = Collections.unmodifiableCollection( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null,
-            ROOTDSE_NAME, null, null, ENTRY, null, null ) );
+        AciContext aciContext = new AciContext( schemaManager, null );
+        aciContext.setEntryDn( ROOTDSE_NAME );
+        aciContext.setAciTuples( tuples );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ENTRY, null ) );
     }
 
 
@@ -137,8 +149,12 @@ public class MaxImmSubFilterTest
     {
         MaxImmSubFilter filter = new MaxImmSubFilter();
 
-        assertEquals( 0, filter.filter( null, EMPTY_ACI_TUPLE_COLLECTION, OperationScope.ENTRY, null, null, null, null,
-            null, ENTRY_NAME, null, null, ENTRY, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setEntryDn( ENTRY_NAME );
+        aciContext.setAciTuples( EMPTY_ACI_TUPLE_COLLECTION );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 
 
@@ -152,8 +168,12 @@ public class MaxImmSubFilterTest
 
         tuples = Collections.unmodifiableCollection( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null,
-            ENTRY_NAME, null, null, ENTRY, null, null ) );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setEntryDn( ENTRY_NAME );
+        aciContext.setAciTuples( tuples );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ENTRY, null ) );
     }
 
 
@@ -165,10 +185,18 @@ public class MaxImmSubFilterTest
         tuples.add( new ACITuple( EMPTY_USER_CLASS_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS,
             EMPTY_MICRO_OPERATION_SET, true, 0 ) );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, new MockOperation( 1 ), null, null, null,
-            null, ENTRY_NAME, null, null, ENTRY, null, null ).size() );
+        AciContext aciContext = new AciContext( schemaManager, new MockOperation( 1 ) );
+        aciContext.setEntryDn( ENTRY_NAME );
+        aciContext.setAciTuples( tuples );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
+
+        aciContext = new AciContext( schemaManager, new MockOperation( 3 ) );
+        aciContext.setEntryDn( ENTRY_NAME );
+        aciContext.setAciTuples( tuples );
+        aciContext.setEntry( ENTRY );
 
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, new MockOperation( 3 ), null, null, null,
-            null, ENTRY_NAME, null, null, ENTRY, null, null ).size() );
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 }

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=960593&r1=960592&r2=960593&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 Mon Jul  5 13:18:53 2010
@@ -116,11 +116,15 @@ public class MaxValueCountFilterTest
 
         tuples = Collections.unmodifiableCollection( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, null, null,
-            null, null, null, null, null, null, null ) );
+        AciContext aciContext = new AciContext( schemaManager, null );
+        aciContext.setAciTuples( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null,
-            null, null, null, null, null ) );
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ) );
+
+        aciContext = new AciContext( schemaManager, null );
+        aciContext.setAciTuples( tuples );
+
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ENTRY, null ) );
     }
 
 
@@ -129,8 +133,10 @@ public class MaxValueCountFilterTest
     {
         MaxValueCountFilter filter = new MaxValueCountFilter();
 
-        assertEquals( 0, filter.filter( null, EMPTY_ACI_TUPLE_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, 
-            null, null, null, null, null, null, null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( schemaManager, null );
+        aciContext.setAciTuples( EMPTY_ACI_TUPLE_COLLECTION );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() ); 
     }
 
 
@@ -144,10 +150,19 @@ public class MaxValueCountFilterTest
 
         tuples = Collections.unmodifiableCollection( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
-            null, null, null, CN_AT, null, ENTRY, null, null ) );
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
-            null, null, null, CN_AT, null, FULL_ENTRY, null, null ) );
+        AciContext aciContext = new AciContext( schemaManager, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ) );
+
+        aciContext = new AciContext( schemaManager, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setEntry( FULL_ENTRY );
+
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,null ) );
     }
 
 
@@ -167,10 +182,20 @@ public class MaxValueCountFilterTest
             true, 
             0 ) );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
-            null, null, CN_AT, null, ENTRY, null, ENTRY ).size() );
+        AciContext aciContext = new AciContext( schemaManager, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setEntry( ENTRY );
+        aciContext.setEntryView( ENTRY );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
+
+        aciContext = new AciContext( schemaManager, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setEntry( FULL_ENTRY );
+        aciContext.setEntryView( FULL_ENTRY );
 
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
-            null, null, CN_AT, null, FULL_ENTRY, null, FULL_ENTRY ).size() );
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java?rev=960593&r1=960592&r2=960593&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java Mon Jul  5 13:18:53 2010
@@ -20,18 +20,16 @@
 package org.apache.directory.server.core.authz.support;
 
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
-import static org.junit.Assert.assertEquals;
-
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.server.core.authz.support.MicroOperationFilter;
-import org.apache.directory.server.core.authz.support.OperationScope;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
@@ -75,8 +73,10 @@ public class MicroOperationFilterTest
     {
         MicroOperationFilter filter = new MicroOperationFilter();
 
-        assertEquals( 0, filter.filter( null, EMPTY_ACI_TUPLE_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, 
-            null, null, null, null, null, null, null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( EMPTY_ACI_TUPLE_COLLECTION );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -89,9 +89,16 @@ public class MicroOperationFilterTest
         tuples.add( new ACITuple( EMPTY_USER_CLASS_COLLECTION, AuthenticationLevel.NONE, EMPTY_PROTECTED_ITEM_COLLECTION, 
             TUPLE_OPERATIONS, true, 0 ) );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null,
-            null, null, USER_OPERATIONS_A, null ).size() );
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null,
-            null, null, USER_OPERATIONS_B, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setMicroOperations( USER_OPERATIONS_A );
+        aciContext.setAciTuples( tuples );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setMicroOperations( USER_OPERATIONS_B );
+        aciContext.setAciTuples( tuples );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java?rev=960593&r1=960592&r2=960593&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java Mon Jul  5 13:18:53 2010
@@ -156,14 +156,18 @@ public class MostSpecificProtectedItemFi
     {
         MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
 
-        assertEquals( 0, filter.filter( null, EMPTY_ACI_TUPLE_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null,
-            null, null, null, null, null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( EMPTY_ACI_TUPLE_COLLECTION );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
 
         Collection<ACITuple> tuples = new ArrayList<ACITuple>();
         tuples.add( new ACITuple( EMPTY_USER_CLASS_COLLECTION, AuthenticationLevel.NONE, EMPTY_PROTECTED_ITEM_COLLECTION, EMPTY_MICRO_OPERATION_SET, false, 0 ) );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
-            null, null, null, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -173,8 +177,11 @@ public class MostSpecificProtectedItemFi
         MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_A );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+        
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter(  aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 4, tuples.size() );
         assertSame( TUPLES_A.get( 0 ), tuples.get( 0 ) );
@@ -190,8 +197,11 @@ public class MostSpecificProtectedItemFi
         MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_B );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 3, tuples.size() );
         assertSame( TUPLES_B.get( 0 ), tuples.get( 0 ) );
@@ -206,8 +216,11 @@ public class MostSpecificProtectedItemFi
         MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_C );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 2, tuples.size() );
         assertSame( TUPLES_C.get( 0 ), tuples.get( 0 ) );
@@ -221,8 +234,11 @@ public class MostSpecificProtectedItemFi
         MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_D );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 1, tuples.size() );
         assertSame( TUPLES_D.get( 0 ), tuples.get( 0 ) );
@@ -235,8 +251,11 @@ public class MostSpecificProtectedItemFi
         MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_E );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 2, tuples.size() );
         assertSame( TUPLES_E.get( 0 ), tuples.get( 0 ) );

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java?rev=960593&r1=960592&r2=960593&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java Mon Jul  5 13:18:53 2010
@@ -20,6 +20,9 @@
 package org.apache.directory.server.core.authz.support;
 
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -27,13 +30,8 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.server.core.authz.support.MostSpecificUserClassFilter;
-import org.apache.directory.server.core.authz.support.OperationScope;
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
@@ -115,14 +113,18 @@ public class MostSpecificUserClassFilter
     {
         MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
 
-        assertEquals( 0, filter.filter( null, EMPTY_ACI_TUPLE_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null,
-            null, null, null, null, null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( EMPTY_ACI_TUPLE_COLLECTION );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
 
         Collection<ACITuple> tuples = new ArrayList<ACITuple>();
         tuples.add( new ACITuple( EMPTY_USER_CLASS_COLLECTION, AuthenticationLevel.NONE, EMPTY_PROTECTED_ITEM_COLLECTION, EMPTY_MICRO_OPERATION_SET, false, 0 ) );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
-            null, null, null, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -132,8 +134,10 @@ public class MostSpecificUserClassFilter
         MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_A );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 2, tuples.size() );
         assertSame( TUPLES_A.get( 0 ), tuples.get( 0 ) );
@@ -147,8 +151,10 @@ public class MostSpecificUserClassFilter
         MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_B );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 1, tuples.size() );
         assertSame( TUPLES_B.get( 0 ), tuples.get( 0 ) );
@@ -161,8 +167,10 @@ public class MostSpecificUserClassFilter
         MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_C );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 1, tuples.size() );
         assertSame( TUPLES_C.get( 0 ), tuples.get( 0 ) );
@@ -175,8 +183,10 @@ public class MostSpecificUserClassFilter
         MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_D );
-        tuples = ( List<ACITuple> ) filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = ( List<ACITuple> ) filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 1, tuples.size() );
         assertSame( TUPLES_D.get( 0 ), tuples.get( 0 ) );
@@ -189,8 +199,10 @@ public class MostSpecificUserClassFilter
         MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
 
         List<ACITuple> tuples = new ArrayList<ACITuple>( TUPLES_E );
-        tuples = (List<ACITuple>)filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
-            null, null, null );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        tuples = (List<ACITuple>)filter.filter( aciContext, OperationScope.ENTRY, null );
 
         assertEquals( 2, tuples.size() );
         assertSame( TUPLES_E.get( 0 ), tuples.get( 0 ) );

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=960593&r1=960592&r2=960593&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 Mon Jul  5 13:18:53 2010
@@ -137,8 +137,10 @@ public class RelatedProtectedItemFilterT
     @Test 
     public void testZeroTuple() throws Exception
     {
-        assertEquals( 0, filterA.filter( null, EMPTY_ACI_TUPLE_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null,
-            null, null, null, null, null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( EMPTY_ACI_TUPLE_COLLECTION );
+
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -147,8 +149,12 @@ public class RelatedProtectedItemFilterT
     {
         Collection<ACITuple> tuples = getTuples( ProtectedItem.ENTRY );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.NONE, null, OU_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+        aciContext.setAttributeType( OU_AT );
+
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 
 
@@ -158,13 +164,21 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
 
         // Test wrong scope
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         tuples = getTuples( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
-            null, null, CN_AT, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ).size() );
     }
 
 
@@ -174,13 +188,21 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
 
         // Test wrong scope
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         tuples = getTuples( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
-            null, null, CN_AT, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ).size() );
     }
 
 
@@ -192,16 +214,28 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( new AllAttributeValuesItem( attrTypes ) );
 
         // Test wrong scope
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         tuples = getTuples( new AllAttributeValuesItem( attrTypes ) );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME, null,
-            null, null, CN_AT, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( SN_AT );
 
-        assertEquals( 0, filterB.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME, null,
-            null, null, SN_AT, null, null, null, null ).size() );
+        assertEquals( 0, filterB.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -213,16 +247,28 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( new AttributeTypeItem( attrTypes ) );
 
         // Test wrong scope
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         tuples = getTuples( new AttributeTypeItem( attrTypes ) );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
-            null, null, CN_AT, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( SN_AT );
 
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
-            null, null, SN_AT, null, null, null, null ).size() );
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ).size() );
     }
 
 
@@ -234,24 +280,48 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( new AttributeValueItem( attributes ) );
 
         // Test wrong scope
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
         tuples = getTuples( new AttributeValueItem( attributes ) );
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
-            null, null, CN_AT, null, null, null, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ).size() );
 
         tuples = getTuples( new AttributeValueItem( attributes ) );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, CN_AT, new StringValue( "valueA" ), null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setAttrValue( new StringValue( "valueA" ) );
+
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setAttrValue( new StringValue( "valueB" ) );
 
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, CN_AT, new StringValue( "valueB" ), null, null, null ).size() );
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
 
         tuples = getTuples( new AttributeValueItem( attributes ) );
 
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, SN_AT, new StringValue( "valueA" ), null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( SN_AT );
+        aciContext.setAttrValue( new StringValue( "valueA" ) );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -267,8 +337,12 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( new MaxImmSubItem( 2 ) );
 
         // Should always retain tuples.
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 
 
@@ -280,19 +354,36 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( new MaxValueCountItem( mvcItems ) );
 
         // Test wrong scope
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
         tuples = getTuples( new MaxValueCountItem( mvcItems ) );
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
-            null, null, CN_AT, null, null, null, null ).size() );
 
-        tuples = getTuples( new MaxValueCountItem( mvcItems ) );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ).size() );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, CN_AT, null, null, null, null ).size() );
+        tuples = getTuples( new MaxValueCountItem( mvcItems ) );
 
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, SN_AT, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( SN_AT );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -324,19 +415,36 @@ public class RelatedProtectedItemFilterT
         Collection<ACITuple> tuples = getTuples( new RestrictedByItem( rbItems ) );
 
         // Test wrong scope
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
         tuples = getTuples( new RestrictedByItem( rbItems ) );
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, USER_NAME, null,
-            null, null, CN_AT, null, null, null, null ).size() );
 
-        tuples = getTuples( new RestrictedByItem( rbItems ) );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ).size() );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, CN_AT, null, null, null, null ).size() );
+        tuples = getTuples( new RestrictedByItem( rbItems ) );
 
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, SN_AT, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( SN_AT );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -351,21 +459,43 @@ public class RelatedProtectedItemFilterT
         entry.put( "cn", USER_NAME.getNormName() );
 
         // Test wrong scope
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
-            CN_AT, null, entry, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setEntry( entry );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         tuples = getTuples( new SelfValueItem( attrTypes ) );
 
-        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, CN_AT, null, entry, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setEntry( entry );
+        
+        assertEquals( 1, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
 
         entry.removeAttributes( "cn" );
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, CN_AT, null, entry, null, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( CN_AT );
+        aciContext.setEntry( entry );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
 
         tuples = getTuples( new SelfValueItem( attrTypes ) );
-        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
-            null, null, null, SN_AT, null, entry, null, null ).size() );
+        
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAttributeType( SN_AT );
+        aciContext.setEntry( entry );
+        
+        assertEquals( 0, filterA.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, 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=960593&r1=960592&r2=960593&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 Mon Jul  5 13:18:53 2010
@@ -91,8 +91,10 @@ public class RelatedUserClassFilterTest
     @Test
     public void testZeroTuple() throws Exception
     {
-        assertEquals( 0, filter.filter( null, EMPTY_ACI_TUPLE_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null,
-            null, null, null, null, null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( EMPTY_ACI_TUPLE_COLLECTION );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -100,9 +102,11 @@ public class RelatedUserClassFilterTest
     public void testAllUsers() throws Exception
     {
         Collection<ACITuple> tuples = getTuples( UserClass.ALL_USERS );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.NONE, null, null, null, null, null, null ).size() );
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 
 
@@ -111,10 +115,21 @@ public class RelatedUserClassFilterTest
     {
         Collection<ACITuple> tuples = getTuples( UserClass.THIS_ENTRY );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null,
-            AuthenticationLevel.NONE, USER_NAME, null, null, null, null, null ).size() );
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null,
-            AuthenticationLevel.NONE, new DN( "ou=unrelated" ), null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+        aciContext.setEntryDn( USER_NAME );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+        aciContext.setEntryDn( new DN( "ou=unrelated" ) );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
     
     
@@ -123,10 +138,21 @@ public class RelatedUserClassFilterTest
     {
         Collection<ACITuple> tuples = getTuples( UserClass.PARENT_OF_ENTRY );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null,
-            AuthenticationLevel.NONE, new DN( "ou=phoneBook, ou=test, ou=users, ou=system" ), null, null, null, null, null ).size() );
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null,
-            AuthenticationLevel.NONE, new DN( "ou=unrelated" ), null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+        aciContext.setEntryDn( new DN( "ou=phoneBook, ou=test, ou=users, ou=system" ) );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+        aciContext.setEntryDn( new DN( "ou=unrelated" ) );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 
 
@@ -134,11 +160,21 @@ public class RelatedUserClassFilterTest
     public void testName() throws Exception
     {
         Collection<ACITuple> tuples = getTuples( new UserClass.Name( USER_NAMES ) );
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null,
-            AuthenticationLevel.NONE, null, null, null, null, null, null ).size() );
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, null, null,
-            new DN( "ou=unrelateduser, ou=users" ), null, AuthenticationLevel.NONE, USER_NAME, null, null, null,
-            null, null ).size() );
+
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( new DN( "ou=unrelateduser, ou=users" ) );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+        aciContext.setEntryDn( USER_NAME );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 
 
@@ -146,14 +182,26 @@ public class RelatedUserClassFilterTest
     public void testUserGroup() throws Exception
     {
         Collection<ACITuple> tuples = getTuples( new UserClass.UserGroup( GROUP_NAMES ) );
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, GROUP_NAMES, USER_NAME, null,
-            AuthenticationLevel.NONE, null, null, null, null, null, null ).size() );
+
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserGroupNames( GROUP_NAMES );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         Set<DN> wrongGroupNames = new HashSet<DN>();
         wrongGroupNames.add( new DN( "ou=unrelatedgroup" ) );
 
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, null, wrongGroupNames, USER_NAME, null,
-            AuthenticationLevel.NONE, USER_NAME, null, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setUserDn( USER_NAME );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+        aciContext.setUserGroupNames( wrongGroupNames );
+        aciContext.setEntryDn( USER_NAME );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 
 
@@ -169,25 +217,45 @@ public class RelatedUserClassFilterTest
     {
         Collection<ACITuple> tuples = getTuples( AuthenticationLevel.SIMPLE, true );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.STRONG, null, null, null, null, null, null ).size() );
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.SIMPLE, null, null, null, null, null, null ).size() );
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.NONE, null, null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.STRONG );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.SIMPLE );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         tuples = getTuples( AuthenticationLevel.SIMPLE, false );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.NONE, null, null, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.NONE );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.STRONG, null, null, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.STRONG );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
 
         tuples = getTuples( AuthenticationLevel.SIMPLE, false );
 
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null,
-            AuthenticationLevel.SIMPLE, null, null, null, null, null, null ).size() );
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAuthenticationLevel( AuthenticationLevel.SIMPLE );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ENTRY, null ).size() );
     }
 
 

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=960593&r1=960592&r2=960593&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 Mon Jul  5 13:18:53 2010
@@ -117,11 +117,15 @@ public class RestrictedByFilterTest
 
         tuples = Collections.unmodifiableCollection( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE, null, null, null, null,
-            null, null, null, null, null, null, null ) );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ENTRY, null, null, null, null, null, null,
-            null, null, null, null, null ) );
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE, null ) );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ENTRY, null ) );
     }
 
 
@@ -130,8 +134,10 @@ public class RestrictedByFilterTest
     {
         RestrictedByFilter filter = new RestrictedByFilter();
 
-        assertEquals( 0, filter.filter( null, AT_EMPTY_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null,
-            null, null, null, null, null, null, null, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( AT_EMPTY_COLLECTION );
+
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 
 
@@ -144,8 +150,12 @@ public class RestrictedByFilterTest
 
         tuples = Collections.unmodifiableCollection( tuples );
 
-        assertEquals( tuples, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
-            null, null, null, SN_AT, null, ENTRY, null, null ) );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAttributeType( SN_AT );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( tuples, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ) );
     }
 
 
@@ -156,13 +166,28 @@ public class RestrictedByFilterTest
         Collection<ACITuple> tuples = new ArrayList<ACITuple>();
         tuples.add( new ACITuple( UC_EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS, MO_EMPTY_SET, true, 0 ) );
 
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
-            null, null, SN_AT, new StringValue( "1" ), ENTRY, null, null ).size() );
-
-        assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
-            null, null, SN_AT, new StringValue( "2" ), ENTRY, null, null ).size() );
+        AciContext aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAttributeType( SN_AT );
+        aciContext.setAttrValue( new StringValue( "1" ) );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAttributeType( SN_AT );
+        aciContext.setAttrValue( new StringValue( "2" ) );
+        aciContext.setEntry( ENTRY );
+
+        assertEquals( 1, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
+
+        aciContext = new AciContext( null, null );
+        aciContext.setAciTuples( tuples );
+        aciContext.setAttributeType( SN_AT );
+        aciContext.setAttrValue( new StringValue( "3" ) );
+        aciContext.setEntry( ENTRY );
 
-        assertEquals( 0, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
-            null, null, SN_AT, new StringValue( "3" ), ENTRY, null, null ).size() );
+        assertEquals( 0, filter.filter( aciContext, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null ).size() );
     }
 }



Mime
View raw message