directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r999091 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
Date Mon, 20 Sep 2010 19:55:12 GMT
Author: seelmann
Date: Mon Sep 20 19:55:12 2010
New Revision: 999091

URL: http://svn.apache.org/viewvc?rev=999091&view=rev
Log:
Added test to demonstrate DIRAPI-30 (Sporadic NullPointerException during SASL bind)

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java?rev=999091&r1=999090&r2=999091&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
Mon Sep 20 19:55:12 2010
@@ -22,7 +22,6 @@ package org.apache.directory.server.oper
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.lang.reflect.Field;
 import java.net.InetAddress;
@@ -73,6 +72,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.spi.BinaryAttributeDetector;
 import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -416,6 +416,51 @@ public class SaslBindIT extends Abstract
         assertTrue( ArrayUtils.isEquals( "type3_test".getBytes(), provider.getType3Response()
) );
     }
 
+
+    /**
+     * Test for DIRAPI-30 (Sporadic NullPointerException during SASL bind).
+     * Tests multiple connect/bind/unbind/disconnect.
+     */
+    @Ignore("Activate when DIRAPI-30 is solved")
+    @Test
+    public void testSequentialBinds() throws Exception
+    {
+        LdapNetworkConnection connection;
+        BindResponse resp;
+        Entry entry;
+        DN userDn = new DN( "uid=hnelson,ou=users,dc=example,dc=com" );
+
+        for ( int i = 0; i < 1000; i++ )
+        {
+            System.out.println( "try " + i );
+            // Digest-MD5
+            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            resp = connection.bindDigestMd5( userDn.getName(), "secret", null, ldapServer.getSaslRealms()
+                .get( 0 ) );
+            assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
+            entry = connection.lookup( userDn );
+            assertEquals( "hnelson", entry.get( "uid" ).getString() );
+            connection.close();
+
+            // Cram-MD5
+            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            resp = connection.bindCramMd5( userDn.getName(), "secret", null );
+            assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
+            entry = connection.lookup( userDn );
+            assertEquals( "hnelson", entry.get( "uid" ).getString() );
+            connection.close();
+
+            // GSSAPI
+            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            resp = connection.bindGssApi( userDn.getName(), "secret", ldapServer.getSaslRealms().get(
0 )
+                .toUpperCase(), "localhost", 6088 );
+            assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
+            entry = connection.lookup( userDn );
+            assertEquals( "hnelson", entry.get( "uid" ).getString() );
+            connection.close();
+        }
+    }
+
     /**
      * A NTLM client
      */



Mime
View raw message