directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1732068 [3/3] - in /directory/apacheds/trunk: core-annotations/src/main/java/org/apache/directory/server/core/factory/ core-integ/src/main/java/org/apache/directory/server/core/integ/ core-integ/src/test/java/org/apache/directory/server/co...
Date Wed, 24 Feb 2016 10:50:13 GMT
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=1732068&r1=1732067&r2=1732068&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
Wed Feb 24 10:50:12 2016
@@ -20,7 +20,6 @@ package org.apache.directory.server;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
-import java.net.InetAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.nio.CharBuffer;
@@ -29,6 +28,7 @@ import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.UUID;
 
+import org.apache.directory.api.util.Network;
 import org.apache.directory.server.core.api.InstanceLayout;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -82,7 +82,7 @@ public class UberjarMain
                 // Stops the server
                 LOG.debug( "Stopping runtime" );
                 InstanceLayout layout = new InstanceLayout( instanceDirectory );
-                try ( Socket socket = new Socket( InetAddress.getLocalHost().getHostName(),
readShutdownPort( layout ) );
+                try ( Socket socket = new Socket( Network.LOOPBACK, readShutdownPort( layout
) );
                     PrintWriter writer = new PrintWriter( socket.getOutputStream() ) )
                 {
                     writer.print( readShutdownPassword( layout ) );
@@ -233,7 +233,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.getLocalHost()
) )
+                try ( ServerSocket shutdownSocket = new ServerSocket( shutdownPort, 1, Network.LOOPBACK
) )
                 {
                     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=1732068&r1=1732067&r2=1732068&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
Wed Feb 24 10:50:12 2016
@@ -23,7 +23,6 @@ package org.apache.directory.server;
 import static org.junit.Assert.fail;
 
 import java.io.File;
-import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Calendar;
 
@@ -35,6 +34,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.util.Network;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapConnectionConfig;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
@@ -98,7 +98,7 @@ public class UberJarMainTest
     private LdapConnection createConnection() throws LdapException, UnknownHostException
     {
         LdapConnectionConfig configuration = new LdapConnectionConfig();
-        configuration.setLdapHost( InetAddress.getLocalHost().getHostName() );
+        configuration.setLdapHost( Network.LOOPBACK_HOSTNAME );
         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=1732068&r1=1732067&r2=1732068&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
Wed Feb 24 10:50:12 2016
@@ -21,12 +21,11 @@ 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;
 import org.apache.directory.api.ldap.codec.api.DefaultConfigurableBinaryAttributeDetector;
+import org.apache.directory.api.util.Network;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapConnectionConfig;
 import org.apache.directory.ldap.client.api.LdapConnectionFactory;
@@ -168,14 +167,7 @@ public class CreateLdapConnectionPoolRul
     {
         LdapConnectionConfig config = new LdapConnectionConfig();
         
-        try
-        {
-            config.setLdapHost( InetAddress.getLocalHost().getHostName() );
-        }
-        catch ( UnknownHostException uhe )
-        {
-            config.setLdapHost( "localhost" );
-        }
+        config.setLdapHost( Network.LOOPBACK_HOSTNAME );
         
         config.setLdapPort( ldapServer.getPort() );
         config.setName( "uid=admin,ou=system" );

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=1732068&r1=1732067&r2=1732068&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
Wed Feb 24 10:50:12 2016
@@ -26,13 +26,12 @@ 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;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.util.Network;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.server.annotations.CreateLdapServer;
@@ -120,7 +119,7 @@ public class TestCreateLdapServerRule
         {
             LdapServer ldapServer = createLdapServerRule.getLdapServer();
             ldapServer.getPort();
-            ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(),
ldapServer.getPort() );
+            ldapConnection = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME, ldapServer.getPort()
);
             ldapConnection.connect();
             ldapConnection.bind( "uid=admin,ou=system", "secret" );
     
@@ -140,10 +139,6 @@ public class TestCreateLdapServerRule
                 // expected
             }
         }
-        catch ( UnknownHostException uhe )
-        {
-            fail( uhe.getMessage() );
-        }
         catch ( LdapException e )
         {
             fail( e.getMessage() );
@@ -182,7 +177,7 @@ public class TestCreateLdapServerRule
         {
             LdapServer ldapServer = createLdapServerRule.getLdapServer();
             ldapServer.getPort();
-            ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(),
ldapServer.getPort() );
+            ldapConnection = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME, ldapServer.getPort()
);
             ldapConnection.connect();
             ldapConnection.bind( "uid=admin,ou=system", "secret" );
     
@@ -195,10 +190,6 @@ public class TestCreateLdapServerRule
         {
             fail( e.getMessage() );
         }
-        catch ( UnknownHostException uhe )
-        {
-            fail( uhe.getMessage() );
-        }
         finally
         {
             if ( ldapConnection != null )
@@ -235,7 +226,7 @@ public class TestCreateLdapServerRule
     
             LOG.debug( "getting network connection" );
             ldapServer.getPort();
-            ldapConnection = new LdapNetworkConnection( InetAddress.getLocalHost().getHostName(),
ldapServer.getPort() );
+            ldapConnection = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME, ldapServer.getPort()
);
             ldapConnection.connect();
             ldapConnection.bind( "uid=admin,ou=system", "secret" );
     
@@ -247,10 +238,6 @@ public class TestCreateLdapServerRule
         {
             fail( e.getMessage() );
         }
-        catch ( UnknownHostException uhe )
-        {
-            fail( uhe.getMessage() );
-        }
         finally
         {
             if ( ldapConnection != null )



Mime
View raw message