directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r366262 - /directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/
Date Thu, 05 Jan 2006 19:48:49 GMT
Author: elecharny
Date: Thu Jan  5 11:48:39 2006
New Revision: 366262

URL: http://svn.apache.org/viewcvs?rev=366262&view=rev
Log:
- Backporting DN-refactoring to this branch
- cleaned imports 

Modified:
    directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AbstractAuthorizationTest.java
    directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AddAuthorizationTest.java
    directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
    directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/DeleteAuthorizationTest.java
    directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/ModifyAuthorizationTest.java
    directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/MoveRenameAuthorizationTest.java
    directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/SearchAuthorizationTest.java

Modified: directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AbstractAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AbstractAuthorizationTest.java?rev=366262&r1=366261&r2=366262&view=diff
==============================================================================
--- directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AbstractAuthorizationTest.java
(original)
+++ directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AbstractAuthorizationTest.java
Thu Jan  5 11:48:39 2006
@@ -20,11 +20,17 @@
 import org.apache.ldap.server.unit.AbstractTestCase;
 import org.apache.ldap.server.partition.DirectoryPartitionNexus;
 import org.apache.ldap.server.subtree.SubentryService;
-import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.name.LdapDN;
 
-import javax.naming.directory.*;
 import javax.naming.NamingException;
 import javax.naming.Name;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+
 import java.util.Hashtable;
 
 
@@ -109,7 +115,7 @@
         objectClass.add( "groupOfUniqueNames" );
         group.put( "uniqueMember", firstMemberDn );
         adminCtx.createSubcontext( "cn="+cn+",ou=groups", group );
-        return new LdapName( "cn="+cn+",ou=groups,ou=system" );
+        return new LdapDN( "cn="+cn+",ou=groups,ou=system" );
     }
 
 
@@ -151,7 +157,7 @@
         user.put( "sn", uid );
         user.put( "cn", uid );
         adminCtx.createSubcontext( "uid="+uid+",ou=users", user );
-        return new LdapName( "uid="+uid+",ou=users,ou=system" );
+        return new LdapDN( "uid="+uid+",ou=users,ou=system" );
     }
 
 

Modified: directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AddAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AddAuthorizationTest.java?rev=366262&r1=366261&r2=366262&view=diff
==============================================================================
--- directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AddAuthorizationTest.java
(original)
+++ directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/AddAuthorizationTest.java
Thu Jan  5 11:48:39 2006
@@ -18,10 +18,15 @@
 
 
 import org.apache.ldap.common.exception.LdapNoPermissionException;
-import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.name.LdapDN;
 
+import javax.naming.Name;
 import javax.naming.NamingException;
