directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r925848 - in /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz: DeleteAuthorizationIT.java SearchAuthorizationIT.java
Date Sun, 21 Mar 2010 18:12:43 GMT
Author: kayyagari
Date: Sun Mar 21 18:12:43 2010
New Revision: 925848

URL: http://svn.apache.org/viewvc?rev=925848&view=rev
Log:
o added a cleanup method to run after a method execution
o added a global connection to be reused in the recursive methods performing ldap add/delete
operations

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java?rev=925848&r1=925847&r2=925848&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java
Sun Mar 21 18:12:43 2010
@@ -31,11 +31,13 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.message.DeleteResponse;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -58,6 +60,13 @@ public class DeleteAuthorizationIT exten
     }
     
     
+    @After
+    public void closeConnections()
+    {
+        IntegrationUtils.closeConections();
+    }
+    
+    
     /**
      * Checks if a simple entry (organizationalUnit) can be deleted from the DIT at an
      * RDN relative to ou=system by a specific non-admin user.  The entry is first

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java?rev=925848&r1=925847&r2=925848&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
Sun Mar 21 18:12:43 2010
@@ -67,10 +67,14 @@ import org.junit.runner.RunWith;
 public class SearchAuthorizationIT extends AbstractLdapTestUnit
 {
 
+    // to avoid creating too many connections during recursive operations
+    private LdapConnection reusableAdminCon;
+    
     @Before
-    public void setService()
+    public void setService() throws Exception
     {
         AutzIntegUtils.ldapServer = ldapServer;
+        reusableAdminCon = getAdminConnection();
     }
 
     @After
@@ -130,7 +134,7 @@ public class SearchAuthorizationIT exten
             childRdn.add( "ou=" + i );
             childRdns[i] = childRdn;
             children[i].setDn( childRdn );
-            getAdminConnection().add( children[i] );
+            reusableAdminCon.add( children[i] );
             count[0]++;
         }
 
@@ -165,7 +169,7 @@ public class SearchAuthorizationIT exten
         entry.add( SchemaConstants.OU_AT, "tests" );
         entry.setDn( base );
 
-        getAdminConnection().add( entry );
+        reusableAdminCon.add( entry );
 
         recursivelyAddSearchData( base, getTestNodes( branchingFactor ), sizelimit, new long[]
             { 1 } );
@@ -181,8 +185,7 @@ public class SearchAuthorizationIT exten
      */
     private void recursivelyDelete( DN rdn ) throws Exception
     {
-        LdapConnection sysRoot = getAdminConnection();
-        Cursor<SearchResponse> results = sysRoot.search( rdn.getName(), "(objectClass=*)",
SearchScope.ONELEVEL, "*" );
+        Cursor<SearchResponse> results = reusableAdminCon.search( rdn.getName(), "(objectClass=*)",
SearchScope.ONELEVEL, "*" );
 
         while ( results.next() )
         {
@@ -192,7 +195,7 @@ public class SearchAuthorizationIT exten
         }
 
         results.close();
-        sysRoot.delete( rdn );
+        reusableAdminCon.delete( rdn );
     }
 
 



Mime
View raw message