You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2017/02/24 10:37:34 UTC
svn commit: r1784255 - in /jackrabbit/oak/branches/1.6: ./
oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/AbstractServer.java
Author: mduerig
Date: Fri Feb 24 10:37:33 2017
New Revision: 1784255
URL: http://svn.apache.org/viewvc?rev=1784255&view=rev
Log:
OAK-5542: Test failure: security.authentication.ldap.LdapProviderTest (Address already in use)
Merged c1784251
Modified:
jackrabbit/oak/branches/1.6/ (props changed)
jackrabbit/oak/branches/1.6/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/AbstractServer.java
Propchange: jackrabbit/oak/branches/1.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 24 10:37:33 2017
@@ -1,3 +1,3 @@
/jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782770,1782945,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783619,1783731,1783733,1783742,1783855,1784023,1784130
+/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782770,1782945,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783619,1783731,1783733,1783742,1783855,1784023,1784130,1784251
/jackrabbit/trunk:1345480
Modified: jackrabbit/oak/branches/1.6/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/AbstractServer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/AbstractServer.java?rev=1784255&r1=1784254&r2=1784255&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.6/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/AbstractServer.java (original)
+++ jackrabbit/oak/branches/1.6/oak-auth-ldap/src/test/java/org/apache/jackrabbit/oak/security/authentication/ldap/AbstractServer.java Fri Feb 24 10:37:33 2017
@@ -20,10 +20,13 @@
package org.apache.jackrabbit.oak.security.authentication.ldap;
+import static org.junit.Assume.assumeFalse;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.BindException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -40,6 +43,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.directory.api.ldap.model.constants.SupportedSaslMechanisms;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
+import org.apache.directory.api.ldap.model.exception.LdapConfigurationException;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.ldif.LdifEntry;
import org.apache.directory.api.ldap.model.ldif.LdifReader;
@@ -228,10 +232,28 @@ public abstract class AbstractServer {
directoryService.startup();
setupExamplePartition();
- ldapServer.start();
+ startLdapServer();
setContexts(ServerDNConstants.ADMIN_SYSTEM_DN, "secret");
}
+ /**
+ * Start the LDAP server assuming we can bind to the previously reserved port.
+ * Given that there is a small race between when the port was reserved and when the
+ * socket is actually bound this can still fail. For now we are ignoring this rare
+ * case and skip the test. See OAK-5542.
+ * @throws Exception
+ */
+ private void startLdapServer() throws Exception {
+ try {
+ ldapServer.start();
+ } catch (LdapConfigurationException e) {
+ Throwable cause = e.getCause();
+ assumeFalse("Ignoring this test as the server port is already in use (OAK-5542): " + cause,
+ cause instanceof BindException);
+ throw e;
+ }
+ }
+
protected void setupLdapServer() throws Exception {
ldapServer.setTransports(new TcpTransport(port));
ldapServer.setDirectoryService(directoryService);