-import javax.naming.directory.*;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
 
 
 /**
@@ -56,7 +61,7 @@
 
         try
         {
-            LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+            Name userName = new LdapDN( "uid="+uid+",ou=users,ou=system" );
             DirContext userContext = getContextAs( userName, password );
             userContext.createSubcontext( entryRdn, testEntry );
 

Modified: directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java?rev=366262&r1=366261&r2=366262&view=diff
==============================================================================
--- directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
(original)
+++ directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/CompareAuthorizationTest.java
Thu Jan  5 11:48:39 2006
@@ -18,12 +18,16 @@
 
 
 import org.apache.ldap.common.exception.LdapNoPermissionException;
-import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.server.jndi.ServerLdapContext;
 
+import javax.naming.Name;
 import javax.naming.NamingException;
-import javax.naming.directory.*;
-
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
 
 /**
  * Tests whether or not authorization around entry compare operations work properly.
@@ -68,13 +72,13 @@
         try
         {
             // create the entry as admin
-            LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+            Name userName = new LdapDN( "uid="+uid+",ou=users,ou=system" );
             adminContext.createSubcontext( entryRdn, testEntry );
 
             // compare the telephone numbers
             DirContext userContext = getContextAs( userName, password );
             ServerLdapContext ctx = ( ServerLdapContext ) userContext.lookup( "" );
-            ctx.compare( new LdapName( entryRdn + ",ou=system" ), "telephoneNumber", number
);
+            ctx.compare( new LdapDN( entryRdn + ",ou=system" ), "telephoneNumber", number
);
 
             // don't return compare result which can be false but true since op was permitted
             return true;
@@ -230,7 +234,7 @@
         adminCtx.createSubcontext( "uid=bob,ou=users", user );
 
         ServerLdapContext ctx = ( ServerLdapContext ) adminCtx.lookup( "" );
-        assertTrue(ctx.compare(new LdapName( "uid=bob,ou=users,ou=system"), "userPassword",
"bobspassword"));
+        assertTrue(ctx.compare(new LdapDN( "uid=bob,ou=users,ou=system"), "userPassword",
"bobspassword"));
     }
     
 }

Modified: directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/DeleteAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/DeleteAuthorizationTest.java?rev=366262&r1=366261&r2=366262&view=diff
==============================================================================
--- directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/DeleteAuthorizationTest.java
(original)
+++ directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/DeleteAuthorizationTest.java
Thu Jan  5 11:48:39 2006
@@ -18,10 +18,15 @@
 
 
 import org.apache.ldap.common.exception.LdapNoPermissionException;
-import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.name.LdapDN;
 
+import javax.naming.Name;
 import javax.naming.NamingException;
-import javax.naming.directory.*;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
 
 
 /**
@@ -63,7 +68,7 @@
         try
         {
             // create the entry as the admin
-            LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+            Name userName = new LdapDN( "uid="+uid+",ou=users,ou=system" );
             adminContext.createSubcontext( entryRdn, testEntry );
 
             // delete the newly created context as the user

Modified: directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/ModifyAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/ModifyAuthorizationTest.java?rev=366262&r1=366261&r2=366262&view=diff
==============================================================================
--- directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/ModifyAuthorizationTest.java
(original)
+++ directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/ModifyAuthorizationTest.java
Thu Jan  5 11:48:39 2006
@@ -18,12 +18,18 @@
 
 
 import org.apache.ldap.common.exception.LdapNoPermissionException;
-import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.name.LdapDN;
 
 import javax.naming.NamingException;
 import javax.naming.NamingEnumeration;
 import javax.naming.Name;
-import javax.naming.directory.*;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+
 import java.util.List;
 import java.util.ArrayList;
 
@@ -70,7 +76,7 @@
         try
         {
             // create the entry as admin
-            LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+            Name userName = new LdapDN( "uid="+uid+",ou=users,ou=system" );
             adminContext.createSubcontext( entryRdn, testEntry );
 
             // modify the entry as the user
@@ -126,7 +132,7 @@
         try
         {
             // create the entry as admin
-            LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+            Name userName = new LdapDN( "uid="+uid+",ou=users,ou=system" );
             adminContext.createSubcontext( entryRdn, testEntry );
 
             // modify the entry as the user
@@ -166,7 +172,7 @@
         try
         {
             // modify the entry as the user
-            Name userEntry = new LdapName( "uid="+uid+",ou=users,ou=system" );
+            Name userEntry = new LdapDN( "uid="+uid+",ou=users,ou=system" );
             DirContext userContext = getContextAs( userEntry, password, userEntry.toString()
);
             userContext.modifyAttributes( "", modOp, mods );
             return true;
@@ -196,7 +202,7 @@
         try
         {
             // modify the entry as the user
-            Name userEntry = new LdapName( "uid="+uid+",ou=users,ou=system" );
+            Name userEntry = new LdapDN( "uid="+uid+",ou=users,ou=system" );
             DirContext userContext = getContextAs( userEntry, password, userEntry.toString()
);
             userContext.modifyAttributes( "", mods );
             return true;

Modified: directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/MoveRenameAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/MoveRenameAuthorizationTest.java?rev=366262&r1=366261&r2=366262&view=diff
==============================================================================
--- directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/MoveRenameAuthorizationTest.java
(original)
+++ directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/MoveRenameAuthorizationTest.java
Thu Jan  5 11:48:39 2006
@@ -18,10 +18,15 @@
 
 
 import org.apache.ldap.common.exception.LdapNoPermissionException;
-import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.name.LdapDN;
 
+import javax.naming.Name;
 import javax.naming.NamingException;
-import javax.naming.directory.*;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
 
 
 /**
@@ -62,7 +67,7 @@
             // create the new entry as the admin user
             adminContext.createSubcontext( entryRdn, testEntry );
 
-            LdapName userName = new LdapName( "uid="+uid+",ou=users,ou=system" );
+            Name userName = new LdapDN( "uid="+uid+",ou=users,ou=system" );
             DirContext userContext = getContextAs( userName, password );
             userContext.rename( entryRdn, newRdn );
 

Modified: directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/SearchAuthorizationTest.java
URL: http://svn.apache.org/viewcvs/directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/SearchAuthorizationTest.java?rev=366262&r1=366261&r2=366262&view=diff
==============================================================================
--- directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/SearchAuthorizationTest.java
(original)
+++ directory/branches/DN-refactoring/apacheds-core-unit/src/test/java/org/apache/ldap/server/authz/SearchAuthorizationTest.java
Thu Jan  5 11:48:39 2006
@@ -19,14 +19,19 @@
 
 import org.apache.ldap.common.message.LockableAttributesImpl;
 import org.apache.ldap.common.message.LockableAttributeImpl;
-import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.name.LdapDN;
 import org.apache.ldap.common.exception.LdapNameNotFoundException;
 import org.apache.ldap.common.exception.LdapNoPermissionException;
 
 import javax.naming.NamingException;
 import javax.naming.Name;
 import javax.naming.NamingEnumeration;
-import javax.naming.directory.*;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -82,7 +87,7 @@
         Name[] childRdns = new Name[children.length];
         for ( int ii = 0; ii < children.length && count[0] < sizeLimit; ii++
)
         {
-            Name childRdn = new LdapName();
+            Name childRdn = new LdapDN();
             childRdn.addAll( parent );
             childRdn.add( "ou=" + ii );
             childRdns[ii] = childRdn;
@@ -136,7 +141,7 @@
         while ( results.hasMore() )
         {
             SearchResult result = ( SearchResult ) results.next();
-            Name childRdn = new LdapName( result.getName() );
+            Name childRdn = new LdapDN( result.getName() );
             childRdn.remove( 0 );
             recursivelyDelete( childRdn );
         }
@@ -213,8 +218,8 @@
             cons = new SearchControls();
         }
 
-        Name base = addSearchData( new LdapName(), 3, 10 );
-        Name userDn = new LdapName( "uid="+uid+",ou=users,ou=system" );
+        Name base = addSearchData( new LdapDN(), 3, 10 );
+        Name userDn = new LdapDN( "uid="+uid+",ou=users,ou=system" );
         try
         {
             results.clear();
@@ -258,9 +263,9 @@
             cons = new SearchControls();
         }
 
-        Name base = addSearchData( new LdapName(), 3, 10 );
+        Name base = addSearchData( new LdapDN(), 3, 10 );
         addEntryACI( rdn, aci );
-        Name userDn = new LdapName( "uid="+uid+",ou=users,ou=system" );
+        Name userDn = new LdapDN( "uid="+uid+",ou=users,ou=system" );
         try
         {
             results.clear();
@@ -295,7 +300,7 @@
      */
     public void testAddSearchData() throws NamingException
     {
-        Name base = addSearchData( new LdapName(), 3, 10 );
+        Name base = addSearchData( new LdapDN(), 3, 10 );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         NamingEnumeration results = sysRoot.search( base, "(objectClass=*)", controls );
@@ -653,7 +658,7 @@
         // try a search operation which should fail without any prescriptive ACI
         SearchControls cons = new SearchControls();
         cons.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        LdapName rdn = new LdapName( "ou=tests" );
+        Name rdn = new LdapDN( "ou=tests" );
         assertFalse( checkSearchAsWithEntryACI( "billyd", "billyd", cons, rdn, aci, 9 ) );
 
         // now add a subentry that enables anyone to search below ou=system
@@ -706,7 +711,7 @@
         // try a search operation which should fail without any prescriptive ACI
         SearchControls cons = new SearchControls();
         cons.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        LdapName rdn = new LdapName( "ou=tests" );
+        Name rdn = new LdapDN( "ou=tests" );
         assertFalse( checkSearchAsWithEntryACI( "billyd", "billyd", cons, rdn, aci, 9 ) );
 
         // now add a subentry that enables anyone to search below ou=system
@@ -761,7 +766,7 @@
      */
     private SearchResult checkCanSearhSubentryAs( String uid, String password, Name rdn )
throws NamingException
     {
-        DirContext userCtx = getContextAs( new LdapName( "uid="+uid+",ou=users,ou=system"
), password );
+        DirContext userCtx = getContextAs( new LdapDN( "uid="+uid+",ou=users,ou=system" ),
password );
         SearchControls cons = new SearchControls();
         cons.setSearchScope( SearchControls.OBJECT_SCOPE );
         SearchResult result = null;
@@ -806,7 +811,7 @@
                 "grantsAndDenials { grantRead, grantReturnDN, grantBrowse } } } } }" );
 
         // check and see if we can access the subentry now
-        assertNotNull( checkCanSearhSubentryAs( "billyd", "billyd", new LdapName( "cn=anybodySearch"
) ) );
+        assertNotNull( checkCanSearhSubentryAs( "billyd", "billyd", new LdapDN( "cn=anybodySearch"
) ) );
 
         // now add a denial to prevent all users except the admin from accessing the subentry
         addSubentryACI( "{ " +
@@ -820,7 +825,7 @@
                 "grantsAndDenials { denyRead, denyReturnDN, denyBrowse } } } } }" );
 
         // now we should not be able to access the subentry with a search
-        assertNull( checkCanSearhSubentryAs( "billyd", "billyd", new LdapName( "cn=anybodySearch"
) ) );
+        assertNull( checkCanSearhSubentryAs( "billyd", "billyd", new LdapDN( "cn=anybodySearch"
) ) );
     }
 
 
@@ -844,7 +849,7 @@
                 "grantsAndDenials { grantRead, grantReturnDN, grantBrowse, grantDiscloseOnError
} } } } }" );
 
         // get a context as the user and try a lookup of a non-existant entry under ou=groups,ou=system
-        DirContext userCtx = getContextAs( new LdapName( "uid=billyd,ou=users,ou=system"
), "billyd" );
+        DirContext userCtx = getContextAs( new LdapDN( "uid=billyd,ou=users,ou=system" ),
"billyd" );
         try
         {
             userCtx.lookup( "cn=blah,ou=groups" );



Mime
View raw message