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 2015/09/17 16:35:45 UTC

svn commit: r1703634 - in /directory/apacheds/trunk: core-annotations/src/main/java/org/apache/directory/server/core/annotations/ core-annotations/src/main/java/org/apache/directory/server/core/factory/ kerberos-client/src/main/java/org/apache/director...

Author: elecharny
Date: Thu Sep 17 14:35:42 2015
New Revision: 1703634

URL: http://svn.apache.org/r1703634
Log:
o Using InetAddress.getLocalHost().getHostName() instead of "localhost'

Modified:
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
    directory/apacheds/trunk/kerberos-client/src/main/java/org/apache/directory/kerberos/client/KdcConfig.java
    directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosKRBProtocolTest.java
    directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosTcpITest.java
    directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosUdpITest.java
    directory/apacheds/trunk/ldap-client-test/src/main/java/org/apache/directory/shared/client/api/LdapApiIntegrationUtils.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LightweightLdapConnectionPoolTest.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConfiguration.java
    directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/transport/TcpTransport.java
    directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateTransport.java
    directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
    directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/ServerIntegrationUtils.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverSslIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthOverTlsIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/schema/MavibotSchemaIT.java

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java Thu Sep 17 14:35:42 2015
@@ -50,7 +50,7 @@ public @interface CreateAuthenticator
 
 
     /** Delegate host, use for testing DelegatingAuthenticator */
-    String delegateHost() default "localhost";
+    String delegateHost() default "";
 
 
     /** Delegate port, use for testing DelegatingAuthenticator */

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java Thu Sep 17 14:35:42 2015
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.lang.reflect.Constructor;
+import java.net.InetAddress;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -34,6 +35,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.ldif.LdifReader;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.api.util.Strings;
 import org.apache.directory.server.core.annotations.AnnotationUtils;
 import org.apache.directory.server.core.annotations.ApplyLdifFiles;
 import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -129,7 +131,15 @@ public final class DSAnnotationProcessor
                 if ( auth instanceof DelegatingAuthenticator )
                 {
                     DelegatingAuthenticator dauth = ( DelegatingAuthenticator ) auth;
-                    dauth.setDelegateHost( createAuthenticator.delegateHost() );
+                    
+                    String host = createAuthenticator.delegateHost();
+                    
+                    if ( Strings.isEmpty( host ) )
+                    {
+                        host = InetAddress.getLocalHost().getHostName();
+                    }
+                    
+                    dauth.setDelegateHost( host );
                     dauth.setDelegatePort( createAuthenticator.delegatePort() );
                     dauth.setDelegateSsl( createAuthenticator.delegateSsl() );
                     dauth.setDelegateTls( createAuthenticator.delegateTls() );

Modified: directory/apacheds/trunk/kerberos-client/src/main/java/org/apache/directory/kerberos/client/KdcConfig.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-client/src/main/java/org/apache/directory/kerberos/client/KdcConfig.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-client/src/main/java/org/apache/directory/kerberos/client/KdcConfig.java (original)
+++ directory/apacheds/trunk/kerberos-client/src/main/java/org/apache/directory/kerberos/client/KdcConfig.java Thu Sep 17 14:35:42 2015
@@ -42,7 +42,7 @@ import org.apache.directory.shared.kerbe
 public class KdcConfig
 {
     /** host name of the Kerberos server */
-    private String hostName;// = "localhost";
+    private String hostName;
 
     /** port on which the Kerberos server is listening */
     private int kdcPort = 88;

Modified: directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosKRBProtocolTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosKRBProtocolTest.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosKRBProtocolTest.java (original)
+++ directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosKRBProtocolTest.java Thu Sep 17 14:35:42 2015
@@ -61,7 +61,7 @@ import org.junit.runner.RunWith;
 @CreateKdcServer(
     transports =
         {
-            @CreateTransport(protocol = "KRB", address = "localhost")
+            @CreateTransport(protocol = "KRB")
     })
 @ApplyLdifFiles("org/apache/directory/server/kerberos/kdc/KerberosIT.ldif")
 public class KerberosKRBProtocolTest extends AbstractKerberosITest

Modified: directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosTcpITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosTcpITest.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosTcpITest.java (original)
+++ directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosTcpITest.java Thu Sep 17 14:35:42 2015
@@ -69,7 +69,7 @@ Project</a>
 @CreateKdcServer(
     transports =
         {
-            @CreateTransport(protocol = "TCP", address = "localhost", port = 6086)
+            @CreateTransport(protocol = "TCP", port = 6086)
     })
 @ApplyLdifFiles("org/apache/directory/server/kerberos/kdc/KerberosIT.ldif")
 public class KerberosTcpITest extends AbstractKerberosITest

Modified: directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosUdpITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosUdpITest.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosUdpITest.java (original)
+++ directory/apacheds/trunk/kerberos-test/src/test/java/org/apache/directory/server/kerberos/kdc/KerberosUdpITest.java Thu Sep 17 14:35:42 2015
@@ -68,8 +68,8 @@ import org.junit.runner.RunWith;
 @CreateKdcServer(
     transports =
         {
-            @CreateTransport(protocol = "TCP", address = "localhost", port = 6087),
-            @CreateTransport(protocol = "UDP", address = "localhost", port = 6087)
+            @CreateTransport(protocol = "TCP", port = 6087),
+            @CreateTransport(protocol = "UDP", port = 6087)
     })
 @ApplyLdifFiles("org/apache/directory/server/kerberos/kdc/KerberosIT.ldif")
 public class KerberosUdpITest extends AbstractKerberosITest

Modified: directory/apacheds/trunk/ldap-client-test/src/main/java/org/apache/directory/shared/client/api/LdapApiIntegrationUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/main/java/org/apache/directory/shared/client/api/LdapApiIntegrationUtils.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/main/java/org/apache/directory/shared/client/api/LdapApiIntegrationUtils.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/main/java/org/apache/directory/shared/client/api/LdapApiIntegrationUtils.java Thu Sep 17 14:35:42 2015
@@ -20,6 +20,8 @@ package org.apache.directory.shared.clie
 
 
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -69,7 +71,7 @@ public final class LdapApiIntegrationUti
     public static LdapNetworkConnection createAdminConnection( LdapServer ldapServer ) throws LdapException,
         IOException
     {
-        LdapNetworkConnection conn = new LdapNetworkConnection( DEFAULT_HOST, ldapServer.getPort() );
+        LdapNetworkConnection conn = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), ldapServer.getPort() );
         conn.bind( DEFAULT_ADMIN, DEFAULT_PASSWORD );
         return conn;
     }
