directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1703614 [2/2] - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/ core-integ/src/main/java/org/apache/directory/server/core/integ/ core-integ/src/test/java/org/apache/directory/server/core/api/ inte...
Date Thu, 17 Sep 2015 13:20:06 GMT
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=1703614&r1=1703613&r2=1703614&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 Thu Sep 17 13:20:02 2015
@@ -19,6 +19,7 @@
 package org.apache.directory.server.integ;
 
 
+import java.net.InetAddress;
 import java.util.Hashtable;
 
 import javax.naming.Context;
@@ -253,7 +254,7 @@ public class ServerIntegrationUtils exte
     public static LdapConnection getWiredConnection( LdapServer ldapServer, String principalDn, String password )
         throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
         connection.bind( principalDn, password );
 
         return connection;
@@ -269,7 +270,7 @@ public class ServerIntegrationUtils exte
      */
     public static LdapConnection getLdapConnection( LdapServer ldapServer ) throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
 
         return connection;
     }
@@ -288,7 +289,7 @@ public class ServerIntegrationUtils exte
         throws Exception
     {
         LDAPConnection connection = new LDAPConnection();
-        connection.connect( 3, "localhost", ldapServer.getPort(), principalDn, password );
+        connection.connect( 3, InetAddress.getLocalHost().getHostName(), ldapServer.getPort(), principalDn, password );
 
         return connection;
     }
