You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/05/21 12:03:37 UTC

svn commit: r946962 - 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...

Author: seelmann
Date: Fri May 21 10:03:36 2010
New Revision: 946962

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

Modified:
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AllAttributeValuesTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeTypeTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_MaxValueCountTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RestrictedByTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_SelfValueTest.java

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java Fri May 21 10:03:36 2010
@@ -68,7 +68,7 @@ public class MaxValueCountFilterTest
 
     static
     {
-        Collection<MaxValueCountItem> mvcItems = new ArrayList<MaxValueCountItem>();
+        Set<MaxValueCountItem> mvcItems = new HashSet<MaxValueCountItem>();
         mvcItems.add( new MaxValueCountItem( "cn", 2 ) );
         PROTECTED_ITEMS.add( new ProtectedItem.MaxValueCount( mvcItems ) );
     }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java Fri May 21 10:03:36 2010
@@ -51,22 +51,22 @@ import org.junit.Test;
  */
 public class MostSpecificProtectedItemFilterTest
 {
-    private static final Collection<String> EMPTY_STRING_COLLECTION = Collections.unmodifiableCollection( new ArrayList<String>() );
-    
-    private static final Collection<Attribute> EMPTY_ATTRIBUTE_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList<Attribute>() );
-    
-    private static final Collection<UserClass> EMPTY_USER_CLASS_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList<UserClass>() );
-    
-    private static final Collection<ACITuple> EMPTY_ACI_TUPLE_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList<ACITuple>() );
-    
-    private static final Collection<ProtectedItem> EMPTY_PROTECTED_ITEM_COLLECTION =
-        Collections.unmodifiableCollection( new ArrayList<ProtectedItem>() );
-    
-    private static final Set<MicroOperation> EMPTY_MICRO_OPERATION_SET =
-         Collections.unmodifiableSet( new HashSet<MicroOperation>() );
+    private static final Set<String> EMPTY_STRING_COLLECTION = Collections.unmodifiableSet( new HashSet<String>() );
+
+    private static final Set<Attribute> EMPTY_ATTRIBUTE_COLLECTION = Collections
+        .unmodifiableSet( new HashSet<Attribute>() );
+
+    private static final Collection<UserClass> EMPTY_USER_CLASS_COLLECTION = Collections
+        .unmodifiableCollection( new ArrayList<UserClass>() );
+
+    private static final Collection<ACITuple> EMPTY_ACI_TUPLE_COLLECTION = Collections
+        .unmodifiableCollection( new ArrayList<ACITuple>() );
+
+    private static final Collection<ProtectedItem> EMPTY_PROTECTED_ITEM_COLLECTION = Collections
+        .unmodifiableCollection( new ArrayList<ProtectedItem>() );
+
+    private static final Set<MicroOperation> EMPTY_MICRO_OPERATION_SET = Collections
+        .unmodifiableSet( new HashSet<MicroOperation>() );
     
     private static final List<ACITuple> TUPLES_A = new ArrayList<ACITuple>();
     private static final List<ACITuple> TUPLES_B = new ArrayList<ACITuple>();

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java Fri May 21 10:03:36 2010
@@ -118,7 +118,7 @@ public class RelatedProtectedItemFilterT
     }
 
     
