HDFS-11934. Add assertion to TestDefaultNameNodePort#testGetAddressFromConf. Contributed by Nikhil Navadiya.
This commit is contained in:
parent
a3f68933d7
commit
1a2a352ecd
|
@ -32,35 +32,37 @@ public class TestDefaultNameNodePort {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAddressFromString() throws Exception {
|
public void testGetAddressFromString() throws Exception {
|
||||||
assertEquals(DFSUtilClient.getNNAddress("foo").getPort(),
|
assertEquals(HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT,
|
||||||
HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT);
|
DFSUtilClient.getNNAddress("foo").getPort());
|
||||||
assertEquals(DFSUtilClient.getNNAddress("hdfs://foo/").getPort(),
|
assertEquals(HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT,
|
||||||
HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT);
|
DFSUtilClient.getNNAddress("hdfs://foo/").getPort());
|
||||||
assertEquals(DFSUtilClient.getNNAddress("hdfs://foo:555").getPort(),
|
assertEquals(555,
|
||||||
555);
|
DFSUtilClient.getNNAddress("hdfs://foo:555").getPort());
|
||||||
assertEquals(DFSUtilClient.getNNAddress("foo:555").getPort(),
|
assertEquals(555,
|
||||||
555);
|
DFSUtilClient.getNNAddress("foo:555").getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAddressFromConf() throws Exception {
|
public void testGetAddressFromConf() throws Exception {
|
||||||
Configuration conf = new HdfsConfiguration();
|
Configuration conf = new HdfsConfiguration();
|
||||||
FileSystem.setDefaultUri(conf, "hdfs://foo/");
|
FileSystem.setDefaultUri(conf, "hdfs://foo/");
|
||||||
assertEquals(DFSUtilClient.getNNAddress(conf).getPort(),
|
assertEquals(HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT,
|
||||||
HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT);
|
DFSUtilClient.getNNAddress(conf).getPort());
|
||||||
FileSystem.setDefaultUri(conf, "hdfs://foo:555/");
|
FileSystem.setDefaultUri(conf, "hdfs://foo:555/");
|
||||||
assertEquals(DFSUtilClient.getNNAddress(conf).getPort(), 555);
|
assertEquals(555, DFSUtilClient.getNNAddress(conf).getPort());
|
||||||
FileSystem.setDefaultUri(conf, "foo");
|
FileSystem.setDefaultUri(conf, "foo");
|
||||||
assertEquals(DFSUtilClient.getNNAddress(conf).getPort(),
|
assertEquals(HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT,
|
||||||
HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT);
|
DFSUtilClient.getNNAddress(conf).getPort());
|
||||||
|
FileSystem.setDefaultUri(conf, "foo:555");
|
||||||
|
assertEquals(555, DFSUtilClient.getNNAddress(conf).getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetUri() {
|
public void testGetUri() {
|
||||||
assertEquals(DFSUtilClient.getNNUri(new InetSocketAddress("foo", 555)),
|
assertEquals(URI.create("hdfs://foo:555"),
|
||||||
URI.create("hdfs://foo:555"));
|
DFSUtilClient.getNNUri(new InetSocketAddress("foo", 555)));
|
||||||
assertEquals(DFSUtilClient.getNNUri(new InetSocketAddress("foo",
|
assertEquals(URI.create("hdfs://foo"),
|
||||||
HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT)),
|
DFSUtilClient.getNNUri(new InetSocketAddress("foo",
|
||||||
URI.create("hdfs://foo"));
|
HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue