directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r379013 [25/45] - in /directory/trunks/apacheds: ./ core-plugin/ core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ core-shared/ core-shared/src/...
Date Mon, 20 Feb 2006 03:58:21 GMT
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java Sun Feb 19 19:57:02 2006
@@ -47,7 +47,7 @@
      *
      * @param registry a registry used to lookup objectClass names for OIDs
      */
-    public SubtreeEvaluator( OidRegistry registry )
+    public SubtreeEvaluator(OidRegistry registry)
     {
         RefinementLeafEvaluator leafEvaluator = new RefinementLeafEvaluator( registry );
         evaluator = new RefinementEvaluator( leafEvaluator );
@@ -65,26 +65,26 @@
      * @throws javax.naming.NamingException if errors are encountered while evaluating selection
      */
     public boolean evaluate( SubtreeSpecification subtree, Name apDn, Name entryDn, Attribute objectClasses )
-            throws NamingException
+        throws NamingException
     {
-       /* =====================================================================
-        * NOTE: Regarding the overall approach, we try to narrow down the
-        * possibilities by slowly pruning relative names off of the entryDn.
-        * For example we check first if the entry is a descendant of the AP.
-        * If so we use the relative name thereafter to calculate if it is
-        * a descendant of the base.  This means shorter names to compare and
-        * less work to do while we continue to deduce inclusion by the subtree
-        * specification.
-        * =====================================================================
-        */
-
-       /*
-        * First we simply check if the candidate entry is a descendant of the
-        * administrative point.  In the process we calculate the relative
-        * distinguished name relative to the administrative point.
-        */
+        /* =====================================================================
+         * NOTE: Regarding the overall approach, we try to narrow down the
+         * possibilities by slowly pruning relative names off of the entryDn.
+         * For example we check first if the entry is a descendant of the AP.
+         * If so we use the relative name thereafter to calculate if it is
+         * a descendant of the base.  This means shorter names to compare and
+         * less work to do while we continue to deduce inclusion by the subtree
+         * specification.
+         * =====================================================================
+         */
+
+        /*
+         * First we simply check if the candidate entry is a descendant of the
+         * administrative point.  In the process we calculate the relative
+         * distinguished name relative to the administrative point.
+         */
         Name apRelativeRdn;
-        if ( ! NamespaceTools.isDescendant( apDn, entryDn ) )
+        if ( !NamespaceTools.isDescendant( apDn, entryDn ) )
         {
             return false;
         }
@@ -97,12 +97,12 @@
             apRelativeRdn = NamespaceTools.getRelativeName( apDn, entryDn );
         }
 
-       /*
-        * We do the same thing with the base as we did with the administrative
-        * point: check if the entry is a descendant of the base and find the
-        * relative name of the entry with respect to the base rdn.  With the
-        * baseRelativeRdn we can later make comparisons with specific exclusions.
-        */
+        /*
+         * We do the same thing with the base as we did with the administrative
+         * point: check if the entry is a descendant of the base and find the
+         * relative name of the entry with respect to the base rdn.  With the
+         * baseRelativeRdn we can later make comparisons with specific exclusions.
+         */
         Name baseRelativeRdn;
         if ( subtree.getBase() != null && subtree.getBase().size() == 0 )
         {
@@ -112,7 +112,7 @@
         {
             baseRelativeRdn = new LdapName();
         }
-        else if ( ! NamespaceTools.isDescendant( subtree.getBase(), apRelativeRdn ) )
+        else if ( !NamespaceTools.isDescendant( subtree.getBase(), apRelativeRdn ) )
         {
             return false;
         }
@@ -166,7 +166,7 @@
         while ( list.hasNext() )
         {
             Name chopAfter = ( Name ) list.next();
-            if ( NamespaceTools.isDescendant( chopAfter, baseRelativeRdn ) && ! chopAfter.equals( baseRelativeRdn ) )
+            if ( NamespaceTools.isDescendant( chopAfter, baseRelativeRdn ) && !chopAfter.equals( baseRelativeRdn ) )
             {
                 return false;
             }

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java Sun Feb 19 19:57:02 2006
@@ -1,64 +1,69 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.directory.server.core.authn;
-
-import java.security.NoSuchAlgorithmException;
-
-import org.apache.directory.server.core.authn.SimpleAuthenticator;
-
-import junit.framework.TestCase;
-
-/**
- * Test case for helper methods within SimpleAuthenticator.
- * 
- * @author Apache Directory Project (dev@directory.apache.org)
- */
-public class SimpleAuthenticatorOneWayEncryptedTest extends TestCase
-{
-    private SimpleAuthenticator auth = null;
-
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-        this.auth = new SimpleAuthenticator();
-    }
-
-    public void testGetAlgorithmForHashedPassword()
-    {
-        String digestetValue = "{SHA}LhkDrSoM6qr0fW6hzlfOJQW61tc=";
-        assertEquals("SHA", auth.getAlgorithmForHashedPassword(digestetValue));
-        assertEquals("SHA", auth.getAlgorithmForHashedPassword(digestetValue.getBytes()));
-
-        String noAlgorithm = "Secret1!";
-        assertEquals(null, auth.getAlgorithmForHashedPassword(noAlgorithm));
-        assertEquals(null, auth.getAlgorithmForHashedPassword(noAlgorithm.getBytes()));
-
-        String unknownAlgorithm = "{XYZ}LhkDrSoM6qr0fW6hzlfOJQW61tc=";
-        assertEquals(null, auth.getAlgorithmForHashedPassword(unknownAlgorithm));
-        assertEquals(null, auth.getAlgorithmForHashedPassword(unknownAlgorithm.getBytes()));
-    }
-
-    public void testCreateDigestedPassword() throws NoSuchAlgorithmException
-    {
-        String pwd = "Secret1!";
-        String expected = "{SHA}znbJr3+tymFoQD4+Njh4ITtI7Cc=";
-        String digested = auth.createDigestedPassword("SHA", pwd);
-
-        assertEquals(expected, digested);
-    }
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.server.core.authn;
+
+
+import java.security.NoSuchAlgorithmException;
+
+import org.apache.directory.server.core.authn.SimpleAuthenticator;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test case for helper methods within SimpleAuthenticator.
+ * 
+ * @author Apache Directory Project (dev@directory.apache.org)
+ */
+public class SimpleAuthenticatorOneWayEncryptedTest extends TestCase
+{
+    private SimpleAuthenticator auth = null;
+
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        this.auth = new SimpleAuthenticator();
+    }
+
+
+    public void testGetAlgorithmForHashedPassword()
+    {
+        String digestetValue = "{SHA}LhkDrSoM6qr0fW6hzlfOJQW61tc=";
+        assertEquals( "SHA", auth.getAlgorithmForHashedPassword( digestetValue ) );
+        assertEquals( "SHA", auth.getAlgorithmForHashedPassword( digestetValue.getBytes() ) );
+
+        String noAlgorithm = "Secret1!";
+        assertEquals( null, auth.getAlgorithmForHashedPassword( noAlgorithm ) );
+        assertEquals( null, auth.getAlgorithmForHashedPassword( noAlgorithm.getBytes() ) );
+
+        String unknownAlgorithm = "{XYZ}LhkDrSoM6qr0fW6hzlfOJQW61tc=";
+        assertEquals( null, auth.getAlgorithmForHashedPassword( unknownAlgorithm ) );
+        assertEquals( null, auth.getAlgorithmForHashedPassword( unknownAlgorithm.getBytes() ) );
+    }
+
+
+    public void testCreateDigestedPassword() throws NoSuchAlgorithmException
+    {
+        String pwd = "Secret1!";
+        String expected = "{SHA}znbJr3+tymFoQD4+Njh4ITtI7Cc=";
+        String digested = auth.createDigestedPassword( "SHA", pwd );
+
+        assertEquals( expected, digested );
+    }
 }

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticatorOneWayEncryptedTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java Sun Feb 19 19:57:02 2006
@@ -18,6 +18,7 @@
  */
 package org.apache.directory.server.core.authz.support;
 
+
 import java.util.ArrayList;
 import java.util.Iterator;
 
@@ -30,6 +31,7 @@
 import org.apache.directory.shared.ldap.schema.Syntax;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
 
+
 /**
  * A mock {@link AttributeTypeRegistry} to test {@link ACITupleFilter} implementations.
  *
@@ -41,18 +43,21 @@
 {
     private final boolean returnOperational;
 
-    public DummyAttributeTypeRegistry( boolean returnOperational )
+
+    public DummyAttributeTypeRegistry(boolean returnOperational)
     {
         this.returnOperational = returnOperational;
     }
 
+
     public void register( String schema, AttributeType attributeType ) throws NamingException
     {
     }
 
+
     public AttributeType lookup( final String id ) throws NamingException
     {
-        if( returnOperational )
+        if ( returnOperational )
         {
             return new AttributeType()
             {
@@ -61,71 +66,86 @@
                     return false;
                 }
 
+
                 public boolean isCanUserModify()
                 {
                     return false;
                 }
 
+
                 public boolean isCollective()
                 {
                     return false;
                 }
 
+
                 public UsageEnum getUsage()
                 {
                     return null;
                 }
 
+
                 public AttributeType getSuperior() throws NamingException
                 {
                     return null;
                 }
 
+
                 public Syntax getSyntax() throws NamingException
                 {
                     return null;
                 }
 
+
                 public int getLength()
                 {
                     return 0;
                 }
 
+
                 public MatchingRule getEquality() throws NamingException
                 {
                     return null;
                 }
 
+
                 public MatchingRule getOrdering() throws NamingException
                 {
                     return null;
                 }
 
+
                 public MatchingRule getSubstr() throws NamingException
                 {
                     return null;
                 }
 
+
                 public boolean isObsolete()
                 {
                     return false;
                 }
 
+
                 public String getOid()
                 {
                     return String.valueOf( id.hashCode() );
                 }
 
+
                 public String[] getNames()
                 {
-                    return new String[] { id };
+                    return new String[]
+                        { id };
                 }
 
+
                 public String getName()
                 {
                     return id;
                 }
 
+
                 public String getDescription()
                 {
                     return id;
@@ -141,71 +161,86 @@
                     return false;
                 }
 
+
                 public boolean isCanUserModify()
                 {
                     return true;
                 }
 
+
                 public boolean isCollective()
                 {
                     return false;
                 }
 
+
                 public UsageEnum getUsage()
                 {
                     return null;
                 }
 
+
                 public AttributeType getSuperior() throws NamingException
                 {
                     return null;
                 }
 
+
                 public Syntax getSyntax() throws NamingException
                 {
                     return null;
                 }
 
+
                 public int getLength()
                 {
                     return 0;
                 }
 
+
                 public MatchingRule getEquality() throws NamingException
                 {
                     return null;
                 }
 
+
                 public MatchingRule getOrdering() throws NamingException
                 {
                     return null;
                 }
 
+
                 public MatchingRule getSubstr() throws NamingException
                 {
                     return null;
                 }
 
+
                 public boolean isObsolete()
                 {
                     return false;
                 }
 
+
                 public String getOid()
                 {
                     return String.valueOf( id.hashCode() );
                 }
 
+
                 public String[] getNames()
                 {
-                    return new String[] { id };
+                    return new String[]
+                        { id };
                 }
 
+
                 public String getName()
                 {
                     return id;
                 }
 
+
                 public String getDescription()
                 {
                     return id;
@@ -214,15 +249,18 @@
         }
     }
 
+
     public String getSchemaName( String id ) throws NamingException
     {
         return "dummy";
     }
 
+
     public boolean hasAttributeType( String id )
     {
         return true;
     }
+
 
     public Iterator list()
     {

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java Sun Feb 19 19:57:02 2006
@@ -18,6 +18,7 @@
  */
 package org.apache.directory.server.core.authz.support;
 
+
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -28,6 +29,7 @@
 import org.apache.directory.server.core.authz.support.ACITupleFilter;
 import org.apache.directory.server.core.schema.OidRegistry;
 
+
 /**
  * A mock {@link OidRegistry} to test {@link ACITupleFilter} implementations.
  *
@@ -42,16 +44,19 @@
         return String.valueOf( name.hashCode() );
     }
 
+
     public boolean hasOid( String id )
     {
         return true;
     }
 
+
     public String getPrimaryName( String oid ) throws NamingException
     {
         return oid;
     }
 
+
     public List getNameSet( String oid ) throws NamingException
     {
         List list = new ArrayList();
@@ -59,33 +64,37 @@
         return list;
     }
 
+
     public Iterator list()
     {
         // Not used
         return new ArrayList().iterator();
     }
 
+
     public void register( String name, String oid )
     {
         // Not used
     }
 
+
     /**
      * Get the map of all the oids by their name
      * @return The Map that contains all the oids
      */
     public Map getOidByName()
     {
-    	return null;
+        return null;
     }
 
+
     /**
      * Get the map of all the oids by their name
      * @return The Map that contains all the oids
      */
     public Map getNameByOid()
     {
-    	return null;
+        return null;
     }
-    
+
 }

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java Sun Feb 19 19:57:02 2006
@@ -1,100 +1,91 @@
-/*
- *   @(#) $Id$
- *
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.directory.server.core.authz.support;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.directory.server.core.authz.support.HighestPrecedenceFilter;
-import org.apache.directory.shared.ldap.aci.ACITuple;
-import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
-
-/**
- * Tests {@link HighestPrecedenceFilter}.
- *
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- *
- */
-public class HighestPrecedenceFilterTest extends TestCase
-{
-    private static final Collection EMPTY_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList() );
-    private static final Set EMPTY_SET =
-        Collections.unmodifiableSet( new HashSet() );
-
-    public void testZeroTuple() throws Exception
-    {
-        HighestPrecedenceFilter filter = new HighestPrecedenceFilter();
-        Assert.assertEquals(
-                0, filter.filter(
-                        EMPTY_COLLECTION, null, null, null, null, null, null,
-                        null, null, null, null, null ).size() );
-    }
-
-    public void testOneTuple() throws Exception
-    {
-        HighestPrecedenceFilter filter = new HighestPrecedenceFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, true, 10 ) );
-        tuples = Collections.unmodifiableCollection( tuples );
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, null, null, null, null, null, null,
-                        null, null, null, null, null ) );
-    }
-    
-    public void testMoreThanOneTuples() throws Exception
-    {
-        final int MAX_PRECEDENCE = 10;
-        HighestPrecedenceFilter filter = new HighestPrecedenceFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, true, MAX_PRECEDENCE ) );
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, true, MAX_PRECEDENCE / 2 ) );
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, true, MAX_PRECEDENCE ) );
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, true, MAX_PRECEDENCE / 3 ) );
-
-        tuples = filter.filter(
-                        tuples, null, null, null, null, null, null,
-                        null, null, null, null, null );
-        
-        for( Iterator i = tuples.iterator(); i.hasNext(); )
-        {
-            ACITuple tuple = ( ACITuple ) i.next();
-            Assert.assertEquals( MAX_PRECEDENCE, tuple.getPrecedence() );
-        }
-    }
-}
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core.authz.support;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.directory.server.core.authz.support.HighestPrecedenceFilter;
+import org.apache.directory.shared.ldap.aci.ACITuple;
+import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
+
+
+/**
+ * Tests {@link HighestPrecedenceFilter}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ *
+ */
+public class HighestPrecedenceFilterTest extends TestCase
+{
+    private static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList() );
+    private static final Set EMPTY_SET = Collections.unmodifiableSet( new HashSet() );
+
+
+    public void testZeroTuple() throws Exception
+    {
+        HighestPrecedenceFilter filter = new HighestPrecedenceFilter();
+        Assert.assertEquals( 0, filter.filter( EMPTY_COLLECTION, null, null, null, null, null, null, null, null, null,
+            null, null ).size() );
+    }
+
+
+    public void testOneTuple() throws Exception
+    {
+        HighestPrecedenceFilter filter = new HighestPrecedenceFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 10 ) );
+        tuples = Collections.unmodifiableCollection( tuples );
+        Assert.assertEquals( tuples, filter.filter( tuples, null, null, null, null, null, null, null, null, null, null,
+            null ) );
+    }
+
+
+    public void testMoreThanOneTuples() throws Exception
+    {
+        final int MAX_PRECEDENCE = 10;
+        HighestPrecedenceFilter filter = new HighestPrecedenceFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true,
+            MAX_PRECEDENCE ) );
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true,
+            MAX_PRECEDENCE / 2 ) );
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true,
+            MAX_PRECEDENCE ) );
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true,
+            MAX_PRECEDENCE / 3 ) );
+
+        tuples = filter.filter( tuples, null, null, null, null, null, null, null, null, null, null, null );
+
+        for ( Iterator i = tuples.iterator(); i.hasNext(); )
+        {
+            ACITuple tuple = ( ACITuple ) i.next();
+            Assert.assertEquals( MAX_PRECEDENCE, tuple.getPrecedence() );
+        }
+    }
+}

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Sun Feb 19 19:57:02 2006
@@ -1,287 +1,269 @@
-/*
- *   @(#) $Id$
- *
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.directory.server.core.authz.support;
-
-import java.util.*;
-
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.SearchControls;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.DirectoryServiceListener;
-import org.apache.directory.server.core.authz.support.MaxImmSubFilter;
-import org.apache.directory.server.core.authz.support.OperationScope;
-import org.apache.directory.server.core.jndi.DeadContext;
-import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
-import org.apache.directory.shared.ldap.aci.ACITuple;
-import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
-import org.apache.directory.shared.ldap.aci.ProtectedItem;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.name.LdapName;
-
-
-/**
- * Tests {@link MaxImmSubFilter}.
- *
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- */
-public class MaxImmSubFilterTest extends TestCase
-{
-    private static final Collection EMPTY_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList() );
-    private static final Set EMPTY_SET =
-        Collections.unmodifiableSet( new HashSet() );
-
-    private static final Name ROOTDSE_NAME = new LdapName();
-    private static final Name ENTRY_NAME;
-    private static final Collection PROTECTED_ITEMS = new ArrayList();
-    private static final Attributes ENTRY = new BasicAttributes();
-
-
-    static
-    {
-        try
-        {
-            ENTRY_NAME = new LdapName( "ou=test, ou=system" );
-        }
-        catch( NamingException e )
-        {
-            throw new Error();
-        }
-
-        PROTECTED_ITEMS.add( new ProtectedItem.MaxImmSub( 2 ) );
-    }
-
-    public void testWrongScope() throws Exception
-    {
-        MaxImmSubFilter filter = new MaxImmSubFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, true, 0 ) );
-
-        tuples = Collections.unmodifiableCollection( tuples );
-
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, OperationScope.ATTRIBUTE_TYPE, null, null, null,
-                        null, null, ENTRY_NAME, null, null, ENTRY, null ) );
-
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null,
-                        null, null, null, null, ENTRY_NAME, null, null, ENTRY, null ) );
-    }
-
-    public void testRootDSE() throws Exception
-    {
-        MaxImmSubFilter filter = new MaxImmSubFilter();
-
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, true, 0 ) );
-
-        tuples = Collections.unmodifiableCollection( tuples );
-
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, OperationScope.ENTRY,
-                        null, null, null, null, null, ROOTDSE_NAME, null, null, ENTRY, null ) );
-    }
-
-    public void testZeroTuple() throws Exception
-    {
-        MaxImmSubFilter filter = new MaxImmSubFilter();
-
-        Assert.assertEquals(
-                0, filter.filter(
-                        EMPTY_COLLECTION, OperationScope.ENTRY,
-                        null, null, null, null, null, ENTRY_NAME, null, null, ENTRY, null ).size() );
-    }
-
-    public void testDenialTuple() throws Exception
-    {
-        MaxImmSubFilter filter = new MaxImmSubFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS,
-                EMPTY_SET, false, 0 ) );
-
-        tuples = Collections.unmodifiableCollection( tuples );
-
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, OperationScope.ENTRY, null, null, null,
-                        null, null, ENTRY_NAME, null, null, ENTRY, null ) );
-    }
-
-
-    public void testGrantTuple() throws Exception
-    {
-        MaxImmSubFilter filter = new MaxImmSubFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS,
-                EMPTY_SET, true, 0 ) );
-
-        Assert.assertEquals(
-                1, filter.filter(
-                        tuples, OperationScope.ENTRY, new MockProxy(1), null, null,
-                        null, null, ENTRY_NAME, null, null, ENTRY, null ).size() );
-
-        Assert.assertEquals(
-                0, filter.filter(
-                        tuples, OperationScope.ENTRY, new MockProxy(3), null, null,
-                        null, null, ENTRY_NAME, null, null, ENTRY, null ).size() );
-    }
-
-
-    class MockProxy extends DirectoryPartitionNexusProxy
-    {
-        final int count;
-
-        public MockProxy( int count )
-        {
-            super( new DeadContext(), new MockDirectoryService() );
-            this.count = count;
-        }
-
-
-        public NamingEnumeration search( Name base, Map env, ExprNode filter, SearchControls searchCtls ) throws NamingException
-        {
-            return new BogusEnumeration( count );
-        }
-
-
-        public NamingEnumeration search( Name base, Map env, ExprNode filter, SearchControls searchCtls, Collection bypass ) throws NamingException
-        {
-            return new BogusEnumeration( count );
-        }
-    }
-
-    class MockDirectoryService extends DirectoryService
-    {
-        public void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException
-        {
-            //To change body of implemented methods use File | Settings | File Templates.
-        }
-
-
-        public void shutdown() throws NamingException
-        {
-            //To change body of implemented methods use File | Settings | File Templates.
-        }
-
-
-        public void sync() throws NamingException
-        {
-            //To change body of implemented methods use File | Settings | File Templates.
-        }
-
-
-        public boolean isStarted()
-        {
-            return true;
-        }
-
-
-        public DirectoryServiceConfiguration getConfiguration()
-        {
-            return null;  //To change body of implemented methods use File | Settings | File Templates.
-        }
-
-
-        public Context getJndiContext( String baseName ) throws NamingException
-        {
-            return null;  //To change body of implemented methods use File | Settings | File Templates.
-        }
-
-
-        public Context getJndiContext( String principal, byte[] credential, String authentication, String baseName ) throws NamingException
-        {
-            return null;  //To change body of implemented methods use File | Settings | File Templates.
-        }
-    }
-
-
-    class BogusEnumeration implements NamingEnumeration
-    {
-        final int count;
-        int ii;
-
-
-        public BogusEnumeration( int count )
-        {
-            this.count = count;
-        }
-
-
-        public Object next() throws NamingException
-        {
-            if ( ii >= count )
-            {
-                throw new NoSuchElementException();
-            }
-
-            ii++;
-            return new Object();
-        }
-
-
-        public boolean hasMore() throws NamingException
-        {
-            return ii < count;
-        }
-
-
-        public void close() throws NamingException
-        {
-            ii = count;
-        }
-
-
-        public boolean hasMoreElements()
-        {
-            return ii < count;
-        }
-
-
-        public Object nextElement()
-        {
-            if ( ii >= count )
-            {
-                throw new NoSuchElementException();
-            }
-
-            ii++;
-            return new Object();
-        }
-    }
-}
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core.authz.support;
+
+
+import java.util.*;
+
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.SearchControls;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryServiceListener;
+import org.apache.directory.server.core.authz.support.MaxImmSubFilter;
+import org.apache.directory.server.core.authz.support.OperationScope;
+import org.apache.directory.server.core.jndi.DeadContext;
+import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
+import org.apache.directory.shared.ldap.aci.ACITuple;
+import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
+import org.apache.directory.shared.ldap.aci.ProtectedItem;
+import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.name.LdapName;
+
+
+/**
+ * Tests {@link MaxImmSubFilter}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public class MaxImmSubFilterTest extends TestCase
+{
+    private static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList() );
+    private static final Set EMPTY_SET = Collections.unmodifiableSet( new HashSet() );
+
+    private static final Name ROOTDSE_NAME = new LdapName();
+    private static final Name ENTRY_NAME;
+    private static final Collection PROTECTED_ITEMS = new ArrayList();
+    private static final Attributes ENTRY = new BasicAttributes();
+
+    static
+    {
+        try
+        {
+            ENTRY_NAME = new LdapName( "ou=test, ou=system" );
+        }
+        catch ( NamingException e )
+        {
+            throw new Error();
+        }
+
+        PROTECTED_ITEMS.add( new ProtectedItem.MaxImmSub( 2 ) );
+    }
+
+
+    public void testWrongScope() throws Exception
+    {
+        MaxImmSubFilter filter = new MaxImmSubFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 ) );
+
+        tuples = Collections.unmodifiableCollection( tuples );
+
+        Assert.assertEquals( tuples, filter.filter( tuples, OperationScope.ATTRIBUTE_TYPE, null, null, null, null,
+            null, ENTRY_NAME, null, null, ENTRY, null ) );
+
+        Assert.assertEquals( tuples, filter.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
+            null, null, ENTRY_NAME, null, null, ENTRY, null ) );
+    }
+
+
+    public void testRootDSE() throws Exception
+    {
+        MaxImmSubFilter filter = new MaxImmSubFilter();
+
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 ) );
+
+        tuples = Collections.unmodifiableCollection( tuples );
+
+        Assert.assertEquals( tuples, filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null,
+            ROOTDSE_NAME, null, null, ENTRY, null ) );
+    }
+
+
+    public void testZeroTuple() throws Exception
+    {
+        MaxImmSubFilter filter = new MaxImmSubFilter();
+
+        Assert.assertEquals( 0, filter.filter( EMPTY_COLLECTION, OperationScope.ENTRY, null, null, null, null, null,
+            ENTRY_NAME, null, null, ENTRY, null ).size() );
+    }
+
+
+    public void testDenialTuple() throws Exception
+    {
+        MaxImmSubFilter filter = new MaxImmSubFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS, EMPTY_SET, false, 0 ) );
+
+        tuples = Collections.unmodifiableCollection( tuples );
+
+        Assert.assertEquals( tuples, filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null,
+            ENTRY_NAME, null, null, ENTRY, null ) );
+    }
+
+
+    public void testGrantTuple() throws Exception
+    {
+        MaxImmSubFilter filter = new MaxImmSubFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS, EMPTY_SET, true, 0 ) );
+
+        Assert.assertEquals( 1, filter.filter( tuples, OperationScope.ENTRY, new MockProxy( 1 ), null, null, null,
+            null, ENTRY_NAME, null, null, ENTRY, null ).size() );
+
+        Assert.assertEquals( 0, filter.filter( tuples, OperationScope.ENTRY, new MockProxy( 3 ), null, null, null,
+            null, ENTRY_NAME, null, null, ENTRY, null ).size() );
+    }
+
+    class MockProxy extends DirectoryPartitionNexusProxy
+    {
+        final int count;
+
+
+        public MockProxy(int count)
+        {
+            super( new DeadContext(), new MockDirectoryService() );
+            this.count = count;
+        }
+
+
+        public NamingEnumeration search( Name base, Map env, ExprNode filter, SearchControls searchCtls )
+            throws NamingException
+        {
+            return new BogusEnumeration( count );
+        }
+
+
+        public NamingEnumeration search( Name base, Map env, ExprNode filter, SearchControls searchCtls,
+            Collection bypass ) throws NamingException
+        {
+            return new BogusEnumeration( count );
+        }
+    }
+
+    class MockDirectoryService extends DirectoryService
+    {
+        public void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException
+        {
+            //To change body of implemented methods use File | Settings | File Templates.
+        }
+
+
+        public void shutdown() throws NamingException
+        {
+            //To change body of implemented methods use File | Settings | File Templates.
+        }
+
+
+        public void sync() throws NamingException
+        {
+            //To change body of implemented methods use File | Settings | File Templates.
+        }
+
+
+        public boolean isStarted()
+        {
+            return true;
+        }
+
+
+        public DirectoryServiceConfiguration getConfiguration()
+        {
+            return null; //To change body of implemented methods use File | Settings | File Templates.
+        }
+
+
+        public Context getJndiContext( String baseName ) throws NamingException
+        {
+            return null; //To change body of implemented methods use File | Settings | File Templates.
+        }
+
+
+        public Context getJndiContext( String principal, byte[] credential, String authentication, String baseName )
+            throws NamingException
+        {
+            return null; //To change body of implemented methods use File | Settings | File Templates.
+        }
+    }
+
+    class BogusEnumeration implements NamingEnumeration
+    {
+        final int count;
+        int ii;
+
+
+        public BogusEnumeration(int count)
+        {
+            this.count = count;
+        }
+
+
+        public Object next() throws NamingException
+        {
+            if ( ii >= count )
+            {
+                throw new NoSuchElementException();
+            }
+
+            ii++;
+            return new Object();
+        }
+
+
+        public boolean hasMore() throws NamingException
+        {
+            return ii < count;
+        }
+
+
+        public void close() throws NamingException
+        {
+            ii = count;
+        }
+
+
+        public boolean hasMoreElements()
+        {
+            return ii < count;
+        }
+
+
+        public Object nextElement()
+        {
+            if ( ii >= count )
+            {
+                throw new NoSuchElementException();
+            }
+
+            ii++;
+            return new Object();
+        }
+    }
+}

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java Sun Feb 19 19:57:02 2006
@@ -1,143 +1,126 @@
-/*
- *   @(#) $Id$
- *
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.directory.server.core.authz.support;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.directory.server.core.authz.support.MaxValueCountFilter;
-import org.apache.directory.server.core.authz.support.OperationScope;
-import org.apache.directory.shared.ldap.aci.ACITuple;
-import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
-import org.apache.directory.shared.ldap.aci.ProtectedItem;
-import org.apache.directory.shared.ldap.aci.ProtectedItem.MaxValueCountItem;
-
-/**
- * Tests {@link MaxValueCountFilter}.
- *
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- */
-public class MaxValueCountFilterTest extends TestCase
-{
-    private static final Collection EMPTY_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList() );
-    private static final Set EMPTY_SET =
-        Collections.unmodifiableSet( new HashSet() );
-    
-    private static final Collection PROTECTED_ITEMS = new ArrayList();
-    private static final Attributes ENTRY = new BasicAttributes();
-    private static final Attributes FULL_ENTRY = new BasicAttributes();
-    
-    static
-    {
-        Collection mvcItems = new ArrayList();
-        mvcItems.add( new MaxValueCountItem( "testAttr", 2 ) );
-        PROTECTED_ITEMS.add( new ProtectedItem.MaxValueCount( mvcItems ) );
-        
-        ENTRY.put( "testAttr", "1" );
-
-        Attribute attr = new BasicAttribute( "testAttr" );
-        attr.add( "1" );
-        attr.add( "2" );
-        FULL_ENTRY.put( attr );
-    }
-    
-    public void testWrongScope() throws Exception
-    {
-        MaxValueCountFilter filter = new MaxValueCountFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, true, 0 ) );
-        
-        tuples = Collections.unmodifiableCollection( tuples );
-        
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, OperationScope.ATTRIBUTE_TYPE, null, null, null,
-                        null, null, null, null, null, null, null ) );
-
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, OperationScope.ENTRY, null, null, null,
-                        null, null, null, null, null, null, null ) );
-    }
-    
-    public void testZeroTuple() throws Exception
-    {
-        MaxValueCountFilter filter = new MaxValueCountFilter();
-        
-        Assert.assertEquals(
-                0, filter.filter(
-                        EMPTY_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
-                        null, null, null, null, null, null, null, null, null, null ).size() );
-    }
-    
-    public void testDenialTuple() throws Exception
-    {
-        MaxValueCountFilter filter = new MaxValueCountFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS,
-                EMPTY_SET, false, 0 ) );
-        
-        tuples = Collections.unmodifiableCollection( tuples );
-        
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
-                        null, null, null, "testAttr", null, ENTRY, null ) );
-        Assert.assertEquals(
-                tuples, filter.filter(
-                        tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
-                        null, null, null, "testAttr", null, FULL_ENTRY, null ) );
-    }
-
-
-    public void testGrantTuple() throws Exception
-    {
-        MaxValueCountFilter filter = new MaxValueCountFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS,
-                EMPTY_SET, true, 0 ) );
-        
-        Assert.assertEquals(
-                1, filter.filter(
-                        tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
-                        null, null, null, "testAttr", null, ENTRY, null ).size() );
-
-        Assert.assertEquals(
-                0, filter.filter(
-                        tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
-                        null, null, null, "testAttr", null, FULL_ENTRY, null ).size() );
-    }
-}
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core.authz.support;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.directory.server.core.authz.support.MaxValueCountFilter;
+import org.apache.directory.server.core.authz.support.OperationScope;
+import org.apache.directory.shared.ldap.aci.ACITuple;
+import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
+import org.apache.directory.shared.ldap.aci.ProtectedItem;
+import org.apache.directory.shared.ldap.aci.ProtectedItem.MaxValueCountItem;
+
+
+/**
+ * Tests {@link MaxValueCountFilter}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public class MaxValueCountFilterTest extends TestCase
+{
+    private static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList() );
+    private static final Set EMPTY_SET = Collections.unmodifiableSet( new HashSet() );
+
+    private static final Collection PROTECTED_ITEMS = new ArrayList();
+    private static final Attributes ENTRY = new BasicAttributes();
+    private static final Attributes FULL_ENTRY = new BasicAttributes();
+
+    static
+    {
+        Collection mvcItems = new ArrayList();
+        mvcItems.add( new MaxValueCountItem( "testAttr", 2 ) );
+        PROTECTED_ITEMS.add( new ProtectedItem.MaxValueCount( mvcItems ) );
+
+        ENTRY.put( "testAttr", "1" );
+
+        Attribute attr = new BasicAttribute( "testAttr" );
+        attr.add( "1" );
+        attr.add( "2" );
+        FULL_ENTRY.put( attr );
+    }
+
+
+    public void testWrongScope() throws Exception
+    {
+        MaxValueCountFilter filter = new MaxValueCountFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 ) );
+
+        tuples = Collections.unmodifiableCollection( tuples );
+
+        Assert.assertEquals( tuples, filter.filter( tuples, OperationScope.ATTRIBUTE_TYPE, null, null, null, null,
+            null, null, null, null, null, null ) );
+
+        Assert.assertEquals( tuples, filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null, null,
+            null, null, null, null ) );
+    }
+
+
+    public void testZeroTuple() throws Exception
+    {
+        MaxValueCountFilter filter = new MaxValueCountFilter();
+
+        Assert.assertEquals( 0, filter.filter( EMPTY_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null,
+            null, null, null, null, null, null, null, null ).size() );
+    }
+
+
+    public void testDenialTuple() throws Exception
+    {
+        MaxValueCountFilter filter = new MaxValueCountFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS, EMPTY_SET, false, 0 ) );
+
+        tuples = Collections.unmodifiableCollection( tuples );
+
+        Assert.assertEquals( tuples, filter.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
+            null, null, null, "testAttr", null, ENTRY, null ) );
+        Assert.assertEquals( tuples, filter.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null,
+            null, null, null, "testAttr", null, FULL_ENTRY, null ) );
+    }
+
+
+    public void testGrantTuple() throws Exception
+    {
+        MaxValueCountFilter filter = new MaxValueCountFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS, EMPTY_SET, true, 0 ) );
+
+        Assert.assertEquals( 1, filter.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
+            null, null, "testAttr", null, ENTRY, null ).size() );
+
+        Assert.assertEquals( 0, filter.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
+            null, null, "testAttr", null, FULL_ENTRY, null ).size() );
+    }
+}

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java Sun Feb 19 19:57:02 2006
@@ -1,91 +1,85 @@
-/*
- *   @(#) $Id$
- *
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.directory.server.core.authz.support;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-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.AuthenticationLevel;
-import org.apache.directory.shared.ldap.aci.MicroOperation;
-
-/**
- * Tests {@link MicroOperationFilter}.
- *
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- */
-public class MicroOperationFilterTest extends TestCase
-{
-    private static final Collection EMPTY_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList() );
-    private static final Set EMPTY_SET =
-        Collections.unmodifiableSet( new HashSet() );
-    
-    private static final Set USER_OPERATIONS_A = new HashSet();
-    private static final Set USER_OPERATIONS_B = new HashSet();
-    private static final Set TUPLE_OPERATIONS = new HashSet();
-    
-    static
-    {
-        USER_OPERATIONS_A.add( MicroOperation.ADD );
-        USER_OPERATIONS_A.add( MicroOperation.BROWSE );
-        USER_OPERATIONS_B.add( MicroOperation.COMPARE );
-        USER_OPERATIONS_B.add( MicroOperation.DISCLOSE_ON_ERROR );
-        TUPLE_OPERATIONS.add( MicroOperation.ADD );
-        TUPLE_OPERATIONS.add( MicroOperation.BROWSE );
-        TUPLE_OPERATIONS.add( MicroOperation.EXPORT );
-    }
-
-    public void testZeroTuple() throws Exception
-    {
-        MicroOperationFilter filter = new MicroOperationFilter();
-        
-        Assert.assertEquals(
-                0, filter.filter(
-                        EMPTY_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
-                        null, null, null, null, null, null, null, null, null, null ).size() );
-    }
-    
-    public void testOneTuple() throws Exception
-    {
-        MicroOperationFilter filter = new MicroOperationFilter();
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_SET,
-                TUPLE_OPERATIONS, true, 0 ) );
-        
-        Assert.assertEquals(
-                1, filter.filter(
-                        tuples, OperationScope.ENTRY, null, null, null,
-                        null, null, null, null, null, null, USER_OPERATIONS_A ).size() );
-        Assert.assertEquals(
-                0, filter.filter(
-                        tuples, OperationScope.ENTRY, null, null, null,
-                        null, null, null, null, null, null, USER_OPERATIONS_B ).size() );
-    }
-}
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core.authz.support;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+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.AuthenticationLevel;
+import org.apache.directory.shared.ldap.aci.MicroOperation;
+
+
+/**
+ * Tests {@link MicroOperationFilter}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public class MicroOperationFilterTest extends TestCase
+{
+    private static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList() );
+    private static final Set EMPTY_SET = Collections.unmodifiableSet( new HashSet() );
+
+    private static final Set USER_OPERATIONS_A = new HashSet();
+    private static final Set USER_OPERATIONS_B = new HashSet();
+    private static final Set TUPLE_OPERATIONS = new HashSet();
+
+    static
+    {
+        USER_OPERATIONS_A.add( MicroOperation.ADD );
+        USER_OPERATIONS_A.add( MicroOperation.BROWSE );
+        USER_OPERATIONS_B.add( MicroOperation.COMPARE );
+        USER_OPERATIONS_B.add( MicroOperation.DISCLOSE_ON_ERROR );
+        TUPLE_OPERATIONS.add( MicroOperation.ADD );
+        TUPLE_OPERATIONS.add( MicroOperation.BROWSE );
+        TUPLE_OPERATIONS.add( MicroOperation.EXPORT );
+    }
+
+
+    public void testZeroTuple() throws Exception
+    {
+        MicroOperationFilter filter = new MicroOperationFilter();
+
+        Assert.assertEquals( 0, filter.filter( EMPTY_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null,
+            null, null, null, null, null, null, null, null ).size() );
+    }
+
+
+    public void testOneTuple() throws Exception
+    {
+        MicroOperationFilter filter = new MicroOperationFilter();
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_SET, TUPLE_OPERATIONS, true, 0 ) );
+
+        Assert.assertEquals( 1, filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null, null, null,
+            null, null, USER_OPERATIONS_A ).size() );
+        Assert.assertEquals( 0, filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null, null, null,
+            null, null, USER_OPERATIONS_B ).size() );
+    }
+}

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java Sun Feb 19 19:57:02 2006
@@ -1,218 +1,206 @@
-/*
- *   @(#) $Id$
- *
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.directory.server.core.authz.support;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.directory.server.core.authz.support.MostSpecificProtectedItemFilter;
-import org.apache.directory.server.core.authz.support.OperationScope;
-import org.apache.directory.shared.ldap.aci.ACITuple;
-import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
-import org.apache.directory.shared.ldap.aci.ProtectedItem;
-import org.apache.directory.shared.ldap.filter.PresenceNode;
-
-/**
- * Tests {@link MostSpecificProtectedItemFilter}.
- *
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- */
-public class MostSpecificProtectedItemFilterTest extends TestCase
-{
-    private static final Collection EMPTY_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList() );
-    private static final Set EMPTY_SET =
-        Collections.unmodifiableSet( new HashSet() );
-    
-    private static final List TUPLES_A = new ArrayList();
-    private static final List TUPLES_B = new ArrayList();
-    private static final List TUPLES_C = new ArrayList();
-    private static final List TUPLES_D = new ArrayList();
-    private static final List TUPLES_E = new ArrayList();
-    
-    static
-    {
-        Collection attributeType = new ArrayList();
-        Collection allAttributeValues = new ArrayList();
-        Collection selfValue = new ArrayList();
-        Collection attributeValue = new ArrayList();
-        Collection rangeOfValues = new ArrayList();
-        Collection allUserAttributeTypes = new ArrayList();
-        Collection allUserAttributeTypesAndValues = new ArrayList();
-
-        attributeType.add( new ProtectedItem.AttributeType( EMPTY_COLLECTION ) );
-        allAttributeValues.add( new ProtectedItem.AllAttributeValues( EMPTY_COLLECTION ) );
-        selfValue.add( new ProtectedItem.SelfValue( EMPTY_COLLECTION ) );
-        attributeValue.add( new ProtectedItem.AttributeValue( EMPTY_COLLECTION ) );
-        rangeOfValues.add( new ProtectedItem.RangeOfValues( new PresenceNode( "objectClass" ) ) );
-        allUserAttributeTypes.add( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
-        allUserAttributeTypesAndValues.add( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
-
-        ACITuple attributeTypeTuple = new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, attributeType,
-                EMPTY_SET, true, 0 );
-        ACITuple allAttributeValuesTuple = new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, allAttributeValues,
-                EMPTY_SET, true, 0 );
-        ACITuple selfValueTuple = new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, selfValue,
-                EMPTY_SET, true, 0 );
-        ACITuple attributeValueTuple = new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, attributeValue,
-                EMPTY_SET, true, 0 );
-        ACITuple rangeOfValuesTuple = new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, rangeOfValues,
-                EMPTY_SET, true, 0 );
-        ACITuple allUserAttributeTypesTuple = new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, allUserAttributeTypes,
-                EMPTY_SET, true, 0 );
-        ACITuple allUserAttributeTypesAndValuesTuple = new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, allUserAttributeTypesAndValues,
-                EMPTY_SET, true, 0 );
-
-        TUPLES_A.add( attributeTypeTuple );
-        TUPLES_A.add( allAttributeValuesTuple );
-        TUPLES_A.add( selfValueTuple );
-        TUPLES_A.add( attributeValueTuple );
-        TUPLES_A.add( rangeOfValuesTuple );
-        TUPLES_A.add( allUserAttributeTypesTuple );
-        TUPLES_A.add( allUserAttributeTypesAndValuesTuple );
-
-        TUPLES_B.add( allAttributeValuesTuple );
-        TUPLES_B.add( selfValueTuple );
-        TUPLES_B.add( attributeValueTuple );
-        TUPLES_B.add( rangeOfValuesTuple );
-        TUPLES_B.add( allUserAttributeTypesTuple );
-        TUPLES_B.add( allUserAttributeTypesAndValuesTuple );
-
-        TUPLES_C.add( selfValueTuple );
-        TUPLES_C.add( attributeValueTuple );
-        TUPLES_C.add( rangeOfValuesTuple );
-        TUPLES_C.add( allUserAttributeTypesTuple );
-        TUPLES_C.add( allUserAttributeTypesAndValuesTuple );
-
-        TUPLES_D.add( attributeValueTuple );
-        TUPLES_D.add( rangeOfValuesTuple );
-        TUPLES_D.add( allUserAttributeTypesTuple );
-        TUPLES_D.add( allUserAttributeTypesAndValuesTuple );
-
-        TUPLES_E.add( allUserAttributeTypesTuple );
-        TUPLES_E.add( allUserAttributeTypesAndValuesTuple );
-    }
-    
-    public void testZeroOrOneTuple() throws Exception
-    {
-        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
-
-        Assert.assertEquals(
-                0, filter.filter(
-                        EMPTY_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
-                        null, null, null, null, null, null, null, null, null, null ).size() );
-
-        Collection tuples = new ArrayList();
-        tuples.add( new ACITuple(
-                EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION,
-                EMPTY_SET, false, 0 ) );
-        
-        Assert.assertEquals(
-                1, filter.filter(
-                        tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
-                        null, null, null, null, null, null, null, null, null, null ).size() );
-    }
-    
-    public void testTuplesA() throws Exception
-    {
-        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
-        
-        List tuples = new ArrayList( TUPLES_A );
-        tuples = ( List ) filter.filter(
-                tuples, OperationScope.ENTRY, null, null, null,
-                null, null, null, null, null, null, null );
-        
-        Assert.assertEquals( 4, tuples.size() );
-        Assert.assertSame( TUPLES_A.get( 0 ), tuples.get( 0 ) );
-        Assert.assertSame( TUPLES_A.get( 1 ), tuples.get( 1 ) );
-        Assert.assertSame( TUPLES_A.get( 2 ), tuples.get( 2 ) );
-        Assert.assertSame( TUPLES_A.get( 3 ), tuples.get( 3 ) );
-    }
-
-    public void testTuplesB() throws Exception
-    {
-        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
-        
-        List tuples = new ArrayList( TUPLES_B );
-        tuples = ( List ) filter.filter(
-                tuples, OperationScope.ENTRY, null, null, null,
-                null, null, null, null, null, null, null );
-        
-        Assert.assertEquals( 3, tuples.size() );
-        Assert.assertSame( TUPLES_B.get( 0 ), tuples.get( 0 ) );
-        Assert.assertSame( TUPLES_B.get( 1 ), tuples.get( 1 ) );
-        Assert.assertSame( TUPLES_B.get( 2 ), tuples.get( 2 ) );
-    }
-
-    public void testTuplesC() throws Exception
-    {
-        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
-        
-        List tuples = new ArrayList( TUPLES_C );
-        tuples = ( List ) filter.filter(
-                tuples, OperationScope.ENTRY, null, null, null,
-                null, null, null, null, null, null, null );
-        
-        Assert.assertEquals( 2, tuples.size() );
-        Assert.assertSame( TUPLES_C.get( 0 ), tuples.get( 0 ) );
-        Assert.assertSame( TUPLES_C.get( 1 ), tuples.get( 1 ) );
-    }
-
-    public void testTuplesD() throws Exception
-    {
-        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
-        
-        List tuples = new ArrayList( TUPLES_D );
-        tuples = ( List ) filter.filter(
-                tuples, OperationScope.ENTRY, null, null, null,
-                null, null, null, null, null, null, null );
-        
-        Assert.assertEquals( 1, tuples.size() );
-        Assert.assertSame( TUPLES_D.get( 0 ), tuples.get( 0 ) );
-    }
-    
-    public void testTuplesE() throws Exception
-    {
-        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
-        
-        List tuples = new ArrayList( TUPLES_E );
-        tuples = ( List ) filter.filter(
-                tuples, OperationScope.ENTRY, null, null, null,
-                null, null, null, null, null, null, null );
-        
-        Assert.assertEquals( 2, tuples.size() );
-        Assert.assertSame( TUPLES_E.get( 0 ), tuples.get( 0 ) );
-        Assert.assertSame( TUPLES_E.get( 1 ), tuples.get( 1 ) );
-    }
-}
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core.authz.support;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.directory.server.core.authz.support.MostSpecificProtectedItemFilter;
+import org.apache.directory.server.core.authz.support.OperationScope;
+import org.apache.directory.shared.ldap.aci.ACITuple;
+import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
+import org.apache.directory.shared.ldap.aci.ProtectedItem;
+import org.apache.directory.shared.ldap.filter.PresenceNode;
+
+
+/**
+ * Tests {@link MostSpecificProtectedItemFilter}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public class MostSpecificProtectedItemFilterTest extends TestCase
+{
+    private static final Collection EMPTY_COLLECTION = Collections.unmodifiableCollection( new ArrayList() );
+    private static final Set EMPTY_SET = Collections.unmodifiableSet( new HashSet() );
+
+    private static final List TUPLES_A = new ArrayList();
+    private static final List TUPLES_B = new ArrayList();
+    private static final List TUPLES_C = new ArrayList();
+    private static final List TUPLES_D = new ArrayList();
+    private static final List TUPLES_E = new ArrayList();
+
+    static
+    {
+        Collection attributeType = new ArrayList();
+        Collection allAttributeValues = new ArrayList();
+        Collection selfValue = new ArrayList();
+        Collection attributeValue = new ArrayList();
+        Collection rangeOfValues = new ArrayList();
+        Collection allUserAttributeTypes = new ArrayList();
+        Collection allUserAttributeTypesAndValues = new ArrayList();
+
+        attributeType.add( new ProtectedItem.AttributeType( EMPTY_COLLECTION ) );
+        allAttributeValues.add( new ProtectedItem.AllAttributeValues( EMPTY_COLLECTION ) );
+        selfValue.add( new ProtectedItem.SelfValue( EMPTY_COLLECTION ) );
+        attributeValue.add( new ProtectedItem.AttributeValue( EMPTY_COLLECTION ) );
+        rangeOfValues.add( new ProtectedItem.RangeOfValues( new PresenceNode( "objectClass" ) ) );
+        allUserAttributeTypes.add( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
+        allUserAttributeTypesAndValues.add( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
+
+        ACITuple attributeTypeTuple = new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, attributeType,
+            EMPTY_SET, true, 0 );
+        ACITuple allAttributeValuesTuple = new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE,
+            allAttributeValues, EMPTY_SET, true, 0 );
+        ACITuple selfValueTuple = new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, selfValue, EMPTY_SET, true,
+            0 );
+        ACITuple attributeValueTuple = new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, attributeValue,
+            EMPTY_SET, true, 0 );
+        ACITuple rangeOfValuesTuple = new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, rangeOfValues,
+            EMPTY_SET, true, 0 );
+        ACITuple allUserAttributeTypesTuple = new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE,
+            allUserAttributeTypes, EMPTY_SET, true, 0 );
+        ACITuple allUserAttributeTypesAndValuesTuple = new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE,
+            allUserAttributeTypesAndValues, EMPTY_SET, true, 0 );
+
+        TUPLES_A.add( attributeTypeTuple );
+        TUPLES_A.add( allAttributeValuesTuple );
+        TUPLES_A.add( selfValueTuple );
+        TUPLES_A.add( attributeValueTuple );
+        TUPLES_A.add( rangeOfValuesTuple );
+        TUPLES_A.add( allUserAttributeTypesTuple );
+        TUPLES_A.add( allUserAttributeTypesAndValuesTuple );
+
+        TUPLES_B.add( allAttributeValuesTuple );
+        TUPLES_B.add( selfValueTuple );
+        TUPLES_B.add( attributeValueTuple );
+        TUPLES_B.add( rangeOfValuesTuple );
+        TUPLES_B.add( allUserAttributeTypesTuple );
+        TUPLES_B.add( allUserAttributeTypesAndValuesTuple );
+
+        TUPLES_C.add( selfValueTuple );
+        TUPLES_C.add( attributeValueTuple );
+        TUPLES_C.add( rangeOfValuesTuple );
+        TUPLES_C.add( allUserAttributeTypesTuple );
+        TUPLES_C.add( allUserAttributeTypesAndValuesTuple );
+
+        TUPLES_D.add( attributeValueTuple );
+        TUPLES_D.add( rangeOfValuesTuple );
+        TUPLES_D.add( allUserAttributeTypesTuple );
+        TUPLES_D.add( allUserAttributeTypesAndValuesTuple );
+
+        TUPLES_E.add( allUserAttributeTypesTuple );
+        TUPLES_E.add( allUserAttributeTypesAndValuesTuple );
+    }
+
+
+    public void testZeroOrOneTuple() throws Exception
+    {
+        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
+
+        Assert.assertEquals( 0, filter.filter( EMPTY_COLLECTION, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null,
+            null, null, null, null, null, null, null, null ).size() );
+
+        Collection tuples = new ArrayList();
+        tuples.add( new ACITuple( EMPTY_COLLECTION, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, false, 0 ) );
+
+        Assert.assertEquals( 1, filter.filter( tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
+            null, null, null, null, null, null ).size() );
+    }
+
+
+    public void testTuplesA() throws Exception
+    {
+        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
+
+        List tuples = new ArrayList( TUPLES_A );
+        tuples = ( List ) filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
+            null, null );
+
+        Assert.assertEquals( 4, tuples.size() );
+        Assert.assertSame( TUPLES_A.get( 0 ), tuples.get( 0 ) );
+        Assert.assertSame( TUPLES_A.get( 1 ), tuples.get( 1 ) );
+        Assert.assertSame( TUPLES_A.get( 2 ), tuples.get( 2 ) );
+        Assert.assertSame( TUPLES_A.get( 3 ), tuples.get( 3 ) );
+    }
+
+
+    public void testTuplesB() throws Exception
+    {
+        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
+
+        List tuples = new ArrayList( TUPLES_B );
+        tuples = ( List ) filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
+            null, null );
+
+        Assert.assertEquals( 3, tuples.size() );
+        Assert.assertSame( TUPLES_B.get( 0 ), tuples.get( 0 ) );
+        Assert.assertSame( TUPLES_B.get( 1 ), tuples.get( 1 ) );
+        Assert.assertSame( TUPLES_B.get( 2 ), tuples.get( 2 ) );
+    }
+
+
+    public void testTuplesC() throws Exception
+    {
+        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
+
+        List tuples = new ArrayList( TUPLES_C );
+        tuples = ( List ) filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
+            null, null );
+
+        Assert.assertEquals( 2, tuples.size() );
+        Assert.assertSame( TUPLES_C.get( 0 ), tuples.get( 0 ) );
+        Assert.assertSame( TUPLES_C.get( 1 ), tuples.get( 1 ) );
+    }
+
+
+    public void testTuplesD() throws Exception
+    {
+        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
+
+        List tuples = new ArrayList( TUPLES_D );
+        tuples = ( List ) filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
+            null, null );
+
+        Assert.assertEquals( 1, tuples.size() );
+        Assert.assertSame( TUPLES_D.get( 0 ), tuples.get( 0 ) );
+    }
+
+
+    public void testTuplesE() throws Exception
+    {
+        MostSpecificProtectedItemFilter filter = new MostSpecificProtectedItemFilter();
+
+        List tuples = new ArrayList( TUPLES_E );
+        tuples = ( List ) filter.filter( tuples, OperationScope.ENTRY, null, null, null, null, null, null, null, null,
+            null, null );
+
+        Assert.assertEquals( 2, tuples.size() );
+        Assert.assertSame( TUPLES_E.get( 0 ), tuples.get( 0 ) );
+        Assert.assertSame( TUPLES_E.get( 1 ), tuples.get( 1 ) );
+    }
+}

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id



Mime
View raw message