HDFS-3944. Httpfs resolveAuthority() is not resolving host correctly. (tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1386994 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
37d5618742
commit
c419b1385d
@ -181,7 +181,7 @@ protected InetSocketAddress resolveAuthority() throws ServerException {
|
||||
throw new ServerException(ServerException.ERROR.S13, portKey);
|
||||
}
|
||||
try {
|
||||
InetAddress add = InetAddress.getByName(hostnameKey);
|
||||
InetAddress add = InetAddress.getByName(host);
|
||||
int portNum = Integer.parseInt(port);
|
||||
return new InetSocketAddress(add, portNum);
|
||||
} catch (UnknownHostException ex) {
|
||||
|
@ -24,8 +24,11 @@
|
||||
import org.apache.hadoop.test.HTestCase;
|
||||
import org.apache.hadoop.test.TestDir;
|
||||
import org.apache.hadoop.test.TestDirHelper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public class TestServerWebApp extends HTestCase {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@ -74,4 +77,23 @@ public void failedInit() throws Exception {
|
||||
|
||||
server.contextInitialized(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestDir
|
||||
public void testResolveAuthority() throws Exception {
|
||||
String dir = TestDirHelper.getTestDir().getAbsolutePath();
|
||||
System.setProperty("TestServerWebApp3.home.dir", dir);
|
||||
System.setProperty("TestServerWebApp3.config.dir", dir);
|
||||
System.setProperty("TestServerWebApp3.log.dir", dir);
|
||||
System.setProperty("TestServerWebApp3.temp.dir", dir);
|
||||
System.setProperty("testserverwebapp3.http.hostname", "localhost");
|
||||
System.setProperty("testserverwebapp3.http.port", "14000");
|
||||
ServerWebApp server = new ServerWebApp("TestServerWebApp3") {
|
||||
};
|
||||
|
||||
InetSocketAddress address = server.resolveAuthority();
|
||||
Assert.assertEquals("localhost", address.getHostName());
|
||||
Assert.assertEquals(14000, address.getPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -773,6 +773,8 @@ Release 2.0.2-alpha - 2012-09-07
|
||||
HDFS-3928. MiniDFSCluster should reset the first ExitException on shutdown. (eli)
|
||||
|
||||
HDFS-3938. remove current limitations from HttpFS docs. (tucu)
|
||||
|
||||
HDFS-3944. Httpfs resolveAuthority() is not resolving host correctly. (tucu)
|
||||
|
||||
BREAKDOWN OF HDFS-3042 SUBTASKS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user