You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ay...@apache.org on 2019/09/26 15:24:36 UTC

[hadoop] branch trunk updated: HDFS-11934. Add assertion to TestDefaultNameNodePort#testGetAddressFromConf. Contributed by Nikhil Navadiya.

This is an automated email from the ASF dual-hosted git repository.

ayushsaxena pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 1a2a352  HDFS-11934. Add assertion to TestDefaultNameNodePort#testGetAddressFromConf. Contributed by Nikhil Navadiya.
1a2a352 is described below

commit 1a2a352ecd4cc7c8d71b6bebf52609c5764d2981
Author: Ayush Saxena <ay...@apache.org>
AuthorDate: Thu Sep 26 20:45:37 2019 +0530

    HDFS-11934. Add assertion to TestDefaultNameNodePort#testGetAddressFromConf. Contributed by Nikhil Navadiya.
---
 .../hadoop/hdfs/TestDefaultNameNodePort.java       | 38 ++++++++++++----------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/TestDefaultNameNodePort.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/TestDefaultNameNodePort.java
index fc76a07..d097eaf 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/TestDefaultNameNodePort.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/TestDefaultNameNodePort.java
@@ -32,35 +32,37 @@ public class TestDefaultNameNodePort {
 
   @Test
   public void testGetAddressFromString() throws Exception {
-    assertEquals(DFSUtilClient.getNNAddress("foo").getPort(),
-                 HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT);
-    assertEquals(DFSUtilClient.getNNAddress("hdfs://foo/").getPort(),
-                 HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT);
-    assertEquals(DFSUtilClient.getNNAddress("hdfs://foo:555").getPort(),
-                 555);
-    assertEquals(DFSUtilClient.getNNAddress("foo:555").getPort(),
-                 555);
+    assertEquals(HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT,
+        DFSUtilClient.getNNAddress("foo").getPort());
+    assertEquals(HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT,
+        DFSUtilClient.getNNAddress("hdfs://foo/").getPort());
+    assertEquals(555,
+        DFSUtilClient.getNNAddress("hdfs://foo:555").getPort());
+    assertEquals(555,
+        DFSUtilClient.getNNAddress("foo:555").getPort());
   }
 
   @Test
   public void testGetAddressFromConf() throws Exception {
     Configuration conf = new HdfsConfiguration();
     FileSystem.setDefaultUri(conf, "hdfs://foo/");
-    assertEquals(DFSUtilClient.getNNAddress(conf).getPort(),
-        HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT);
+    assertEquals(HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT,
+        DFSUtilClient.getNNAddress(conf).getPort());
     FileSystem.setDefaultUri(conf, "hdfs://foo:555/");
-    assertEquals(DFSUtilClient.getNNAddress(conf).getPort(), 555);
+    assertEquals(555, DFSUtilClient.getNNAddress(conf).getPort());
     FileSystem.setDefaultUri(conf, "foo");
-    assertEquals(DFSUtilClient.getNNAddress(conf).getPort(),
-        HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT);
+    assertEquals(HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT,
+        DFSUtilClient.getNNAddress(conf).getPort());
+    FileSystem.setDefaultUri(conf, "foo:555");
+    assertEquals(555, DFSUtilClient.getNNAddress(conf).getPort());
   }
 
   @Test
   public void testGetUri() {
-    assertEquals(DFSUtilClient.getNNUri(new InetSocketAddress("foo", 555)),
-                 URI.create("hdfs://foo:555"));
-    assertEquals(DFSUtilClient.getNNUri(new InetSocketAddress("foo",
-            HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT)),
-        URI.create("hdfs://foo"));
+    assertEquals(URI.create("hdfs://foo:555"),
+        DFSUtilClient.getNNUri(new InetSocketAddress("foo", 555)));
+    assertEquals(URI.create("hdfs://foo"),
+        DFSUtilClient.getNNUri(new InetSocketAddress("foo",
+            HdfsClientConfigKeys.DFS_NAMENODE_RPC_PORT_DEFAULT)));
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org