directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1745850 - in /directory/shared/branches/shared-value/ldap/extras/aci/src: main/java/org/apache/directory/api/ldap/aci/UserClass.java test/java/org/apache/directory/api/ldap/aci/UserClass_NameTest.java
Date Sat, 28 May 2016 08:08:24 GMT
Author: elecharny
Date: Sat May 28 08:08:24 2016
New Revision: 1745850

URL: http://svn.apache.org/viewvc?rev=1745850&view=rev
Log:
Have the UserClass using a Normalized Dn String instead of a Dn, avoiding a lot of Dn comparisons

Modified:
    directory/shared/branches/shared-value/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/UserClass.java
    directory/shared/branches/shared-value/ldap/extras/aci/src/test/java/org/apache/directory/api/ldap/aci/UserClass_NameTest.java

Modified: directory/shared/branches/shared-value/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/UserClass.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/UserClass.java?rev=1745850&r1=1745849&r2=1745850&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/UserClass.java
(original)
+++ directory/shared/branches/shared-value/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/UserClass.java
Sat May 28 08:08:24 2016
@@ -24,7 +24,6 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.subtree.SubtreeSpecification;
 
 
@@ -143,7 +142,7 @@ public abstract class UserClass
     private abstract static class NamedUserClass extends UserClass
     {
         /** The names. */
-        protected final Set<Dn> names;
+        protected final Set<String> names;
 
 
         /**
@@ -151,15 +150,15 @@ public abstract class UserClass
          * 
          * @param names a set of names
          */
-        protected NamedUserClass( Set<Dn> names )
+        protected NamedUserClass( Set<String> names )
         {
             if ( names == null )
             {
-                this.names = Collections.unmodifiableSet( new HashSet<Dn>() );
+                this.names = Collections.unmodifiableSet( new HashSet<String>() );
             }
             else
             {
-                this.names = Collections.unmodifiableSet( new HashSet<Dn>( names )
);
+                this.names = Collections.unmodifiableSet( new HashSet<String>( names
) );
             }
         }
 
@@ -169,7 +168,7 @@ public abstract class UserClass
          * 
          * @return The set of all names
          */
-        public Set<Dn> getNames()
+        public Set<String> getNames()
         {
             return names;
         }
@@ -210,7 +209,7 @@ public abstract class UserClass
         {
             int result = 37;
 
-            for ( Dn dn : this.names )
+            for ( String dn : this.names )
             {
                 result = result * 17 + dn.hashCode();
             }
@@ -229,7 +228,7 @@ public abstract class UserClass
             boolean isFirst = true;
             buffer.append( "{ " );
 
-            for ( Dn name : names )
+            for ( String name : names )
             {
                 if ( isFirst )
                 {
@@ -262,7 +261,7 @@ public abstract class UserClass
          * 
          * @param usernames the set of user DNs.
          */
-        public Name( Set<Dn> usernames )
+        public Name( Set<String> usernames )
         {
             super( usernames );
         }
@@ -292,7 +291,7 @@ public abstract class UserClass
          * 
          * @param groupNames the set of group DNs.
          */
-        public UserGroup( Set<Dn> groupNames )
+        public UserGroup( Set<String> groupNames )
         {
             super( groupNames );
         }

Modified: directory/shared/branches/shared-value/ldap/extras/aci/src/test/java/org/apache/directory/api/ldap/aci/UserClass_NameTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/extras/aci/src/test/java/org/apache/directory/api/ldap/aci/UserClass_NameTest.java?rev=1745850&r1=1745849&r2=1745850&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/extras/aci/src/test/java/org/apache/directory/api/ldap/aci/UserClass_NameTest.java
(original)
+++ directory/shared/branches/shared-value/ldap/extras/aci/src/test/java/org/apache/directory/api/ldap/aci/UserClass_NameTest.java
Sat May 28 08:08:24 2016
@@ -59,21 +59,21 @@ public class UserClass_NameTest
     @Before
     public void initNames() throws LdapInvalidDnException
     {
-        Set<Dn> dnSetA = new HashSet<Dn>();
-        dnSetA.add( new Dn( "a=aa" ) );
-        dnSetA.add( new Dn( "b=bb" ) );
+        Set<String> dnSetA = new HashSet<>();
+        dnSetA.add( new Dn( "a=aa" ).getNormName() );
+        dnSetA.add( new Dn( "b=bb" ).getNormName() );
 
-        Set<Dn> dnSetB = new HashSet<Dn>();
-        dnSetB.add( new Dn( "b=bb" ) );
-        dnSetB.add( new Dn( "a=aa" ) );
+        Set<String> dnSetB = new HashSet<>();
+        dnSetB.add( new Dn( "b=bb" ).getNormName() );
+        dnSetB.add( new Dn( "a=aa" ).getNormName() );
 
-        Set<Dn> dnSetC = new HashSet<Dn>();
-        dnSetC.add( new Dn( "a=aa" ) );
-        dnSetC.add( new Dn( "b=bb" ) );
+        Set<String> dnSetC = new HashSet<>();
+        dnSetC.add( new Dn( "a=aa" ).getNormName() );
+        dnSetC.add( new Dn( "b=bb" ).getNormName() );
 
-        Set<Dn> dnSetD = new HashSet<Dn>();
-        dnSetD.add( new Dn( "b=bb" ) );
-        dnSetD.add( new Dn( "c=cc" ) );
+        Set<String> dnSetD = new HashSet<>();
+        dnSetD.add( new Dn( "b=bb" ).getNormName() );
+        dnSetD.add( new Dn( "c=cc" ).getNormName() );
 
         nameA = new Name( dnSetA );
         nameACopy = new Name( dnSetB );



Mime
View raw message