You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/02/12 06:51:22 UTC
svn commit: r377135 [9/36] - in /directory/sandbox/akarasulu/rc1:
apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/
apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/
apacheds/core-shared/s...
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Sat Feb 11 21:50:03 2006
@@ -1,269 +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/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java Sat Feb 11 21:50:03 2006
@@ -1,126 +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/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java Sat Feb 11 21:50:03 2006
@@ -1,85 +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/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java Sat Feb 11 21:50:03 2006
@@ -1,206 +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/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java Sat Feb 11 21:50:03 2006
@@ -1,181 +1,181 @@
-/*
- * @(#) $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.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.AuthenticationLevel;
-import org.apache.directory.shared.ldap.aci.UserClass;
-
-
-/**
- * Tests {@link MostSpecificUserClassFilter}.
- *
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- */
-public class MostSpecificUserClassFilterTest 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 name = new ArrayList();
- Collection thisEntry = new ArrayList();
- Collection userGroup = new ArrayList();
- Collection subtree = new ArrayList();
- Collection allUsers = new ArrayList();
-
- name.add( new UserClass.Name( EMPTY_SET ) );
- thisEntry.add( UserClass.THIS_ENTRY );
- userGroup.add( new UserClass.UserGroup( EMPTY_SET ) );
- subtree.add( new UserClass.Subtree( EMPTY_COLLECTION ) );
- allUsers.add( UserClass.ALL_USERS );
-
- ACITuple nameTuple = new ACITuple( name, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 );
- ACITuple thisEntryTuple = new ACITuple( thisEntry, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true,
- 0 );
- ACITuple userGroupTuple = new ACITuple( userGroup, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true,
- 0 );
- ACITuple subtreeTuple = new ACITuple( subtree, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 );
- ACITuple allUsersTuple = new ACITuple( allUsers, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 );
-
- TUPLES_A.add( nameTuple );
- TUPLES_A.add( thisEntryTuple );
- TUPLES_A.add( userGroupTuple );
- TUPLES_A.add( subtreeTuple );
- TUPLES_A.add( allUsersTuple );
-
- TUPLES_B.add( thisEntryTuple );
- TUPLES_B.add( userGroupTuple );
- TUPLES_B.add( subtreeTuple );
- TUPLES_B.add( allUsersTuple );
-
- TUPLES_C.add( userGroupTuple );
- TUPLES_C.add( subtreeTuple );
- TUPLES_C.add( allUsersTuple );
-
- TUPLES_D.add( subtreeTuple );
- TUPLES_D.add( allUsersTuple );
-
- TUPLES_E.add( allUsersTuple );
- TUPLES_E.add( allUsersTuple );
- }
-
-
- public void testZeroOrOneTuple() throws Exception
- {
- MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
-
- 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 testNameAndThisEntry() throws Exception
- {
- MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
-
- 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( 2, tuples.size() );
- Assert.assertSame( TUPLES_A.get( 0 ), tuples.get( 0 ) );
- Assert.assertSame( TUPLES_A.get( 1 ), tuples.get( 1 ) );
- }
-
-
- public void testThisEntry() throws Exception
- {
- MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
-
- 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( 1, tuples.size() );
- Assert.assertSame( TUPLES_B.get( 0 ), tuples.get( 0 ) );
- }
-
-
- public void testUserGroup() throws Exception
- {
- MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
-
- 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( 1, tuples.size() );
- Assert.assertSame( TUPLES_C.get( 0 ), tuples.get( 0 ) );
- }
-
-
- public void testSubtree() throws Exception
- {
- MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
-
- 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 testOthers() throws Exception
- {
- MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
-
- 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.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.AuthenticationLevel;
+import org.apache.directory.shared.ldap.aci.UserClass;
+
+
+/**
+ * Tests {@link MostSpecificUserClassFilter}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public class MostSpecificUserClassFilterTest 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 name = new ArrayList();
+ Collection thisEntry = new ArrayList();
+ Collection userGroup = new ArrayList();
+ Collection subtree = new ArrayList();
+ Collection allUsers = new ArrayList();
+
+ name.add( new UserClass.Name( EMPTY_SET ) );
+ thisEntry.add( UserClass.THIS_ENTRY );
+ userGroup.add( new UserClass.UserGroup( EMPTY_SET ) );
+ subtree.add( new UserClass.Subtree( EMPTY_COLLECTION ) );
+ allUsers.add( UserClass.ALL_USERS );
+
+ ACITuple nameTuple = new ACITuple( name, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 );
+ ACITuple thisEntryTuple = new ACITuple( thisEntry, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true,
+ 0 );
+ ACITuple userGroupTuple = new ACITuple( userGroup, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true,
+ 0 );
+ ACITuple subtreeTuple = new ACITuple( subtree, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 );
+ ACITuple allUsersTuple = new ACITuple( allUsers, AuthenticationLevel.NONE, EMPTY_COLLECTION, EMPTY_SET, true, 0 );
+
+ TUPLES_A.add( nameTuple );
+ TUPLES_A.add( thisEntryTuple );
+ TUPLES_A.add( userGroupTuple );
+ TUPLES_A.add( subtreeTuple );
+ TUPLES_A.add( allUsersTuple );
+
+ TUPLES_B.add( thisEntryTuple );
+ TUPLES_B.add( userGroupTuple );
+ TUPLES_B.add( subtreeTuple );
+ TUPLES_B.add( allUsersTuple );
+
+ TUPLES_C.add( userGroupTuple );
+ TUPLES_C.add( subtreeTuple );
+ TUPLES_C.add( allUsersTuple );
+
+ TUPLES_D.add( subtreeTuple );
+ TUPLES_D.add( allUsersTuple );
+
+ TUPLES_E.add( allUsersTuple );
+ TUPLES_E.add( allUsersTuple );
+ }
+
+
+ public void testZeroOrOneTuple() throws Exception
+ {
+ MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
+
+ 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 testNameAndThisEntry() throws Exception
+ {
+ MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
+
+ 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( 2, tuples.size() );
+ Assert.assertSame( TUPLES_A.get( 0 ), tuples.get( 0 ) );
+ Assert.assertSame( TUPLES_A.get( 1 ), tuples.get( 1 ) );
+ }
+
+
+ public void testThisEntry() throws Exception
+ {
+ MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
+
+ 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( 1, tuples.size() );
+ Assert.assertSame( TUPLES_B.get( 0 ), tuples.get( 0 ) );
+ }
+
+
+ public void testUserGroup() throws Exception
+ {
+ MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
+
+ 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( 1, tuples.size() );
+ Assert.assertSame( TUPLES_C.get( 0 ), tuples.get( 0 ) );
+ }
+
+
+ public void testSubtree() throws Exception
+ {
+ MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
+
+ 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 testOthers() throws Exception
+ {
+ MostSpecificUserClassFilter filter = new MostSpecificUserClassFilter();
+
+ 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/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java Sat Feb 11 21:50:03 2006
@@ -1,52 +1,52 @@
-/*
- * @(#) $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 org.apache.directory.server.core.authz.support.OperationScope;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-
-/**
- * Tests {@link OperationScope}.
- *
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- *
- */
-public class OperationScopeTest extends TestCase
-{
- public void testGetName() throws Exception
- {
- Assert.assertEquals( "Entry", OperationScope.ENTRY.getName() );
- Assert.assertEquals( "Attribute Type", OperationScope.ATTRIBUTE_TYPE.getName() );
- Assert.assertEquals( "Attribute Type & Value", OperationScope.ATTRIBUTE_TYPE_AND_VALUE.getName() );
- }
-
-
- public void testGetNameAndToStringEquality()
- {
- Assert.assertEquals( OperationScope.ENTRY.getName(), OperationScope.ENTRY.toString() );
- Assert.assertEquals( OperationScope.ATTRIBUTE_TYPE.getName(), OperationScope.ATTRIBUTE_TYPE.toString() );
- Assert.assertEquals( OperationScope.ATTRIBUTE_TYPE_AND_VALUE.getName(), OperationScope.ATTRIBUTE_TYPE_AND_VALUE
- .toString() );
- }
-}
+/*
+ * @(#) $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 org.apache.directory.server.core.authz.support.OperationScope;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+
+/**
+ * Tests {@link OperationScope}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ *
+ */
+public class OperationScopeTest extends TestCase
+{
+ public void testGetName() throws Exception
+ {
+ Assert.assertEquals( "Entry", OperationScope.ENTRY.getName() );
+ Assert.assertEquals( "Attribute Type", OperationScope.ATTRIBUTE_TYPE.getName() );
+ Assert.assertEquals( "Attribute Type & Value", OperationScope.ATTRIBUTE_TYPE_AND_VALUE.getName() );
+ }
+
+
+ public void testGetNameAndToStringEquality()
+ {
+ Assert.assertEquals( OperationScope.ENTRY.getName(), OperationScope.ENTRY.toString() );
+ Assert.assertEquals( OperationScope.ATTRIBUTE_TYPE.getName(), OperationScope.ATTRIBUTE_TYPE.toString() );
+ Assert.assertEquals( OperationScope.ATTRIBUTE_TYPE_AND_VALUE.getName(), OperationScope.ATTRIBUTE_TYPE_AND_VALUE
+ .toString() );
+ }
+}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/core/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id