directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucasthei...@apache.org
Subject svn commit: r1613510 - in /directory/apacheds/trunk: ./ ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/ ldap-client-test/src/test/java/org/apache/directory/shared/client/api/
Date Fri, 25 Jul 2014 20:18:39 GMT
Author: lucastheisen
Date: Fri Jul 25 20:18:39 2014
New Revision: 1613510

URL: http://svn.apache.org/r1613510
Log:
DIRAPI-199,DIRAPI-198,DIRAPI-200: Added unit tests, updated the pom dependency versions for
next development iteration

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java
    directory/apacheds/trunk/pom.xml

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java?rev=1613510&r1=1613509&r2=1613510&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java
Fri Jul 25 20:18:39 2014
@@ -26,8 +26,10 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
+
 import java.util.List;
 
+
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.message.AddResponse;
@@ -41,6 +43,7 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.server.annotations.CreateLdapConnectionPool;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.annotations.ApplyLdifFiles;
 import org.apache.directory.server.core.annotations.ContextEntry;
 import org.apache.directory.server.core.annotations.CreateDS;
@@ -90,7 +93,9 @@ import org.junit.Test;
         "ldif/muppets.ldif"
     }
 )
-@CreateLdapConnectionPool
+@CreateLdapConnectionPool(
+        maxActive = 1,
+        maxWait = 5000 )
 public class LdapConnectionTemplateTest
 {
     @ClassRule
@@ -291,6 +296,18 @@ public class LdapConnectionTemplateTest
             fail( "failed to change password" );
         }
     }
+    
+    
+    @Test
+    public void testReauthenticate() throws PasswordException
+    {
+        for ( int i = 0; i < 100; i++ ) {
+            ldapConnectionTemplate.authenticate( 
+                    ldapConnectionTemplate.newDn( 
+                            ServerDNConstants.ADMIN_SYSTEM_DN ),
+                    "secret".toCharArray() );
+        }
+    }
 
     
     @Test

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java?rev=1613510&r1=1613509&r2=1613510&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java
Fri Jul 25 20:18:39 2014
@@ -20,15 +20,19 @@
 package org.apache.directory.shared.client.api;
 
 
+import static org.junit.Assert.assertNotNull;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapConnectionConfig;
 import org.apache.directory.ldap.client.api.LdapConnectionPool;
 import org.apache.directory.ldap.client.api.PoolableLdapConnectionFactory;
+import org.apache.directory.ldap.client.template.exception.PasswordException;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.constants.ServerDNConstants;
@@ -149,4 +153,47 @@ public class LdapConnectionPoolTest exte
 
         System.out.println( "Time to create and use 10 000 connections = " + ( t1 - t0 )
);
     }
+    
+    
+    @Test
+    public void testRebind() throws Exception
+    {
+        for ( int i = 0; i < 300; i++ ) {
+            LdapConnection connection = pool.getConnection();
+            try 
+            {
+                // uncomment next line to test the unBind()
+                // bind() race condition described here:
+                // http://mail-archives.apache.org/mod_mbox/directory-dev/201407.mbox/%3CEE6ADC61AF2D71408E4FA7F9517DB7710A9C07E5%40IMCMBX03.MITRE.ORG%3E
+                //connection.unBind();
+                connection.bind( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
+            }
+            finally
+            {
+                assertNotNull( connection );
+                pool.releaseConnection( connection );
+            }
+        }
+    }
+    
+    
+    @Test
+    public void testSmallPool() throws Exception
+    {
+        LdapConnectionConfig config = new LdapConnectionConfig();
+        config.setLdapHost( "localHost" );
+        config.setLdapPort( getLdapServer().getPort() );
+        config.setName( DEFAULT_ADMIN );
+        config.setCredentials( DEFAULT_PASSWORD );
+        PoolableLdapConnectionFactory factory = new PoolableLdapConnectionFactory( config
);
+        LdapConnectionPool pool = new LdapConnectionPool( factory );
+        pool.setMaxActive( 1 );
+        pool.setTestOnBorrow( true );
+        pool.setWhenExhaustedAction( GenericObjectPool.WHEN_EXHAUSTED_FAIL );
+
+        for ( int i = 0; i < 100; i++ ) {
+            LdapConnection connection = pool.getConnection();
+            pool.releaseConnection( connection );
+        }
+    }
 }

Modified: directory/apacheds/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/pom.xml?rev=1613510&r1=1613509&r2=1613510&view=diff
==============================================================================
--- directory/apacheds/trunk/pom.xml (original)
+++ directory/apacheds/trunk/pom.xml Fri Jul 25 20:18:39 2014
@@ -45,8 +45,8 @@
     <distMgmtSiteUrl>scpexe://people.apache.org/www/directory.apache.org/apacheds/gen-docs/${project.version}/</distMgmtSiteUrl>
 
     <!-- Set versions for depending projects -->
-    <org.apache.directory.api.version>1.0.0-M23</org.apache.directory.api.version>
-    <org.apache.directory.mavibot.version>1.0.0-M5</org.apache.directory.mavibot.version>
+    <org.apache.directory.api.version>1.0.0-M24-SNAPSHOT</org.apache.directory.api.version>
+    <org.apache.directory.mavibot.version>1.0.0-M6-SNAPSHOT</org.apache.directory.mavibot.version>
     <org.apache.directory.checkstyle-configuration.version>0.1</org.apache.directory.checkstyle-configuration.version>
     <org.apache.directory.junit.junit-addons.version>0.1</org.apache.directory.junit.junit-addons.version>
     <org.apache.directory.jdbm.version>2.0.0-M2</org.apache.directory.jdbm.version>



Mime
View raw message