From commits-return-32454-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Mon Oct 3 15:01:54 2011 Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 708A79C2D for ; Mon, 3 Oct 2011 15:01:54 +0000 (UTC) Received: (qmail 80395 invoked by uid 500); 3 Oct 2011 15:01:54 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 80362 invoked by uid 500); 3 Oct 2011 15:01:54 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 80354 invoked by uid 99); 3 Oct 2011 15:01:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Oct 2011 15:01:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Oct 2011 15:01:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1E4FC23888EA for ; Mon, 3 Oct 2011 15:01:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1178424 - /directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java Date: Mon, 03 Oct 2011 15:01:33 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111003150133.1E4FC23888EA@eris.apache.org> 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