directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r1031793 - in /directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api: ./ operations/ operations/bind/ operations/search/
Date Fri, 05 Nov 2010 20:57:34 GMT
Author: felixk
Date: Fri Nov  5 20:57:33 2010
New Revision: 1031793

URL: http://svn.apache.org/viewvc?rev=1031793&view=rev
Log:
Closing multiple open Cursors and Connections to avoid
org.apache.directory.shared.ldap.exception.LdapConfigurationException: ERR_171 Failed to bind
an LDAP service (1,025) to the service registry.
Caused by: java.net.SocketException: Too many open files

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/NetworkSchemaLoaderTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java?rev=1031793&r1=1031792&r2=1031793&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
Fri Nov  5 20:57:33 2010
@@ -221,6 +221,7 @@ public class LdapConnectionTest extends 
             Entry result = ( ( SearchResultEntry ) cursor.get() ).getEntry();
             map.put( result.getDn().getName(), result );
         }
+        cursor.close();
 
         assertEquals( 2, map.size() );
 
@@ -236,5 +237,6 @@ public class LdapConnectionTest extends 
         
         BindResponse resp = connection.bind();
         assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
+        connection.close();
     }
 }

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java?rev=1031793&r1=1031792&r2=1031793&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
Fri Nov  5 20:57:33 2010
@@ -105,7 +105,7 @@ public class LdapSSLConnectionTest exten
      * @throws IOException
      */
     @Test
-    public void testBindRequest()
+    public void testBindRequest() throws Exception
     {
         LdapConnection connection = null;
         try
@@ -114,14 +114,16 @@ public class LdapSSLConnectionTest exten
             BindResponse bindResponse = connection.bind( "uid=admin,ou=system", "secret"
);
 
             assertNotNull( bindResponse );
-
-            connection.close();
         }
         catch ( Exception le )
         {
             le.printStackTrace();
             fail();
         }
+        finally
+        {
+            connection.close();
+        }
     }
 
 
@@ -136,7 +138,7 @@ public class LdapSSLConnectionTest exten
         List<String> controlList = connection.getSupportedControls();
         assertNotNull( controlList );
         assertFalse( controlList.isEmpty() );
-        
+
         connection.close();
     }    
     
@@ -147,7 +149,7 @@ public class LdapSSLConnectionTest exten
      * @throws IOException
      */
     @Test
-    public void testStartTLSBindRequest()
+    public void testStartTLSBindRequest() throws Exception
     {
         LdapNetworkConnection connection = null;
         try
@@ -165,6 +167,10 @@ public class LdapSSLConnectionTest exten
         {
             fail();
         }
+        finally
+        {
+            connection.close();
+        }
     }
 
 
@@ -174,12 +180,14 @@ public class LdapSSLConnectionTest exten
         LdapNetworkConnection connection = new LdapNetworkConnection( tlsConfig );
         connection.connect();
         connection.startTls();
-        
+
         DN dn = new DN( "uid=admin,ou=system" );
         connection.bind( dn.getName(), "secret" );
 
         List<String> controlList = connection.getSupportedControls();
         assertNotNull( controlList );
         assertFalse( controlList.isEmpty() );
+
+        connection.close();
     }
 }

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/NetworkSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/NetworkSchemaLoaderTest.java?rev=1031793&r1=1031792&r2=1031793&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/NetworkSchemaLoaderTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/NetworkSchemaLoaderTest.java
Fri Nov  5 20:57:33 2010
@@ -51,19 +51,21 @@ public class NetworkSchemaLoaderTest ext
     {
         LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort()
);
         connection.bind( "uid=admin,ou=system", "secret" );
-        
+
         NetworkSchemaLoader loader = new NetworkSchemaLoader( connection );
-        
+
         SchemaManager sm = new DefaultSchemaManager( loader );
 
         boolean loaded = sm.loadAllEnabled();
-        
+
         if ( !loaded )
         {
             fail( "Schema load failed : " + LdapExceptionUtils.printErrors( sm.getErrors()
) );
         }
-        
+
         assertTrue( sm.getRegistries().getAttributeTypeRegistry().contains( "cn" ) );
+
+        connection.close();
     }
 
 }

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java?rev=1031793&r1=1031792&r2=1031793&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java
Fri Nov  5 20:57:33 2010
@@ -152,6 +152,7 @@ public class ClientAbandonRequestTest ex
             results.get();
             n++;
         }
+        results.close();
 
         assertEquals( numEntries, n );
     }

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java?rev=1031793&r1=1031792&r2=1031793&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
Fri Nov  5 20:57:33 2010
@@ -176,6 +176,7 @@ public class SimpleBindRequestTest exten
             //System.out.println( "----------------Unbind" + i + "-------------" );
             connection.unBind();
             assertFalse( connection.isConnected() );
+            connection.close();
 
             // Try with empty strings
             connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
@@ -189,6 +190,7 @@ public class SimpleBindRequestTest exten
 
             connection.unBind();
             assertFalse( connection.isConnected() );
+            connection.close();
 
             // Try with null parameters
             connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
@@ -203,11 +205,13 @@ public class SimpleBindRequestTest exten
 
             connection.unBind();
             assertFalse( connection.isConnected() );
+            connection.close();
 
             connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
 
             //System.out.println( "----------------Unbind done" + i + "-------------" );
             assertFalse( connection.isConnected() );
+            connection.close();
             //System.out.println( "----------------Unconnected" + i + "-------------" );
 
         }

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java?rev=1031793&r1=1031792&r2=1031793&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
Fri Nov  5 20:57:33 2010
@@ -134,6 +134,7 @@ public class ClientSearchRequestTest ext
         assertNotNull( done );
         assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
         assertEquals( 5, count );
+        cursor.close();
     }
 
 
@@ -151,6 +152,7 @@ public class ClientSearchRequestTest ext
         }
 
         assertEquals( 4, count );
+        cursor.close();
     }
 
 
@@ -221,6 +223,7 @@ public class ClientSearchRequestTest ext
         {
             count++;
         }
+        cursor.close();
 
         // due to dereferencing of aliases we get only one entry
         assertEquals( 2, count );
@@ -233,6 +236,7 @@ public class ClientSearchRequestTest ext
         {
             count++;
         }
+        cursor.close();
 
         assertEquals( 3, count );
     }

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java?rev=1031793&r1=1031792&r2=1031793&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/SearchRequestReturningAttributesTest.java
Fri Nov  5 20:57:33 2010
@@ -112,6 +112,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -149,6 +150,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -182,6 +184,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -216,6 +219,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -251,6 +255,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -287,6 +292,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -321,6 +327,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -355,6 +362,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -389,6 +397,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -422,6 +431,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -452,6 +462,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );
@@ -483,6 +494,7 @@ public class SearchRequestReturningAttri
             assertNotNull( response );
             count++;
         }
+        cursor.close();
 
         assertEquals( 1, count );
         assertNotNull( response );



Mime
View raw message