@@ -139,7 +141,16 @@ public final class LdapApiIntegrationUti
         if ( !POOLS.containsKey( port ) )
         {
             LdapConnectionConfig config = new LdapConnectionConfig();
-            config.setLdapHost( DEFAULT_HOST );
+            
+            try
+            {
+                config.setLdapHost( InetAddress.getLocalHost().getHostName() );
+            }
+            catch( UnknownHostException uhe )
+            {
+                config.setLdapHost( DEFAULT_HOST );
+            }
+            
             config.setLdapPort( port );
             config.setName( DEFAULT_ADMIN );
             config.setCredentials( DEFAULT_PASSWORD );

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/ldap/client/template/LdapConnectionTemplateTest.java Thu Sep 17 14:35:42 2015
@@ -25,16 +25,18 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
-
 import static org.apache.directory.ldap.client.api.search.FilterBuilder.and;
 import static org.apache.directory.ldap.client.api.search.FilterBuilder.equal;
 import static org.apache.directory.ldap.client.api.search.FilterBuilder.endsWith;
 import static org.apache.directory.ldap.client.api.search.FilterBuilder.startsWith;
 
 
+
+import java.net.InetAddress;
 import java.util.List;
 
 
+
 import org.apache.commons.pool.impl.GenericObjectPool;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
@@ -360,10 +362,11 @@ public class LdapConnectionTemplateTest
     
     
     @Test
-    public void testDIRAPI_202() {
+    public void testDIRAPI_202() throws Exception
+    {
         // test requested by https://issues.apache.org/jira/browse/DIRAPI-202
         LdapConnectionConfig config = new LdapConnectionConfig();
-        config.setLdapHost( "localhost" );
+        config.setLdapHost( InetAddress.getLocalHost().getHostName() );
         config.setLdapPort( createLdapConnectionPoolRule.getLdapServer().getPort() );
         config.setName( "uid=admin,ou=system" );
         config.setCredentials( "secret" );

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionPoolTest.java Thu Sep 17 14:35:42 2015
@@ -57,9 +57,6 @@ public class LdapConnectionPoolTest exte
     /** The connection pool */
     private LdapConnectionPool pool;
 
-    /** The Constant DEFAULT_HOST. */
-    private static final String DEFAULT_HOST = "localhost";
-
     /** The Constant DEFAULT_ADMIN. */
     private static final String DEFAULT_ADMIN = ServerDNConstants.ADMIN_SYSTEM_DN;
 

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java Thu Sep 17 14:35:42 2015
@@ -68,9 +68,6 @@ import org.junit.runner.RunWith;
     { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
 public class LdapConnectionTest extends AbstractLdapTestUnit
 {
-    /** The Constant DEFAULT_HOST. */
-    private static final String DEFAULT_HOST = "localhost";
-
     private static final String ADMIN_DN = "uid=admin,ou=system";
 
     private LdapConnection connection;
@@ -119,7 +116,7 @@ public class LdapConnectionTest extends
     @Ignore
     public void testRebindNoPool() throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( DEFAULT_HOST, getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.bind( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
 
         for ( int i = 0; i < 10000; i++ )

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java Thu Sep 17 14:35:42 2015
@@ -89,10 +89,10 @@ public class LdapSSLConnectionTest exten
 
 
     @Before
-    public void setup()
+    public void setup() throws Exception
     {
         sslConfig = new LdapConnectionConfig();
-        sslConfig.setLdapHost( "localhost" );
+        sslConfig.setLdapHost( InetAddress.getLocalHost().getHostName() );
         sslConfig.setUseSsl( true );
         sslConfig.setLdapPort( getLdapServer().getPortSSL() );
         sslConfig.setTrustManagers( new NoVerificationTrustManager() );
@@ -100,7 +100,7 @@ public class LdapSSLConnectionTest exten
                 ldapServer.getDirectoryService().getSchemaManager() ) );
 
         tlsConfig = new LdapConnectionConfig();
-        tlsConfig.setLdapHost( "localhost" );
+        tlsConfig.setLdapHost( InetAddress.getLocalHost().getHostName() );
         tlsConfig.setLdapPort( getLdapServer().getPort() );
         tlsConfig.setTrustManagers( new NoVerificationTrustManager() );
         tlsConfig.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector(

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LightweightLdapConnectionPoolTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LightweightLdapConnectionPoolTest.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LightweightLdapConnectionPoolTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LightweightLdapConnectionPoolTest.java Thu Sep 17 14:35:42 2015
@@ -56,15 +56,12 @@ import org.junit.runner.RunWith;
  */
 @RunWith(FrameworkRunner.class)
 @CreateLdapServer(transports =
-    { @CreateTransport(protocol = "LDAP", address = "localhost", port = 10389) })
+    { @CreateTransport(protocol = "LDAP", port = 10389) })
 public class LightweightLdapConnectionPoolTest extends AbstractLdapTestUnit
 {
     /** The connection pool */
     private LdapConnectionPool pool;
 
-    /** The Constant DEFAULT_HOST. */
-    private static final String DEFAULT_HOST = "localhost";
-
     /** The Constant DEFAULT_ADMIN. */
     private static final String DEFAULT_ADMIN = ServerDNConstants.ADMIN_SYSTEM_DN;
 
@@ -471,7 +468,7 @@ public class LightweightLdapConnectionPo
     @Ignore
     public void testRebindNoPool() throws Exception
     {
-        LdapConnection connection = new LdapNetworkConnection( DEFAULT_HOST, getLdapServer().getPort() );
+        LdapConnection connection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort() );
         connection.bind( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
 
         long t0 = System.currentTimeMillis();

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/perf/TestClientApiPerf.java Thu Sep 17 14:35:42 2015
@@ -118,12 +118,12 @@ public class TestClientApiPerf extends A
 
 
     @Test
-    public void testSearchPerfWithJndi() throws NamingException
+    public void testSearchPerfWithJndi() throws NamingException, Exception
     {
         long t1 = System.currentTimeMillis();
 
         // Getting the connection
-        DirContext ctx = jndiEnv( "localhost", getLdapServer().getPort(), "", "uid=admin,ou=system", "secret", false );
+        DirContext ctx = jndiEnv( InetAddress.getLocalHost().getHostName(), getLdapServer().getPort(), "", "uid=admin,ou=system", "secret", false );
 
         long t2 = System.currentTimeMillis();
 

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConfiguration.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConfiguration.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConfiguration.java Thu Sep 17 14:35:42 2015
@@ -20,6 +20,8 @@
 package org.apache.directory.server.ldap.replication;
 
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -65,13 +67,13 @@ import org.apache.directory.ldap.client.
 public class SyncReplConfiguration implements ReplicationConsumerConfig
 {
     /** host name of the syncrepl remote server, default value is localhost */
-    private String remoteHost = "localhost";
+    private String remoteHost;
 
     /** port number of the syncrepl provider server, default is 10389 */
-    private int remotePort = 10389;
+    private int remotePort;
 
     /** The producer, as <host>:<port> */
-    private String producer = remoteHost + ":" + remotePort;
+    private String producer;
 
     /** replication user's Dn */
     private String replUserDn;
@@ -141,6 +143,20 @@ public class SyncReplConfiguration imple
         attributes = new HashSet<String>();
         // the default list of attributes
         attributes.add( SchemaConstants.ALL_USER_ATTRIBUTES );
+        
+        try
+        {
+            remoteHost = InetAddress.getLocalHost().getHostName();
+        }
+        catch ( UnknownHostException uhe )
+        {
+            // Default to localhost
+            remoteHost = "localhost";
+        }
+        
+        remotePort = 10389;
+        
+        producer = remoteHost + ":" + remotePort;
     }
 
 

Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/transport/TcpTransport.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/transport/TcpTransport.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/transport/TcpTransport.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/transport/TcpTransport.java Thu Sep 17 14:35:42 2015
@@ -19,7 +19,9 @@
 package org.apache.directory.server.protocol.shared.transport;
 
 
+import java.net.InetAddress;
 import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
 import java.util.List;
 
 import org.apache.mina.core.service.IoAcceptor;
@@ -110,10 +112,11 @@ public class TcpTransport extends Abstra
      * @param nbThreads The number of threads to create in the acceptor
      * @param backLog The queue size for incoming messages, waiting for the
      * acceptor to be ready
+     * @throws UnknownHostException 
      */
-    public TcpTransport( int tcpPort, int nbThreads, int backLog )
+    public TcpTransport( int tcpPort, int nbThreads, int backLog ) throws UnknownHostException
     {
-        super( LOCAL_HOST, tcpPort, nbThreads, backLog );
+        super( InetAddress.getLocalHost().getHostAddress(), tcpPort, nbThreads, backLog );
         this.acceptor = createAcceptor( null, tcpPort, nbThreads, backLog );
 
         LOG.debug( "TCP Transport created : <*:{},>", tcpPort );

Modified: directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateTransport.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateTransport.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateTransport.java (original)
+++ directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateTransport.java Thu Sep 17 14:35:42 2015
@@ -54,8 +54,8 @@ public @interface CreateTransport
     int port() default -1;
 
 
-    /** The InetAddress for this transport. Default to localhost */
-    String address() default "localhost";
+    /** The InetAddress for this transport. */
+    String address() default "";
 
 
     /** The backlog. Default to 50 */

Modified: directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java (original)
+++ directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java Thu Sep 17 14:35:42 2015
@@ -22,7 +22,9 @@ package org.apache.directory.server.fact
 import java.io.IOException;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
+import java.net.InetAddress;
 import java.net.ServerSocket;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -76,6 +78,7 @@ public final class ServerAnnotationProce
             for ( CreateTransport transportBuilder : transportBuilders )
             {
                 List< Transport > transports = createTransports( transportBuilder );
+                
                 for ( Transport t : transports )
                 {
                     ldapServer.addTransports( t );
@@ -459,6 +462,19 @@ public final class ServerAnnotationProce
         int nbThreads = transportBuilder.nbThreads();
         int backlog = transportBuilder.backlog();
         String address = transportBuilder.address();
+        
+        if ( Strings.isEmpty( address ) )
+        {
+            try
+            {
+                address = InetAddress.getLocalHost().getHostName();
+            }
+            catch ( UnknownHostException uhe )
+            {
+                // Default to "localhost"...
+                address = "localhost";
+            }
+        }
 
         if ( port <= 0 )
         {

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=1703634&r1=1703633&r2=1703634&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 14:35:42 2015
@@ -45,7 +45,6 @@ public class ServerIntegrationUtils exte
     private static final Logger LOG = LoggerFactory.getLogger( ServerIntegrationUtils.class );
     private static final String CTX_FACTORY = "com.sun.jndi.ldap.LdapCtxFactory";
 
-    private static final String DEFAULT_HOST = "localhost";
     private static final int DEFAULT_PORT = 10389;
     private static final String DEFAULT_ADMIN = ServerDNConstants.ADMIN_SYSTEM_DN;
     private static final String DEFAULT_PASSWORD = "secret";
@@ -199,7 +198,7 @@ public class ServerIntegrationUtils exte
         String password = System.getProperty( testServer + ".password", DEFAULT_PASSWORD );
         LOG.debug( testServer + ".password = " + password );
 
-        String host = System.getProperty( testServer + ".host", DEFAULT_HOST );
+        String host = System.getProperty( testServer + ".host", InetAddress.getLocalHost().getHostName() );
         LOG.debug( testServer + ".host = " + host );
 
         int port = Integer.parseInt( System.getProperty( testServer + ".port", Integer.toString( DEFAULT_PORT ) ) );
@@ -229,7 +228,7 @@ public class ServerIntegrationUtils exte
         String password = System.getProperty( testServer + ".password", DEFAULT_PASSWORD );
         LOG.debug( testServer + ".password = " + password );
 
-        String host = System.getProperty( testServer + ".host", DEFAULT_HOST );
+        String host = System.getProperty( testServer + ".host", InetAddress.getLocalHost().getHostName() );
         LOG.debug( testServer + ".host = " + host );
 
         int port = Integer.parseInt( System.getProperty( testServer + ".port", Integer.toString( DEFAULT_PORT ) ) );

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=1703634&r1=1703633&r2=1703634&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 14:35:42 2015
@@ -54,7 +54,6 @@ import org.junit.runner.RunWith;
         {
             @CreateAuthenticator(
                 type = DelegatingAuthenticator.class,
-                delegateHost = "localhost",
                 delegatePort = 10201,
                 delegateSsl = false) })
 @ApplyLdifs(

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=1703634&r1=1703633&r2=1703634&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 14:35:42 2015
@@ -55,7 +55,6 @@ import org.junit.runner.RunWith;
         {
             @CreateAuthenticator(
                 type = DelegatingAuthenticator.class,
-                delegateHost = "localhost",
                 delegatePort = 10201,
                 delegateSsl = true,
                 delegateTls = false) })

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=1703634&r1=1703633&r2=1703634&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 14:35:42 2015
@@ -55,7 +55,6 @@ import org.junit.runner.RunWith;
         {
             @CreateAuthenticator(
                 type = DelegatingAuthenticator.class,
-                delegateHost = "localhost",
                 delegatePort = 10201,
                 delegateSsl = false,
                 delegateTls = true) })

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/schema/MavibotSchemaIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/schema/MavibotSchemaIT.java?rev=1703634&r1=1703633&r2=1703634&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/schema/MavibotSchemaIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/schema/MavibotSchemaIT.java Thu Sep 17 14:35:42 2015
@@ -94,7 +94,7 @@ import org.junit.runner.RunWith;
     },
     enableChangeLog = false)
 @CreateLdapServer(transports =
-    { @CreateTransport(address = "localhost", port = 10389, protocol = "LDAP") })
+    { @CreateTransport(port = 10389, protocol = "LDAP") })
 public class MavibotSchemaIT extends AbstractLdapTestUnit
 {
     private static final String SUBSCHEMA_SUBENTRY = "subschemaSubentry";