@@ -555,10 +555,10 @@ public void testHANameNodesWithFederation() throws URISyntaxException {
555555 assertTrue (HAUtil .isHAEnabled (conf , "ns2" ));
556556 assertFalse (HAUtil .isHAEnabled (conf , "ns3" ));
557557
558- assertInetSocketAddress ( NS1_NN1_HOST , map .get ("ns1" ).get ("ns1-nn1" ));
559- assertInetSocketAddress ( NS1_NN2_HOST , map .get ("ns1" ).get ("ns1-nn2" ));
560- assertInetSocketAddress ( NS2_NN1_HOST , map .get ("ns2" ).get ("ns2-nn1" ));
561- assertInetSocketAddress ( NS2_NN2_HOST , map .get ("ns2" ).get ("ns2-nn2" ));
558+ assertEquals ( resolvedName ( NS1_NN1_HOST ) , map .get ("ns1" ).get ("ns1-nn1" ). toString ( ));
559+ assertEquals ( resolvedName ( NS1_NN2_HOST ) , map .get ("ns1" ).get ("ns1-nn2" ). toString ( ));
560+ assertEquals ( resolvedName ( NS2_NN1_HOST ) , map .get ("ns2" ).get ("ns2-nn1" ). toString ( ));
561+ assertEquals ( resolvedName ( NS2_NN2_HOST ) , map .get ("ns2" ).get ("ns2-nn2" ). toString ( ));
562562
563563 assertEquals (NS1_NN1_HOST ,
564564 DFSUtil .getNamenodeServiceAddr (conf , "ns1" , "ns1-nn1" ));
@@ -626,25 +626,16 @@ public void getNameNodeServiceAddr() throws IOException {
626626 }
627627
628628 @ Test
629- public void testGetHaNnHttpAddresses () {
629+ public void testGetHaNnHttpAddresses () throws IOException {
630630 final String LOGICAL_HOST_NAME = "ns1" ;
631631
632632 Configuration conf = createWebHDFSHAConfiguration (LOGICAL_HOST_NAME , NS1_NN1_ADDR , NS1_NN2_ADDR );
633633
634634 Map <String , Map <String , InetSocketAddress >> map =
635635 DFSUtilClient .getHaNnWebHdfsAddresses (conf , "webhdfs" );
636636
637- assertInetSocketAddress (NS1_NN1_ADDR , map .get ("ns1" ).get ("nn1" ));
638- assertInetSocketAddress (NS1_NN2_ADDR , map .get ("ns1" ).get ("nn2" ));
639- }
640-
641- static void assertInetSocketAddress (String expected , InetSocketAddress computed ) {
642- final int i = expected .indexOf (':' );
643- final String host = expected .substring (0 , i );
644- final int port = Integer .parseInt (expected .substring (i + 1 ));
645- assertEquals (host , computed .getHostName ());
646- assertEquals (port , computed .getPort ());
647- assertEquals (InetSocketAddress .createUnresolved (host , port ), computed );
637+ assertEquals (resolvedName (NS1_NN1_ADDR ), map .get ("ns1" ).get ("nn1" ).toString ());
638+ assertEquals (resolvedName (NS1_NN2_ADDR ), map .get ("ns1" ).get ("nn2" ).toString ());
648639 }
649640
650641 private static Configuration createWebHDFSHAConfiguration (String logicalHostName , String nnaddr1 , String nnaddr2 ) {
@@ -965,7 +956,7 @@ public void testAssertAllResultsEqual() {
965956 checkAllResults (new Long []{1l }, true );
966957 checkAllResults (new Long []{1l , 1l }, true );
967958 checkAllResults (new Long []{1l , 1l , 1l }, true );
968- checkAllResults (new Long []{1L , 1L }, true );
959+ checkAllResults (new Long []{new Long ( 1 ), new Long ( 1 ) }, true );
969960 checkAllResults (new Long []{null , null , null }, true );
970961
971962 checkAllResults (new Long []{1l , 2l }, false );
0 commit comments