-    private Collection<Attribute> convert( Collection<EntryAttribute> attributes )
+    private Set<Attribute> convert( Collection<EntryAttribute> attributes )
     {
         Set<Attribute> jndiAttributes = new HashSet<Attribute>();
         
@@ -183,7 +183,7 @@ public class RelatedProtectedItemFilterT
     @Test 
     public void testAllAttributeValues() throws Exception
     {
-        Collection<String> attrTypes = new ArrayList<String>();
+        Set<String> attrTypes = new HashSet<String>();
         attrTypes.add( "cn" );
         Collection<ACITuple> tuples = getTuples( new ProtectedItem.AllAttributeValues( attrTypes ) );
 
@@ -204,7 +204,7 @@ public class RelatedProtectedItemFilterT
     @Test 
     public void testAttributeType() throws Exception
     {
-        Collection<String> attrTypes = new ArrayList<String>();
+        Set<String> attrTypes = new HashSet<String>();
         attrTypes.add( "cn" );
         Collection<ACITuple> tuples = getTuples( new ProtectedItem.AttributeType( attrTypes ) );
 
@@ -225,7 +225,7 @@ public class RelatedProtectedItemFilterT
     @Test 
     public void testAttributeValue() throws Exception
     {
-        Collection<EntryAttribute> attributes = new ArrayList<EntryAttribute>();
+        Set<EntryAttribute> attributes = new HashSet<EntryAttribute>();
         attributes.add( new DefaultEntryAttribute( "cn", CN_AT, "valueA" ) );
         Collection<ACITuple> tuples = getTuples( new ProtectedItem.AttributeValue( convert( attributes ) ) );
 
@@ -271,7 +271,7 @@ public class RelatedProtectedItemFilterT
     @Test 
     public void testMaxValueCount() throws Exception
     {
-        Collection<MaxValueCountItem> mvcItems = new ArrayList<MaxValueCountItem>();
+        Set<MaxValueCountItem> mvcItems = new HashSet<MaxValueCountItem>();
         mvcItems.add( new MaxValueCountItem( "cn", 3 ) );
         Collection<ACITuple> tuples = getTuples( new ProtectedItem.MaxValueCount( mvcItems ) );
 
@@ -315,7 +315,7 @@ public class RelatedProtectedItemFilterT
     @Test 
     public void testRestrictedBy() throws Exception
     {
-        Collection<RestrictedByItem> rbItems = new ArrayList<RestrictedByItem>();
+        Set<RestrictedByItem> rbItems = new HashSet<RestrictedByItem>();
         rbItems.add( new RestrictedByItem( "cn", "sn" ) );
         Collection<ACITuple> tuples = getTuples( new ProtectedItem.RestrictedBy( rbItems ) );
 
@@ -339,7 +339,7 @@ public class RelatedProtectedItemFilterT
     @Test 
     public void testSelfValue() throws Exception
     {
-        Collection<String> attrTypes = new ArrayList<String>();
+        Set<String> attrTypes = new HashSet<String>();
         attrTypes.add( "cn" );
         Collection<ACITuple> tuples = getTuples( new ProtectedItem.SelfValue( attrTypes ) );
 

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java Fri May 21 10:03:36 2010
@@ -65,7 +65,7 @@ public class RestrictedByFilterTest
 
     static
     {
-        Collection<RestrictedByItem> mvcItems = new ArrayList<RestrictedByItem>();
+        Set<RestrictedByItem> mvcItems = new HashSet<RestrictedByItem>();
         mvcItems.add( new RestrictedByItem( "sn", "cn" ) );
         PROTECTED_ITEMS.add( new ProtectedItem.RestrictedBy( mvcItems ) );
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java Fri May 21 10:03:36 2010
@@ -21,10 +21,9 @@ 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.Iterator;
+import java.util.Set;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -113,7 +112,6 @@ public abstract class ProtectedItem impl
         {
             int hash = 37;
             hash = hash * 17 + getClass().getName().hashCode();
-
             return hash;
         }
 
@@ -224,7 +222,7 @@ public abstract class ProtectedItem impl
     {
         private static final long serialVersionUID = 8425056384389605434L;
 
-        protected final Collection<String> attributeTypes;
+        protected final Set<String> attributeTypes;
 
 
         /**
@@ -232,9 +230,9 @@ public abstract class ProtectedItem impl
          * 
          * @param attributeTypes the collection of attirbute IDs
          */
-        protected AttributeTypeProtectedItem( Collection<String> attributeTypes )
+        protected AttributeTypeProtectedItem( Set<String> attributeTypes )
         {
-            this.attributeTypes = Collections.unmodifiableCollection( attributeTypes );
+            this.attributeTypes = Collections.unmodifiableSet( attributeTypes );
         }
 
 
@@ -255,7 +253,6 @@ public abstract class ProtectedItem impl
         {
             int hash = 37;
             hash = hash * 17 + attributeTypes.hashCode();
-
             return hash;
         }
 
@@ -331,7 +328,7 @@ public abstract class ProtectedItem impl
          * @param attributeTypes
          *            the collection of attribute IDs.
          */
-        public AttributeType( Collection<String> attributeTypes )
+        public AttributeType( Set<String> attributeTypes )
         {
             super( attributeTypes );
         }
@@ -357,7 +354,7 @@ public abstract class ProtectedItem impl
          * @param attributeTypes
          *            the collection of attribute IDs.
          */
-        public AllAttributeValues( Collection<String> attributeTypes )
+        public AllAttributeValues( Set<String> attributeTypes )
         {
             super( attributeTypes );
         }
@@ -387,7 +384,7 @@ public abstract class ProtectedItem impl
          * 
          * @param attributeTypes the collection of attribute IDs.
          */
-        public SelfValue( Collection<String> attributeTypes )
+        public SelfValue( Set<String> attributeTypes )
         {
             super( attributeTypes );
         }
@@ -405,7 +402,7 @@ public abstract class ProtectedItem impl
     public static class AttributeValue extends ProtectedItem
     {
         private static final long serialVersionUID = -258318397837951363L;
-        private final Collection<Attribute> attributes;
+        private final Set<Attribute> attributes;
 
 
         /**
@@ -414,9 +411,9 @@ public abstract class ProtectedItem impl
          * @param attributes
          *            the collection of {@link Attribute}s.
          */
-        public AttributeValue( Collection<Attribute> attributes )
+        public AttributeValue( Set<Attribute> attributes )
         {
-            this.attributes = Collections.unmodifiableCollection( attributes );
+            this.attributes = Collections.unmodifiableSet( attributes );
         }
 
 
@@ -437,8 +434,6 @@ public abstract class ProtectedItem impl
         {
             int hash = 37;
             hash = hash * 17 + attributes.hashCode();
-            hash = hash * 17 + super.hashCode();
-
             return hash;
         }
 
@@ -449,7 +444,12 @@ public abstract class ProtectedItem impl
         @Override
         public boolean equals( Object o )
         {
-            if ( !super.equals( o ) )
+            if ( this == o )
+            {
+                return true;
+            }
+
+            if ( o == null )
             {
                 return false;
             }
@@ -512,7 +512,7 @@ public abstract class ProtectedItem impl
     {
         private static final long serialVersionUID = 5261651541488944572L;
 
-        private final Collection<ProtectedItem.MaxValueCountItem> items;
+        private final Set<ProtectedItem.MaxValueCountItem> items;
 
 
         /**
@@ -521,9 +521,9 @@ public abstract class ProtectedItem impl
          * @param items
          *            the collection of {@link MaxValueCountItem}s.
          */
-        public MaxValueCount( Collection<MaxValueCountItem> items )
+        public MaxValueCount( Set<MaxValueCountItem> items )
         {
-            this.items = Collections.unmodifiableCollection( new ArrayList<MaxValueCountItem>( items ) );
+            this.items = Collections.unmodifiableSet( items );
         }
 
 
@@ -544,7 +544,6 @@ public abstract class ProtectedItem impl
         {
             int hash = 37;
             hash = hash * 17 + items.hashCode();
-
             return hash;
         }
 
@@ -555,7 +554,12 @@ public abstract class ProtectedItem impl
         @Override
         public boolean equals( Object o )
         {
-            if ( !super.equals( o ) )
+            if ( this == o )
+            {
+                return true;
+            }
+
+            if ( o == null )
             {
                 return false;
             }
@@ -643,7 +647,6 @@ public abstract class ProtectedItem impl
         {
             int hash = 37;
             hash = hash * 17 + filter.hashCode();
-
             return hash;
         }
 
@@ -770,7 +773,7 @@ public abstract class ProtectedItem impl
     public static class RestrictedBy extends ProtectedItem
     {
         private static final long serialVersionUID = -8157637446588058799L;
-        private final Collection<RestrictedByItem> items;
+        private final Set<RestrictedByItem> items;
 
 
         /**
@@ -778,9 +781,9 @@ public abstract class ProtectedItem impl
          * 
          * @param items the collection of {@link RestrictedByItem}s.
          */
-        public RestrictedBy( Collection<RestrictedByItem> items )
+        public RestrictedBy( Set<RestrictedByItem> items )
         {
-            this.items = Collections.unmodifiableCollection( items );
+            this.items = Collections.unmodifiableSet( items );
         }
 
 
@@ -801,8 +804,6 @@ public abstract class ProtectedItem impl
         {
             int hash = 37;
             hash = hash * 17 + items.hashCode();
-            hash = hash * 17 + super.hashCode();
-
             return hash;
         }
 
@@ -813,7 +814,12 @@ public abstract class ProtectedItem impl
         @Override
         public boolean equals( Object o )
         {
-            if ( !super.equals( o ) )
+            if ( this == o )
+            {
+                return true;
+            }
+
+            if ( o == null )
             {
                 return false;
             }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AllAttributeValuesTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AllAttributeValuesTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AllAttributeValuesTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AllAttributeValuesTest.java Fri May 21 10:03:36 2010
@@ -23,12 +23,11 @@ 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.ProtectedItem.AllAttributeValues;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -52,18 +51,18 @@ public class ProtectedItem_AllAttributeV
     @Before
     public void initNames() throws Exception
     {
-        Collection<String> colA = new ArrayList<String>();
+        Set<String> colA = new HashSet<String>();
         colA.add( "aa" );
         colA.add( "bb" );
         colA.add( "cc" );
-        Collection<String> colB = new ArrayList<String>();
+        Set<String> colB = new HashSet<String>();
         colB.add( "aa" );
         colB.add( "bb" );
         colB.add( "cc" );
-        Collection<String> colC = new ArrayList<String>();
+        Set<String> colC = new HashSet<String>();
         colC.add( "bb" );
         colC.add( "cc" );
-        colC.add( "aa" );
+        colC.add( "dd" );
 
         allAttributeValuesA = new AllAttributeValues( colA );
         allAttributeValuesACopy = new AllAttributeValues( colA );
@@ -94,7 +93,6 @@ public class ProtectedItem_AllAttributeV
 
 
     @Test
-    @Ignore
     public void testEqualsSymmetric() throws Exception
     {
         assertEquals( allAttributeValuesA, allAttributeValuesACopy );
@@ -103,7 +101,6 @@ public class ProtectedItem_AllAttributeV
 
 
     @Test
-    @Ignore
     public void testHashCodeSymmetric() throws Exception
     {
         assertEquals( allAttributeValuesA.hashCode(), allAttributeValuesACopy.hashCode() );
@@ -112,7 +109,6 @@ public class ProtectedItem_AllAttributeV
 
 
     @Test
-    @Ignore
     public void testEqualsTransitive() throws Exception
     {
         assertEquals( allAttributeValuesA, allAttributeValuesACopy );
@@ -122,7 +118,6 @@ public class ProtectedItem_AllAttributeV
 
 
     @Test
-    @Ignore
     public void testHashCodeTransitive() throws Exception
     {
         assertEquals( allAttributeValuesA.hashCode(), allAttributeValuesACopy.hashCode() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeTypeTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeTypeTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeTypeTest.java Fri May 21 10:03:36 2010
@@ -23,12 +23,11 @@ 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.ProtectedItem.AttributeType;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -52,18 +51,18 @@ public class ProtectedItem_AttributeType
     @Before
     public void initNames() throws Exception
     {
-        Collection<String> colA = new ArrayList<String>();
+        Set<String> colA = new HashSet<String>();
         colA.add( "aa" );
         colA.add( "bb" );
         colA.add( "cc" );
-        Collection<String> colB = new ArrayList<String>();
+        Set<String> colB = new HashSet<String>();
         colB.add( "aa" );
         colB.add( "bb" );
         colB.add( "cc" );
-        Collection<String> colC = new ArrayList<String>();
+        Set<String> colC = new HashSet<String>();
         colC.add( "bb" );
         colC.add( "cc" );
-        colC.add( "aa" );
+        colC.add( "dd" );
 
         attributeTypeA = new AttributeType( colA );
         attributeTypeACopy = new AttributeType( colA );
@@ -94,7 +93,6 @@ public class ProtectedItem_AttributeType
 
 
     @Test
-    @Ignore
     public void testEqualsSymmetric() throws Exception
     {
         assertEquals( attributeTypeA, attributeTypeACopy );
@@ -103,7 +101,6 @@ public class ProtectedItem_AttributeType
 
 
     @Test
-    @Ignore
     public void testHashCodeSymmetric() throws Exception
     {
         assertEquals( attributeTypeA.hashCode(), attributeTypeACopy.hashCode() );
@@ -112,7 +109,6 @@ public class ProtectedItem_AttributeType
 
 
     @Test
-    @Ignore
     public void testEqualsTransitive() throws Exception
     {
         assertEquals( attributeTypeA, attributeTypeACopy );
@@ -122,7 +118,6 @@ public class ProtectedItem_AttributeType
 
 
     @Test
-    @Ignore
     public void testHashCodeTransitive() throws Exception
     {
         assertEquals( attributeTypeA.hashCode(), attributeTypeACopy.hashCode() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeValueTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeValueTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_AttributeValueTest.java Fri May 21 10:03:36 2010
@@ -23,15 +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 javax.naming.directory.Attribute;
 import javax.naming.directory.BasicAttribute;
 
 import org.apache.directory.shared.ldap.aci.ProtectedItem.AttributeValue;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -62,19 +61,21 @@ public class ProtectedItem_AttributeValu
         attrB.add( "bb" );
         Attribute attrC = new BasicAttribute( "cc" );
         attrC.add( "cc" );
+        Attribute attrD = new BasicAttribute( "dd" );
+        attrD.add( "dd" );
 
-        Collection<Attribute> colA = new ArrayList<Attribute>();
+        Set<Attribute> colA = new HashSet<Attribute>();
         colA.add( attrA );
         colA.add( attrB );
         colA.add( attrC );
-        Collection<Attribute> colB = new ArrayList<Attribute>();
+        Set<Attribute> colB = new HashSet<Attribute>();
         colB.add( attrA );
         colB.add( attrB );
         colB.add( attrC );
-        Collection<Attribute> colC = new ArrayList<Attribute>();
+        Set<Attribute> colC = new HashSet<Attribute>();
         colC.add( attrB );
         colC.add( attrC );
-        colC.add( attrA );
+        colC.add( attrD );
 
         attributeValueA = new AttributeValue( colA );
         attributeValueACopy = new AttributeValue( colA );
@@ -105,7 +106,6 @@ public class ProtectedItem_AttributeValu
 
 
     @Test
-    @Ignore
     public void testEqualsSymmetric() throws Exception
     {
         assertEquals( attributeValueA, attributeValueACopy );
@@ -114,7 +114,6 @@ public class ProtectedItem_AttributeValu
 
 
     @Test
-    @Ignore
     public void testHashCodeSymmetric() throws Exception
     {
         assertEquals( attributeValueA.hashCode(), attributeValueACopy.hashCode() );
@@ -123,7 +122,6 @@ public class ProtectedItem_AttributeValu
 
 
     @Test
-    @Ignore
     public void testEqualsTransitive() throws Exception
     {
         assertEquals( attributeValueA, attributeValueACopy );
@@ -133,7 +131,6 @@ public class ProtectedItem_AttributeValu
 
 
     @Test
-    @Ignore
     public void testHashCodeTransitive() throws Exception
     {
         assertEquals( attributeValueA.hashCode(), attributeValueACopy.hashCode() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_MaxValueCountTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_MaxValueCountTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_MaxValueCountTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_MaxValueCountTest.java Fri May 21 10:03:36 2010
@@ -23,13 +23,12 @@ 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.ProtectedItem.MaxValueCount;
 import org.apache.directory.shared.ldap.aci.ProtectedItem.MaxValueCountItem;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -57,19 +56,20 @@ public class ProtectedItem_MaxValueCount
         MaxValueCountItem mvciA = new MaxValueCountItem( "aa", 1 );
         MaxValueCountItem mvciB = new MaxValueCountItem( "bb", 2 );
         MaxValueCountItem mvciC = new MaxValueCountItem( "cc", 3 );
+        MaxValueCountItem mvciD = new MaxValueCountItem( "dd", 4 );
 
-        Collection<MaxValueCountItem> colA = new ArrayList<MaxValueCountItem>();
+        Set<MaxValueCountItem> colA = new HashSet<MaxValueCountItem>();
         colA.add( mvciA );
         colA.add( mvciB );
         colA.add( mvciC );
-        Collection<MaxValueCountItem> colB = new ArrayList<MaxValueCountItem>();
+        Set<MaxValueCountItem> colB = new HashSet<MaxValueCountItem>();
         colB.add( mvciA );
         colB.add( mvciB );
         colB.add( mvciC );
-        Collection<MaxValueCountItem> colC = new ArrayList<MaxValueCountItem>();
+        Set<MaxValueCountItem> colC = new HashSet<MaxValueCountItem>();
         colC.add( mvciB );
         colC.add( mvciC );
-        colC.add( mvciA );
+        colC.add( mvciD );
 
         maxValueCountA = new MaxValueCount( colA );
         maxValueCountACopy = new MaxValueCount( colA );
@@ -93,7 +93,6 @@ public class ProtectedItem_MaxValueCount
 
 
     @Test
-    @Ignore
     public void testHashCodeReflexive() throws Exception
     {
         assertEquals( maxValueCountA.hashCode(), maxValueCountA.hashCode() );
@@ -101,7 +100,6 @@ public class ProtectedItem_MaxValueCount
 
 
     @Test
-    @Ignore
     public void testEqualsSymmetric() throws Exception
     {
         assertEquals( maxValueCountA, maxValueCountACopy );
@@ -110,7 +108,6 @@ public class ProtectedItem_MaxValueCount
 
 
     @Test
-    @Ignore
     public void testHashCodeSymmetric() throws Exception
     {
         assertEquals( maxValueCountA.hashCode(), maxValueCountACopy.hashCode() );
@@ -119,7 +116,6 @@ public class ProtectedItem_MaxValueCount
 
 
     @Test
-    @Ignore
     public void testEqualsTransitive() throws Exception
     {
         assertEquals( maxValueCountA, maxValueCountACopy );
@@ -129,7 +125,6 @@ public class ProtectedItem_MaxValueCount
 
 
     @Test
-    @Ignore
     public void testHashCodeTransitive() throws Exception
     {
         assertEquals( maxValueCountA.hashCode(), maxValueCountACopy.hashCode() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RestrictedByTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RestrictedByTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RestrictedByTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RestrictedByTest.java Fri May 21 10:03:36 2010
@@ -23,13 +23,12 @@ 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.ProtectedItem.RestrictedBy;
 import org.apache.directory.shared.ldap.aci.ProtectedItem.RestrictedByItem;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -56,19 +55,20 @@ public class ProtectedItem_RestrictedByT
         RestrictedByItem rbiA = new RestrictedByItem( "aa", "aa" );
         RestrictedByItem rbiB = new RestrictedByItem( "bb", "bb" );
         RestrictedByItem rbiC = new RestrictedByItem( "cc", "cc" );
+        RestrictedByItem rbiD = new RestrictedByItem( "dd", "dd" );
 
-        Collection<RestrictedByItem> colA = new ArrayList<RestrictedByItem>();
+        Set<RestrictedByItem> colA = new HashSet<RestrictedByItem>();
         colA.add( rbiA );
         colA.add( rbiB );
         colA.add( rbiC );
-        Collection<RestrictedByItem> colB = new ArrayList<RestrictedByItem>();
+        Set<RestrictedByItem> colB = new HashSet<RestrictedByItem>();
         colB.add( rbiA );
         colB.add( rbiB );
         colB.add( rbiC );
-        Collection<RestrictedByItem> colC = new ArrayList<RestrictedByItem>();
+        Set<RestrictedByItem> colC = new HashSet<RestrictedByItem>();
         colC.add( rbiB );
         colC.add( rbiC );
-        colC.add( rbiA );
+        colC.add( rbiD );
 
         restrictedByA = new RestrictedBy( colA );
         restrictedByACopy = new RestrictedBy( colA );
@@ -99,7 +99,6 @@ public class ProtectedItem_RestrictedByT
 
 
     @Test
-    @Ignore
     public void testEqualsSymmetric() throws Exception
     {
         assertEquals( restrictedByA, restrictedByACopy );
@@ -108,7 +107,6 @@ public class ProtectedItem_RestrictedByT
 
 
     @Test
-    @Ignore
     public void testHashCodeSymmetric() throws Exception
     {
         assertEquals( restrictedByA.hashCode(), restrictedByACopy.hashCode() );
@@ -117,7 +115,6 @@ public class ProtectedItem_RestrictedByT
 
 
     @Test
-    @Ignore
     public void testEqualsTransitive() throws Exception
     {
         assertEquals( restrictedByA, restrictedByACopy );
@@ -127,7 +124,6 @@ public class ProtectedItem_RestrictedByT
 
 
     @Test
-    @Ignore
     public void testHashCodeTransitive() throws Exception
     {
         assertEquals( restrictedByA.hashCode(), restrictedByACopy.hashCode() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_SelfValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_SelfValueTest.java?rev=946962&r1=946961&r2=946962&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_SelfValueTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_SelfValueTest.java Fri May 21 10:03:36 2010
@@ -23,12 +23,11 @@ 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.ProtectedItem.SelfValue;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -52,18 +51,18 @@ public class ProtectedItem_SelfValueTest
     @Before
     public void initNames() throws Exception
     {
-        Collection<String> colA = new ArrayList<String>();
+        Set<String> colA = new HashSet<String>();
         colA.add( "aa" );
         colA.add( "bb" );
         colA.add( "cc" );
-        Collection<String> colB = new ArrayList<String>();
+        Set<String> colB = new HashSet<String>();
         colB.add( "aa" );
         colB.add( "bb" );
         colB.add( "cc" );
-        Collection<String> colC = new ArrayList<String>();
+        Set<String> colC = new HashSet<String>();
         colC.add( "bb" );
         colC.add( "cc" );
-        colC.add( "aa" );
+        colC.add( "dd" );
 
         selfValueA = new SelfValue( colA );
         selfValueACopy = new SelfValue( colA );
@@ -94,7 +93,6 @@ public class ProtectedItem_SelfValueTest
 
 
     @Test
-    @Ignore
     public void testEqualsSymmetric() throws Exception
     {
         assertEquals( selfValueA, selfValueACopy );
@@ -103,7 +101,6 @@ public class ProtectedItem_SelfValueTest
 
 
     @Test
-    @Ignore
     public void testHashCodeSymmetric() throws Exception
     {
         assertEquals( selfValueA.hashCode(), selfValueACopy.hashCode() );
@@ -112,7 +109,6 @@ public class ProtectedItem_SelfValueTest
 
 
     @Test
-    @Ignore
     public void testEqualsTransitive() throws Exception
     {
         assertEquals( selfValueA, selfValueACopy );
@@ -122,7 +118,6 @@ public class ProtectedItem_SelfValueTest
 
 
     @Test
-    @Ignore
     public void testHashCodeTransitive() throws Exception
     {
         assertEquals( selfValueA.hashCode(), selfValueACopy.hashCode() );