directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r946967 - in /directory: apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/ shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ shared/trunk/ldap/src/test/java/org/apache/directory/shared/lda...
Date Fri, 21 May 2010 10:31:35 GMT
Author: seelmann
Date: Fri May 21 10:31:35 2010
New Revision: 946967

URL: http://svn.apache.org/viewvc?rev=946967&view=rev
Log:
Fixed hashcode() and equals() methods of UserClass
o use Set type for subtree specification elements as stated in X.501, Annex E
o adjusted and activated test cases


Modified:
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/UserClass_SubtreeTest.java

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java?rev=946967&r1=946966&r2=946967&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
Fri May 21 10:31:35 2010
@@ -53,7 +53,7 @@ public class MostSpecificUserClassFilter
     private static final Set<DN> EMPTY_NAME_SET = Collections.unmodifiableSet( new
HashSet<DN>() );
     private static final Set<MicroOperation> EMPTY_MICRO_OPERATION_SET = Collections.unmodifiableSet(
new HashSet<MicroOperation>() );
     private static final Collection<UserClass> EMPTY_USER_CLASS_COLLECTION = Collections.unmodifiableCollection(
new ArrayList<UserClass>() );
-    private static final Collection<SubtreeSpecification> EMPTY_SUBTREE_SPECIFICATION_COLLECTION
= Collections.unmodifiableCollection( new ArrayList<SubtreeSpecification>() );
+    private static final Set<SubtreeSpecification> EMPTY_SUBTREE_SPECIFICATION_COLLECTION
= Collections.unmodifiableSet( new HashSet<SubtreeSpecification>() );
     private static final Collection<ProtectedItem> EMPTY_PROTECTED_ITEM_COLLECTION
= Collections.unmodifiableCollection( new ArrayList<ProtectedItem>() );
     private static final Collection<ACITuple> EMPTY_ACI_TUPLE_COLLECTION = Collections.unmodifiableCollection(
new ArrayList<ACITuple>() );
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java?rev=946967&r1=946966&r2=946967&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
Fri May 21 10:31:35 2010
@@ -21,8 +21,6 @@ package org.apache.directory.shared.ldap
 
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -299,7 +297,7 @@ public abstract class UserClass implemen
     {
         private static final long serialVersionUID = 3949337699049701332L;
 
-        protected final Collection<SubtreeSpecification> subtreeSpecifications;
+        protected final Set<SubtreeSpecification> subtreeSpecifications;
 
 
         /**
@@ -308,17 +306,16 @@ public abstract class UserClass implemen
          * @param subtreeSpecs
          *            the collection of unrefined {@link SubtreeSpecification}s.
          */
-        public Subtree( Collection<SubtreeSpecification> subtreeSpecs )
+        public Subtree( Set<SubtreeSpecification> subtreeSpecs )
         {
-            this.subtreeSpecifications = Collections.unmodifiableCollection( new ArrayList<SubtreeSpecification>(
-                subtreeSpecs ) );
+            this.subtreeSpecifications = Collections.unmodifiableSet( subtreeSpecs );
         }
 
 
         /**
          * Returns the collection of unrefined {@link SubtreeSpecification}s.
          */
-        public Collection<SubtreeSpecification> getSubtreeSpecifications()
+        public Set<SubtreeSpecification> getSubtreeSpecifications()
         {
             return subtreeSpecifications;
         }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/UserClass_SubtreeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/UserClass_SubtreeTest.java?rev=946967&r1=946966&r2=946967&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/UserClass_SubtreeTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/UserClass_SubtreeTest.java
Fri May 21 10:31:35 2010
@@ -23,14 +23,14 @@ package org.apache.directory.shared.ldap
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import org.apache.directory.shared.ldap.aci.UserClass.Subtree;
+import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.subtree.BaseSubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -55,21 +55,22 @@ public class UserClass_SubtreeTest
     public void initNames() throws Exception
     {
         SubtreeSpecification subtreeSpecA = new BaseSubtreeSpecification();
-        SubtreeSpecification subtreeSpecB = new BaseSubtreeSpecification( );
-        SubtreeSpecification subtreeSpecC = new BaseSubtreeSpecification( );
+        SubtreeSpecification subtreeSpecB = new BaseSubtreeSpecification();
+        SubtreeSpecification subtreeSpecC = new BaseSubtreeSpecification();
+        SubtreeSpecification subtreeSpecD = new BaseSubtreeSpecification( new DN( "cn=dummy"
) );
 
-        Collection<SubtreeSpecification> colA = new ArrayList<SubtreeSpecification>();
+        Set<SubtreeSpecification> colA = new HashSet<SubtreeSpecification>();
         colA.add( subtreeSpecA );
         colA.add( subtreeSpecB );
         colA.add( subtreeSpecC );
-        Collection<SubtreeSpecification> colB = new ArrayList<SubtreeSpecification>();
+        Set<SubtreeSpecification> colB = new HashSet<SubtreeSpecification>();
         colB.add( subtreeSpecA );
         colB.add( subtreeSpecB );
         colB.add( subtreeSpecC );
-        Collection<SubtreeSpecification> colC = new ArrayList<SubtreeSpecification>();
+        Set<SubtreeSpecification> colC = new HashSet<SubtreeSpecification>();
         colC.add( subtreeSpecB );
         colC.add( subtreeSpecC );
-        colC.add( subtreeSpecA );
+        colC.add( subtreeSpecD );
 
         subtreeA = new Subtree( colA );
         subtreeACopy = new Subtree( colA );
@@ -100,7 +101,6 @@ public class UserClass_SubtreeTest
 
 
     @Test
-    @Ignore
     public void testEqualsSymmetric() throws Exception
     {
         assertEquals( subtreeA, subtreeACopy );
@@ -109,7 +109,6 @@ public class UserClass_SubtreeTest
 
 
     @Test
-    @Ignore
     public void testHashCodeSymmetric() throws Exception
     {
         assertEquals( subtreeA.hashCode(), subtreeACopy.hashCode() );
@@ -118,7 +117,6 @@ public class UserClass_SubtreeTest
 
 
     @Test
-    @Ignore
     public void testEqualsTransitive() throws Exception
     {
         assertEquals( subtreeA, subtreeACopy );
@@ -128,7 +126,6 @@ public class UserClass_SubtreeTest
 
 
     @Test
-    @Ignore
     public void testHashCodeTransitive() throws Exception
     {
         assertEquals( subtreeA.hashCode(), subtreeACopy.hashCode() );



Mime
View raw message