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 2013/04/19 13:10:35 UTC
svn commit: r1469779 -
/directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
Author: elecharny
Date: Fri Apr 19 11:10:34 2013
New Revision: 1469779
URL: http://svn.apache.org/r1469779
Log:
Added some utility methods to bind anonymously in tests
Modified:
directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
Modified: directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java?rev=1469779&r1=1469778&r2=1469779&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java (original)
+++ directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java Fri Apr 19 11:10:34 2013
@@ -292,7 +292,7 @@ public class IntegrationUtils
String givenName = cn.split( " " )[0];
ldif.putAttribute( "givenName", givenName );
-
+
return ldif;
}
@@ -424,7 +424,7 @@ public class IntegrationUtils
public static LdapConnection getNetworkConnectionAs( String host, int port, String dn, String password )
throws Exception
{
- LdapConnection connection = new LdapNetworkConnection( host, port);
+ LdapConnection connection = new LdapNetworkConnection( host, port );
connection.bind( dn, password );
openConnections.add( connection );
@@ -433,6 +433,39 @@ public class IntegrationUtils
/**
+ * Gets an anonymous LdapNetworkConnection
+ *
+ * @param dirService The Directory Service to be connected to
+ * @return A LdapNetworkConnection instance
+ * @exception If the connection could not be established.
+ */
+ public static LdapConnection getAnonymousNetworkConnection( LdapServer ldapServer ) throws Exception
+ {
+ LdapConnection connection = getAnonymousNetworkConnection( "localhost", ldapServer.getPort() );
+
+ return connection;
+ }
+
+
+ /**
+ * Gets an anonymous LdapNetworkConnection
+ *
+ * @param dirService The Directory Service to be connected to
+ * @return A LdapNetworkConnection instance
+ * @exception If the connection could not be established.
+ */
+ public static LdapConnection getAnonymousNetworkConnection( String host, int port ) throws Exception
+ {
+ LdapConnection connection = new LdapNetworkConnection( host, port );
+ connection.bind();
+
+ openConnections.add( connection );
+
+ return connection;
+ }
+
+
+ /**
* Gets a LdapNetworkConnection bound to the Admin user (uid=admin,ou=system).
*
* @param dirService The Directory Service to be connected to