@@ -303,7 +304,7 @@ public class ServerIntegrationUtils exte
      */
     public static LdapConnection getAdminConnection( LdapServer ldapServer ) throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
         connection.bind( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
 
         return connection;

Modified: directory/apacheds/trunk/server-integ/src/test/java/MultiThreadedReadWriteTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/MultiThreadedReadWriteTest.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/MultiThreadedReadWriteTest.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/MultiThreadedReadWriteTest.java Thu Sep 17 13:20:02 2015
@@ -19,6 +19,7 @@
  */
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.net.InetAddress;
 
 import org.apache.directory.api.ldap.model.cursor.EntryCursor;
 import org.apache.directory.api.ldap.model.entry.DefaultEntry;
@@ -148,7 +149,7 @@ public class MultiThreadedReadWriteTest
 
     private LdapNetworkConnection getConnection() throws Exception
     {
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", 10389 );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), 10389 );
         connection.bind( "uid=admin,ou=system", "secret" );
         connection.setTimeOut( Long.MAX_VALUE );
         

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/dsml/engine/Dsmlv2EngineIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/dsml/engine/Dsmlv2EngineIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/dsml/engine/Dsmlv2EngineIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/dsml/engine/Dsmlv2EngineIT.java Thu Sep 17 13:20:02 2015
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertNot
 
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.net.InetAddress;
 
 import org.apache.directory.api.dsmlv2.Dsmlv2ResponseParser;
 import org.apache.directory.api.dsmlv2.engine.Dsmlv2Engine;
@@ -62,9 +63,9 @@ public class Dsmlv2EngineIT extends Abst
 
 
     @Before
-    public void setup()
+    public void setup() throws Exception
     {
-        connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
         engine = new Dsmlv2Engine( connection, "uid=admin,ou=system", "secret" );
     }
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java Thu Sep 17 13:20:02 2015
@@ -32,6 +32,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.UUID;
@@ -1157,7 +1158,7 @@ public class AddIT extends AbstractLdapT
     {
         // Limit the PDU size to 1024
         getLdapServer().getDirectoryService().setMaxPDUSize( 1024 );
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.bind( "uid=admin,ou=system", "secret" );
 
         // Inject a 1024 bytes long description
@@ -1530,7 +1531,7 @@ public class AddIT extends AbstractLdapT
     @Test
     public void testAddNullValue() throws LdapException, IOException
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0L );
 
         // Use the client API
@@ -1569,7 +1570,7 @@ public class AddIT extends AbstractLdapT
     @Test
     public void testAddNullValueDirectoryString() throws LdapException, IOException
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0L );
 
         // Use the client API

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddPerfIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddPerfIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/add/AddPerfIT.java Thu Sep 17 13:20:02 2015
@@ -20,6 +20,8 @@
 package org.apache.directory.server.operations.add;
 
 
+import java.net.InetAddress;
+
 import org.apache.directory.api.ldap.model.cursor.EntryCursor;
 import org.apache.directory.api.ldap.model.entry.DefaultEntry;
 import org.apache.directory.api.ldap.model.entry.Entry;
@@ -77,7 +79,7 @@ public class AddPerfIT extends AbstractL
     @Test
     public void testAddPerf() throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         Dn dn = new Dn( "cn=test,dc=example,dc=com" );
         Entry entry = new DefaultEntry( getService().getSchemaManager(), dn,

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/BindIT.java Thu Sep 17 13:20:02 2015
@@ -23,6 +23,9 @@ package org.apache.directory.server.oper
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredConnection;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
+
+import java.net.InetAddress;
+
 import netscape.ldap.LDAPConnection;
 import netscape.ldap.LDAPConstraints;
 import netscape.ldap.LDAPControl;
@@ -129,7 +132,7 @@ public class BindIT extends AbstractLdap
         try
         {
             conn = new LDAPConnection();
-            conn.connect( 100, "localhost", getLdapServer().getPort(), "uid=admin,ou=system", "secret" );
+            conn.connect( 100, InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(), "uid=admin,ou=system", "secret" );
             fail( "try to connect with illegal version number should fail" );
         }
         catch ( LDAPException e )
@@ -160,7 +163,7 @@ public class BindIT extends AbstractLdap
 
         try
         {
-            conn.connect( 3, "localhost", getLdapServer().getPort(),
+            conn.connect( 3, InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(),
                 "uid=akarasuluref,ou=users,ou=system", "secret", constraints );
             fail( "try to connect with illegal version number should fail" );
         }
@@ -171,7 +174,7 @@ public class BindIT extends AbstractLdap
 
         try
         {
-            conn.connect( 3, "localhost", getLdapServer().getPort(),
+            conn.connect( 3, InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(),
                 "uid=akarasuluref,ou=users,ou=system", "secret" );
             fail( "try to connect with illegal version number should fail" );
         }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java Thu Sep 17 13:20:02 2015
@@ -24,6 +24,8 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
+
 import org.apache.directory.api.ldap.model.exception.LdapAuthenticationException;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
@@ -104,7 +106,7 @@ public class DelegatedAuthIT extends Abs
     {
         assertTrue( getService().isStarted() );
         assertEquals( "DelegatedAuthIT-method", getService().getInstanceId() );
-        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", 10200 );
+        LdapConnection ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), 10200 );
 
         ldapConnection.setTimeOut( 0L );
         ldapConnection.bind( "uid=antoine,ou=users,ou=system", "secret" );
@@ -170,7 +172,7 @@ public class DelegatedAuthIT extends Abs
     {
         assertTrue( getService().isStarted() );
         assertEquals( "DelegatedAuthIT-MultipleAuthenticators-method", getService().getInstanceId() );
-        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", 10200 );
+        LdapConnection ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), 10200 );
         ldapConnection.setTimeOut( 0L );
         ldapConnection.bind( "uid=emmanuel,ou=users,ou=system", "sesame" );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverSslIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverSslIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverSslIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverSslIT.java Thu Sep 17 13:20:02 2015
@@ -24,6 +24,8 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
+
 import org.apache.directory.api.ldap.model.exception.LdapAuthenticationException;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
@@ -111,7 +113,7 @@ public class DelegatedAuthOverSslIT exte
     {
         assertTrue( getService().isStarted() );
         assertEquals( "DelegatedAuthIT-method", getService().getInstanceId() );
-        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", 10200 );
+        LdapConnection ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), 10200 );
 
         ldapConnection.setTimeOut( 0L );
         ldapConnection.bind( "uid=antoine,ou=users,ou=system", "secret" );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverTlsIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverTlsIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverTlsIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverTlsIT.java Thu Sep 17 13:20:02 2015
@@ -24,6 +24,8 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
+
 import org.apache.directory.api.ldap.model.exception.LdapAuthenticationException;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
@@ -111,7 +113,7 @@ public class DelegatedAuthOverTlsIT exte
     {
         assertTrue( getService().isStarted() );
         assertEquals( "DelegatedAuthIT-method", getService().getInstanceId() );
-        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", 10200 );
+        LdapConnection ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), 10200 );
 
         ldapConnection.setTimeOut( 0L );
         ldapConnection.bind( "uid=antoine,ou=users,ou=system", "secret" );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java Thu Sep 17 13:20:02 2015
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
@@ -176,7 +177,7 @@ public class MiscBindIT extends Abstract
         {
             // Use the netscape API as JNDI cannot be used to do a search without
             // first binding.
-            LDAPUrl url = new LDAPUrl( "localhost", getLdapServer().getPort(), "ou=system", new String[]
+            LDAPUrl url = new LDAPUrl( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(), "ou=system", new String[]
                 { "vendorName" }, 0, "(ObjectClass=*)" );
             LDAPConnection.search( url );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java Thu Sep 17 13:20:02 2015
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.lang.reflect.Field;
+import java.net.InetAddress;
 import java.nio.ByteBuffer;
 
 import javax.naming.NamingEnumeration;
@@ -237,7 +238,7 @@ public class SaslBindIT extends Abstract
     @Test
     public void testSaslBindPLAIN() throws Exception
     {
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0L );
 
         BindResponse resp = connection.bindSaslPlain( "hnelson", "secret" );
@@ -267,7 +268,7 @@ public class SaslBindIT extends Abstract
     public void testSaslBindNoMech() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         BindRequest bindReq = new BindRequestImpl();
         bindReq.setCredentials( "secret" );
         bindReq.setDn( userDn );
@@ -295,7 +296,7 @@ public class SaslBindIT extends Abstract
     public void testSaslCramMd5Bind() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0L );
 
         SaslCramMd5Request request = new SaslCramMd5Request();
@@ -319,7 +320,7 @@ public class SaslBindIT extends Abstract
     public void testSaslCramMd5BindBadPassword() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         SaslCramMd5Request request = new SaslCramMd5Request();
         request.setUsername( userDn.getRdn().getValue().getString() );
@@ -338,7 +339,7 @@ public class SaslBindIT extends Abstract
     public void testSaslDigestMd5Bind() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         SaslDigestMd5Request request = new SaslDigestMd5Request();
         request.setUsername( userDn.getRdn().getValue().getString() );
@@ -362,7 +363,7 @@ public class SaslBindIT extends Abstract
     public void testSaslDigestMd5BindSaslQoPAuth() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         SaslDigestMd5Request request = new SaslDigestMd5Request();
         request.setUsername( userDn.getRdn().getValue().getString() );
@@ -388,7 +389,7 @@ public class SaslBindIT extends Abstract
     public void testSaslDigestMd5BindSaslQoPAuthInt() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         SaslDigestMd5Request request = new SaslDigestMd5Request();
         request.setUsername( userDn.getRdn().getValue().getString() );
@@ -414,7 +415,7 @@ public class SaslBindIT extends Abstract
     public void testSaslDigestMd5BindSaslQoPAuthConf() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         SaslDigestMd5Request request = new SaslDigestMd5Request();
         request.setUsername( userDn.getRdn().getValue().getString() );
@@ -438,7 +439,7 @@ public class SaslBindIT extends Abstract
     public void testSaslDigestMd5BindBadRealm() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         SaslDigestMd5Request request = new SaslDigestMd5Request();
         request.setUsername( userDn.getRdn().getValue().getString() );
@@ -458,7 +459,7 @@ public class SaslBindIT extends Abstract
     public void testSaslDigestMd5BindBadPassword() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         SaslDigestMd5Request request = new SaslDigestMd5Request();
         request.setUsername( userDn.getRdn().getValue().getString() );
@@ -479,7 +480,7 @@ public class SaslBindIT extends Abstract
     public void testSaslGssApiBind() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0L );
 
         kdcServer.getConfig().setPaEncTimestampRequired( false );
