directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1469779 - /directory/apacheds/trunk/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
Date Fri, 19 Apr 2013 11:10:35 GMT
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



Mime
View raw message