You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/10/03 17:01:33 UTC
svn commit: r1178424 -
/directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
Author: elecharny
Date: Mon Oct 3 15:01:32 2011
New Revision: 1178424
URL: http://svn.apache.org/viewvc?rev=1178424&view=rev
Log:
Re injected the Netscape LDAP dedicated methods
Modified:
directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
Modified: directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java?rev=1178424&r1=1178423&r2=1178424&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java (original)
+++ directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java Mon Oct 3 15:01:32 2011
@@ -25,6 +25,8 @@ import javax.naming.Context;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
+import netscape.ldap.LDAPConnection;
+
import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.server.constants.ServerDNConstants;
@@ -209,6 +211,36 @@ public class ServerIntegrationUtils exte
}
+ public static LDAPConnection getNsdkWiredConnection( LdapServer ldapServer ) throws Exception
+ {
+ String testServer = System.getProperty( "ldap.test.server", null );
+
+ if ( testServer == null )
+ {
+ return getNsdkWiredConnection( ldapServer, ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
+ }
+
+ LOG.debug( "ldap.test.server = " + testServer );
+
+ String admin = System.getProperty( testServer + ".admin", DEFAULT_ADMIN );
+ LOG.debug( testServer + ".admin = " + admin );
+
+ String password = System.getProperty( testServer + ".password", DEFAULT_PASSWORD );
+ LOG.debug( testServer + ".password = " + password );
+
+ String host = System.getProperty( testServer + ".host", DEFAULT_HOST );
+ LOG.debug( testServer + ".host = " + host );
+
+ int port = Integer.parseInt( System.getProperty( testServer + ".port", Integer.toString( DEFAULT_PORT ) ) );
+ LOG.debug( testServer + ".port = " + port );
+
+ LDAPConnection conn = new LDAPConnection();
+ conn.connect( 3, host, port, admin, password );
+
+ return conn;
+ }
+
+
/**
* Gets a LDAP connection instance on a server, authenticating a user.
*
@@ -244,6 +276,25 @@ public class ServerIntegrationUtils exte
/**
+ * Gets a LDAP connection instance on a server, authenticating a user.
+ *
+ * @param ldapServer The server we want to connect to
+ * @param principalDn The user's DN
+ * @param password The user's password
+ * @return A LdapConnection instance if we got one
+ * @throws Exception If the connection cannot be created
+ */
+ public static LDAPConnection getNsdkWiredConnection( LdapServer ldapServer, String principalDn, String password )
+ throws Exception
+ {
+ LDAPConnection connection = new LDAPConnection();
+ connection.connect( 3, "localhost", ldapServer.getPort(), principalDn, password );
+
+ return connection;
+ }
+
+
+ /**
* Gets a LDAP connection instance on a server. We will bind as Admin
*
* @param ldapServer The server we want to connect to