@@ -488,7 +489,7 @@ public class SaslBindIT extends Abstract
         request.setUsername( userDn.getRdn().getValue().getString() );
         request.setCredentials( "secret" );
         request.setRealmName( ldapServer.getSaslRealms().get( 0 ).toUpperCase() );
-        request.setKdcHost( "localhost" );
+        request.setKdcHost( InetAddress.getLocalHost().getHostName() );
         request.setKdcPort( 6088 );
         BindResponse resp = connection.bind( request );
         assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
@@ -507,13 +508,13 @@ public class SaslBindIT extends Abstract
     public void testSaslGssApiBindBadRealm() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
 
         SaslGssApiRequest request = new SaslGssApiRequest();
         request.setUsername( userDn.getRdn().getValue().getString() );
         request.setCredentials( "secret" );
         request.setRealmName( "badrealm.com" );
-        request.setKdcHost( "localhost" );
+        request.setKdcHost( InetAddress.getLocalHost().getHostName() );
         request.setKdcPort( 6088 );
         try
         {
@@ -537,13 +538,13 @@ public class SaslBindIT extends Abstract
     public void testSaslGssApiBindBadPassword() throws Exception
     {
         Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
 
         SaslGssApiRequest request = new SaslGssApiRequest();
         request.setUsername( userDn.getRdn().getValue().getString() );
         request.setCredentials( "badsecret" );
         request.setRealmName( ldapServer.getSaslRealms().get( 0 ).toUpperCase() );
-        request.setKdcHost( "localhost" );
+        request.setKdcHost( InetAddress.getLocalHost().getHostName() );
         request.setKdcPort( 6088 );
         try
         {
@@ -629,7 +630,7 @@ public class SaslBindIT extends Abstract
             System.out.println( "try " + i );
 
             // Digest-MD5
-            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
             SaslDigestMd5Request digetDigestMd5Request = new SaslDigestMd5Request();
             digetDigestMd5Request.setUsername( userDn.getRdn().getValue().getString() );
             digetDigestMd5Request.setCredentials( "secret" );
@@ -641,7 +642,7 @@ public class SaslBindIT extends Abstract
             connection.close();
 
             // Cram-MD5
-            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
             SaslCramMd5Request cramMd5Request = new SaslCramMd5Request();
             cramMd5Request.setUsername( userDn.getRdn().getValue().getString() );
             cramMd5Request.setCredentials( "secret" );
@@ -652,12 +653,12 @@ public class SaslBindIT extends Abstract
             connection.close();
 
             // GSSAPI
-            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
             SaslGssApiRequest gssApiRequest = new SaslGssApiRequest();
             gssApiRequest.setUsername( userDn.getRdn().getValue().getString() );
             gssApiRequest.setCredentials( "secret" );
             gssApiRequest.setRealmName( ldapServer.getSaslRealms().get( 0 ) );
-            gssApiRequest.setKdcHost( "localhost" );
+            gssApiRequest.setKdcHost( InetAddress.getLocalHost().getHostName() );
             gssApiRequest.setKdcPort( 6088 );
             resp = connection.bind( gssApiRequest );
             assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
@@ -681,7 +682,7 @@ public class SaslBindIT extends Abstract
         {
             this.mechanism = mechanism;
             setDefaultPort( getLdapServer().getPort() );
-            connect( "localhost", getLdapServer().getPort() );
+            connect( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
             setTcpNoDelay( false );
 
             LOG.debug( "isConnected() = {}", isConnected() );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java Thu Sep 17 13:20:02 2015
@@ -25,6 +25,8 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.Hashtable;
 
 import javax.naming.AuthenticationException;
@@ -288,7 +290,7 @@ public class SimpleBindIT extends Abstra
         {
             // Use the netscape API as JNDI cannot be used to do a search without
             // first binding.
-            LDAPUrl url = new LDAPUrl( "localhost", getLdapServer().getPort(), "", new String[]
+            LDAPUrl url = new LDAPUrl( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(), "", new String[]
                 { "vendorName" }, 0, "(ObjectClass=*)" );
             LDAPSearchResults results = LDAPConnection.search( url );
 
@@ -312,7 +314,7 @@ public class SimpleBindIT extends Abstra
                 fail();
             }
         }
-        catch ( LDAPException e )
+        catch ( Exception e )
         {
             fail( "Should not have caught exception." );
         }
@@ -322,7 +324,7 @@ public class SimpleBindIT extends Abstra
         {
             // Use the netscape API as JNDI cannot be used to do a search without
             // first binding.
-            LDAPUrl url = new LDAPUrl( "localhost", getLdapServer().getPort(), "uid=admin,ou=system", attrIDs, 0,
+            LDAPUrl url = new LDAPUrl( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(), "uid=admin,ou=system", attrIDs, 0,
                 "(ObjectClass=*)" );
             LDAPConnection.search( url );
 
@@ -333,6 +335,10 @@ public class SimpleBindIT extends Abstra
             // Expected
             assertTrue( true );
         }
+        catch ( UnknownHostException uhe )
+        {
+            fail( uhe.getMessage() );
+        }
 
         getLdapServer().getDirectoryService().setAllowAnonymousAccess( oldValue );
     }
@@ -412,7 +418,7 @@ public class SimpleBindIT extends Abstra
         {
             // Use the netscape API as JNDI cannot be used to do a search without
             // first binding.
-            LDAPUrl url = new LDAPUrl( "localhost", getLdapServer().getPort(), "", new String[]
+            LDAPUrl url = new LDAPUrl( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(), "", new String[]
                 { "vendorName" }, 0, "(ObjectClass=*)" );
             LDAPSearchResults results = LDAPConnection.search( url );
 
@@ -436,7 +442,7 @@ public class SimpleBindIT extends Abstra
                 fail();
             }
         }
-        catch ( LDAPException e )
+        catch ( Exception e )
         {
             fail( "Should not have caught exception." );
         }
@@ -453,7 +459,7 @@ public class SimpleBindIT extends Abstra
     @Test
     public void testBindWithDoubleQuote() throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         connection.bind( "uid=\"admin\",ou=\"system\"", "secret" );
         assertTrue( connection.isAuthenticated() );
@@ -467,7 +473,7 @@ public class SimpleBindIT extends Abstra
     @Test
     public void testBindSimpleAuthenticatorDisabled() throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0 );
 
         try

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/compare/CompareIT.java Thu Sep 17 13:20:02 2015
@@ -28,6 +28,8 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.ReferralException;
 import javax.naming.directory.SearchControls;
@@ -260,10 +262,10 @@ public class CompareIT extends AbstractL
      * @throws LdapException
      */
     @Test(expected = InvalidConnectionException.class)
-    public void testCompareWithoutAuthentication() throws LdapException
+    public void testCompareWithoutAuthentication() throws LdapException, Exception
     {
         getLdapServer().getDirectoryService().setAllowAnonymousAccess( false );
-        LdapConnection conn = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection conn = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         conn.compare( "uid=admin,ou=system", "uid", "admin" );
         fail( "Compare success without authentication" );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java Thu Sep 17 13:20:02 2015
@@ -31,6 +31,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.UUID;
@@ -1167,7 +1168,7 @@ public class AddIT extends AbstractLdapT
     {
         // Limit the PDU size to 1024
         getLdapServer().getDirectoryService().setMaxPDUSize( 1024 );
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.bind( "uid=admin,ou=system", "secret" );
 
         // Inject a 1024 bytes long description

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/BindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/BindIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/BindIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/BindIT.java Thu Sep 17 13:20:02 2015
@@ -24,6 +24,8 @@ import static org.apache.directory.serve
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
+
 import javax.naming.AuthenticationException;
 import javax.naming.InvalidNameException;
 
@@ -149,7 +151,7 @@ public class BindIT extends AbstractLdap
         try
         {
             conn = new LDAPConnection();
-            conn.connect( 100, "localhost", getLdapServer().getPort(), "uid=admin,ou=system", "secret" );
+            conn.connect( 100, InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(), "uid=admin,ou=system", "secret" );
             fail( "try to connect with illegal version number should fail" );
         }
         catch ( LDAPException e )
@@ -180,7 +182,7 @@ public class BindIT extends AbstractLdap
 
         try
         {
-            conn.connect( 3, "localhost", getLdapServer().getPort(),
+            conn.connect( 3, InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(),
                 "uid=akarasuluref,ou=users,ou=system", "secret", constraints );
             fail( "try to connect with illegal version number should fail" );
         }
@@ -191,7 +193,7 @@ public class BindIT extends AbstractLdap
 
         try
         {
-            conn.connect( 3, "localhost", getLdapServer().getPort(),
+            conn.connect( 3, InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(),
                 "uid=akarasuluref,ou=users,ou=system", "secret" );
             fail( "try to connect with illegal version number should fail" );
         }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/CompareIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/CompareIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/CompareIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/CompareIT.java Thu Sep 17 13:20:02 2015
@@ -28,6 +28,9 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.ReferralException;
 import javax.naming.directory.SearchControls;
@@ -255,7 +258,16 @@ public class CompareIT extends AbstractL
     {
         getLdapServer().getDirectoryService().setAllowAnonymousAccess( false );
         LDAPConnection conn = new LDAPConnection();
-        conn.connect( "localhost", getLdapServer().getPort() );
+        
+        try
+        {
+            conn.connect( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
+        }
+        catch ( UnknownHostException uhe )
+        {
+            fail( uhe.getMessage() );
+        }
+        
         LDAPAttribute attr = new LDAPAttribute( "uid", "admin" );
 
         try

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyAddIT.java Thu Sep 17 13:20:02 2015
@@ -29,6 +29,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.util.Arrays;
 
 import javax.naming.NamingEnumeration;
@@ -703,7 +704,7 @@ public class ModifyAddIT extends Abstrac
     @Test
     public void testModifyAddWithNullValues() throws LdapException, IOException
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0L );
 
         // Use the client API
@@ -745,7 +746,7 @@ public class ModifyAddIT extends Abstrac
     @Test
     public void testModifyReplaceWithNullValues() throws LdapException, IOException
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0L );
 
         // Use the client API

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java Thu Sep 17 13:20:02 2015
@@ -24,6 +24,7 @@ import static org.apache.directory.serve
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -1033,7 +1034,7 @@ public class PagedSearchIT extends Abstr
     @Test
     public void testPagedSearchWrongCookie() throws Exception
     {
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.bind( "uid=admin,ou=system", "secret" );
 
         SearchControls controls = new SearchControls();

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java Thu Sep 17 13:20:02 2015
@@ -22,10 +22,8 @@ package org.apache.directory.server.oper
 
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
 import static org.junit.Assert.*;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.EventObject;
 import java.util.List;
@@ -380,7 +378,7 @@ public class PersistentSearchIT extends
     @Test
     public void testPsearchMove() throws Exception
     {
-        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapNetworkConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
         connection.bind( "uid=admin,ou=system", "secret" );
         
         Entry newOu = new DefaultEntry( "uid=persist, ou=users,ou=system" );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java Thu Sep 17 13:20:02 2015
@@ -29,6 +29,7 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
@@ -1676,7 +1677,7 @@ public class SearchIT extends AbstractLd
     @Test
     public void testAbandonnedRequest() throws Exception
     {
-        LdapConnection asyncCnx = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection asyncCnx = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         EntryCursor cursor = null;
 
         try

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java Thu Sep 17 13:20:02 2015
@@ -23,6 +23,7 @@ package org.apache.directory.server.oper
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import java.net.InetAddress;
 import java.util.Random;
 
 import org.apache.directory.api.ldap.model.cursor.CursorException;
@@ -94,7 +95,7 @@ public class SearchPerfIT extends Abstra
     @Test
     public void testSearchRequestObjectScopePerf() throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         long deltaSearch = 0L;
         long deltaGet = 0L;
         long deltaClose = 0L;
@@ -215,7 +216,7 @@ public class SearchPerfIT extends Abstra
     @Test
     public void testSearchRequestOneLevelScopePerf() throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
 
         try
         {
@@ -318,7 +319,7 @@ public class SearchPerfIT extends Abstra
     @Test
     public void testSearchRequestSubtreeLevelScopePerf() throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.setTimeOut( 0 );
 
         try
@@ -418,9 +419,9 @@ public class SearchPerfIT extends Abstra
 
 
     @Test
-    public void testSearch100kUsers() throws LdapException, CursorException, InterruptedException
+    public void testSearch100kUsers() throws LdapException, CursorException, InterruptedException, Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.bind( "uid=admin,ou=system", "secret" );
 
         Entry rootPeople = new DefaultEntry(

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java Thu Sep 17 13:20:02 2015
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -88,7 +89,7 @@ public class SortedSearchIT extends Abst
     {
         if ( con == null )
         {
-            con = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+            con = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
             con.bind( "uid=admin,ou=system", "secret" );
             con.setTimeOut( Long.MAX_VALUE );
         }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java Thu Sep 17 13:20:02 2015
@@ -36,13 +36,12 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-
+import java.net.InetAddress;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
-
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyImpl;
@@ -543,7 +542,7 @@ public class PasswordPolicyIT extends Ab
         bindReq.setCredentials( "1234" ); // wrong password
         bindReq.addControl( PP_REQ_CTRL );
 
-        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
 
         for ( int i = 0; i < 3; i++ )
         {
@@ -747,7 +746,7 @@ public class PasswordPolicyIT extends Ab
         bindReq.setCredentials( password.getBytes() );
         bindReq.addControl( PP_REQ_CTRL );
 
-        try (LdapConnection userCon = new LdapNetworkConnection( "localhost", ldapServer.getPort() ))
+        try (LdapConnection userCon = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() ))
         {
             userCon.setTimeOut( 0 );
     
@@ -796,7 +795,7 @@ public class PasswordPolicyIT extends Ab
         bindReq.setCredentials( password.getBytes() );
         bindReq.addControl( PP_REQ_CTRL );
 
-        try (LdapConnection userCon = new LdapNetworkConnection( "localhost", ldapServer.getPort() ))
+        try (LdapConnection userCon = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() ))
         {
             userCon.setTimeOut( 0 );
     
@@ -859,7 +858,7 @@ public class PasswordPolicyIT extends Ab
         bindReq.setCredentials( password.getBytes() );
         bindReq.addControl( PP_REQ_CTRL );
 
-        try (LdapConnection userCon = new LdapNetworkConnection( "localhost", ldapServer.getPort() ))
+        try (LdapConnection userCon = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() ))
         {
             userCon.setTimeOut( 0 );
     
@@ -923,7 +922,7 @@ public class PasswordPolicyIT extends Ab
         bindReq.setCredentials( password.getBytes() );
         bindReq.addControl( PP_REQ_CTRL );
 
-        try (LdapConnection userCon = new LdapNetworkConnection( "localhost", ldapServer.getPort() ))
+        try (LdapConnection userCon = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() ))
         {
             userCon.setTimeOut( 0 );
     
@@ -1000,7 +999,7 @@ public class PasswordPolicyIT extends Ab
         assertEquals( modSubEntryDn, userEntry.get( "pwdPolicySubEntry" ).getString() );
 
         // try to modify the subentry as a non-admin
-        adminConnection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+        adminConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         adminConnection.bind( userDn.getName(), password );
 
         modResp = adminConnection.modify( modReq );
@@ -1031,7 +1030,7 @@ public class PasswordPolicyIT extends Ab
         bindReq.setCredentials( "12345" ); // grace login
         bindReq.addControl( PP_REQ_CTRL );
 
-        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
 
         Thread.sleep( 2000 ); // let the password expire
         BindResponse bindResp = userConnection.bind( bindReq );
@@ -1083,7 +1082,7 @@ public class PasswordPolicyIT extends Ab
         bindReq.setCredentials( "1234" ); // wrong password
         bindReq.addControl( PP_REQ_CTRL );
 
-        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
 
         for ( int i = 0; i < 4; i++ )
         {
@@ -1125,7 +1124,7 @@ public class PasswordPolicyIT extends Ab
 
         addUser( adminConnection, "userLockout", "12345" );
 
-        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
         userConnection.setTimeOut( 0L );
 
         checkBind( userConnection, userDn, "badPassword", 3,
@@ -1159,7 +1158,7 @@ public class PasswordPolicyIT extends Ab
 
         addUser( adminConnection, "userLockout2", "12345" );
 
-        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
         userConnection.setTimeOut( 0L );
 
         checkBind( userConnection, userDn, "badPassword", 3,
@@ -1218,7 +1217,7 @@ public class PasswordPolicyIT extends Ab
 
         addUser( adminConnection, "userLockout3", "12345" );
 
-        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
         userConnection.setTimeOut( 0L );
 
         // First attempt
@@ -1291,7 +1290,7 @@ public class PasswordPolicyIT extends Ab
 
         addUser( adminConnection, "userLockout", "12345" );
 
-        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+        LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
 
         // Do two attempts 
         checkBind( userConnection, userDn, "badPassword", 1,
@@ -1354,7 +1353,7 @@ public class PasswordPolicyIT extends Ab
 
         addUser( adminConnection, "userAllowUserChange", "12345" );
 
-        try (LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() ))
+        try (LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() ))
         {
             userConnection.setTimeOut( 0L );
     
@@ -1409,9 +1408,9 @@ public class PasswordPolicyIT extends Ab
             Dn userDn = new Dn( "cn=" + userCn + ",ou=system" );
             String password = "12345";
             adminConnection = getAdminNetworkConnection( getLdapServer() );
-            userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
             userConnection.setTimeOut( 0L );
-            userConnection2 = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            userConnection2 = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
             userConnection2.setTimeOut( 0L );
 
             addUser( adminConnection, userCn, password );
@@ -1520,7 +1519,7 @@ public class PasswordPolicyIT extends Ab
            "userPassword: 12345" );
        adminConnection.add( userEntry );
 
-       LdapConnection userConnection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
+       LdapConnection userConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
        BindRequest bindRequest = new BindRequestImpl();
        bindRequest.setDn( userDn );
        bindRequest.setCredentials( "12345" );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java Thu Sep 17 13:20:02 2015
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTru
 
 import java.io.File;
 import java.io.IOException;
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -263,7 +264,7 @@ public class ClientInitialRefreshIT
     {
         final ReplicationConsumer syncreplClient = new MockSyncReplConsumer();
         final SyncReplConfiguration config = new SyncReplConfiguration();
-        config.setRemoteHost( "localhost" );
+        config.setRemoteHost( InetAddress.getLocalHost().getHostName() );
         config.setRemotePort( 16000 );
         config.setReplUserDn( "uid=admin,ou=system" );
         config.setReplUserPassword( "secret".getBytes() );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/StaleEventLogDetectionIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/StaleEventLogDetectionIT.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/StaleEventLogDetectionIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/StaleEventLogDetectionIT.java Thu Sep 17 13:20:02 2015
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertTru
 
 import java.io.File;
 import java.io.IOException;
+import java.net.InetAddress;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.io.FileUtils;
@@ -226,7 +227,7 @@ public class StaleEventLogDetectionIT
     {
         final ReplicationConsumer syncreplClient = new MockSyncReplConsumer();
         final SyncReplConfiguration config = new SyncReplConfiguration();
-        config.setRemoteHost( "localhost" );
+        config.setRemoteHost( InetAddress.getLocalHost().getHostName() );
         config.setRemotePort( 16000 );
         config.setReplUserDn( "uid=admin,ou=system" );
         config.setReplUserPassword( "secret".getBytes() );

Modified: directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java (original)
+++ directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java Thu Sep 17 13:20:02 2015
@@ -80,7 +80,7 @@ public class UberjarMain
             case STOP:
                 LOG.debug( "Stopping runtime" );
                 InstanceLayout layout = new InstanceLayout( instanceDirectory );
-                try ( Socket socket = new Socket( "localhost", readShutdownPort( layout ) );
+                try ( Socket socket = new Socket( InetAddress.getLocalHost().getHostName(), readShutdownPort( layout ) );
                     PrintWriter writer = new PrintWriter( socket.getOutputStream() ) )
                 {
                     writer.print( readShutdownPassword( layout ) );
@@ -181,7 +181,7 @@ public class UberjarMain
             public void run()
             {
                 // bind to localhost only to prevent connections from outside the box
-                try ( ServerSocket shutdownSocket = new ServerSocket( shutdownPort, 1, InetAddress.getByName( "localhost" ) ) )
+                try ( ServerSocket shutdownSocket = new ServerSocket( shutdownPort, 1, InetAddress.getLocalHost()) )
                 {
                     writeShutdownPort( layout, shutdownSocket.getLocalPort() );
                     

Modified: directory/apacheds/trunk/service/src/test/java/org/apache/directory/server/UberJarMainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service/src/test/java/org/apache/directory/server/UberJarMainTest.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/service/src/test/java/org/apache/directory/server/UberJarMainTest.java (original)
+++ directory/apacheds/trunk/service/src/test/java/org/apache/directory/server/UberJarMainTest.java Thu Sep 17 13:20:02 2015
@@ -23,6 +23,7 @@ package org.apache.directory.server;
 import static org.junit.Assert.fail;
 
 import java.io.File;
+import java.net.InetAddress;
 import java.util.Calendar;
 
 import org.apache.commons.io.FileUtils;
@@ -109,7 +110,7 @@ public class UberJarMainTest
                 {
                     // Creating a connection on the created server
                     LdapConnectionConfig configuration = new LdapConnectionConfig();
-                    configuration.setLdapHost( "localhost" );
+                    configuration.setLdapHost( InetAddress.getLocalHost().getHostName() );
                     configuration.setLdapPort( 10389 );
                     configuration.setName( ServerDNConstants.ADMIN_SYSTEM_DN );
                     configuration.setCredentials( PartitionNexus.ADMIN_PASSWORD_STRING );

Modified: directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/CreateLdapConnectionPoolRule.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/CreateLdapConnectionPoolRule.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/CreateLdapConnectionPoolRule.java (original)
+++ directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/CreateLdapConnectionPoolRule.java Thu Sep 17 13:20:02 2015
@@ -21,6 +21,8 @@ package org.apache.directory.server.core
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 
 import org.apache.commons.pool.PoolableObjectFactory;
 import org.apache.commons.pool.impl.GenericObjectPool.Config;
@@ -165,7 +167,16 @@ public class CreateLdapConnectionPoolRul
             Class<? extends LdapConnectionValidator> validatorClass )
     {
         LdapConnectionConfig config = new LdapConnectionConfig();
-        config.setLdapHost( "localhost" );
+        
+        try
+        {
+            config.setLdapHost( InetAddress.getLocalHost().getHostName() );
+        }
+        catch ( UnknownHostException uhe )
+        {
+            config.setLdapHost( "localhost" );
+        }
+        
         config.setLdapPort( ldapServer.getPort() );
         config.setName( "uid=admin,ou=system" );
         config.setCredentials( "secret" );

Modified: directory/apacheds/trunk/test-framework/src/test/java/org/apache/directory/server/core/integ/TestCreateLdapServerRule.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/test-framework/src/test/java/org/apache/directory/server/core/integ/TestCreateLdapServerRule.java?rev=1703614&r1=1703613&r2=1703614&view=diff
==============================================================================
--- directory/apacheds/trunk/test-framework/src/test/java/org/apache/directory/server/core/integ/TestCreateLdapServerRule.java (original)
+++ directory/apacheds/trunk/test-framework/src/test/java/org/apache/directory/server/core/integ/TestCreateLdapServerRule.java Thu Sep 17 13:20:02 2015
@@ -26,6 +26,8 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
@@ -118,7 +120,7 @@ public class TestCreateLdapServerRule
         {
             LdapServer ldapServer = createLdapServerRule.getLdapServer();
             ldapServer.getPort();
-            ldapConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
             ldapConnection.connect();
             ldapConnection.bind( "uid=admin,ou=system", "secret" );
     
@@ -138,6 +140,10 @@ public class TestCreateLdapServerRule
                 // expected
             }
         }
+        catch ( UnknownHostException uhe )
+        {
+            fail( uhe.getMessage() );
+        }
         catch ( LdapException e )
         {
             fail( e.getMessage() );
@@ -176,7 +182,7 @@ public class TestCreateLdapServerRule
         {
             LdapServer ldapServer = createLdapServerRule.getLdapServer();
             ldapServer.getPort();
-            ldapConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
             ldapConnection.connect();
             ldapConnection.bind( "uid=admin,ou=system", "secret" );
     
@@ -189,6 +195,10 @@ public class TestCreateLdapServerRule
         {
             fail( e.getMessage() );
         }
+        catch ( UnknownHostException uhe )
+        {
+            fail( uhe.getMessage() );
+        }
         finally
         {
             if ( ldapConnection != null )
@@ -225,7 +235,7 @@ public class TestCreateLdapServerRule
     
             LOG.debug( "getting network connection" );
             ldapServer.getPort();
-            ldapConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
+            ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
             ldapConnection.connect();
             ldapConnection.bind( "uid=admin,ou=system", "secret" );
     
@@ -237,6 +247,10 @@ public class TestCreateLdapServerRule
         {
             fail( e.getMessage() );
         }
+        catch ( UnknownHostException uhe )
+        {
+            fail( uhe.getMessage() );
+        }
         finally
         {
             if ( ldapConnection != null )



Mime
View raw message