[ 
https://issues.apache.org/jira/browse/HDFS-14887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16951345#comment-16951345
 ] 

Íñigo Goiri commented on HDFS-14887:
------------------------------------

Thanks [~hemanthboyina], TestMetricsBase makes much more sense.
For making it easier to read, I would create a function like:
{code}
public static Map<String, String> getNameserviceStateMap(JSONObject jsonObject) 
{
  Map<String, String> map = new TreeMap<>();
  Iterator<?> keys = jsonObject.keys();
  while (keys.hasNext()) {
    String key = (String) keys.next();
    JSONObject json = jsonObject.getJSONObject(key);
    String nsId = json.getString("nameserviceId");
    String state = json.getString("state");
    map.put(nsId, state);
  }
  return map;
}
{code}

Then you can do a much more readable assert like:
{code}
assertTrue("Cannot find ns0 in map: " + map, map.containsKey("ns0"));
assertEquals("OBSERVER", map.get("ns0"));
{code}



> RBF: In Router Web UI, Observer Namenode Information displaying as Unavailable
> ------------------------------------------------------------------------------
>
>                 Key: HDFS-14887
>                 URL: https://issues.apache.org/jira/browse/HDFS-14887
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: hemanthboyina
>            Assignee: hemanthboyina
>            Priority: Major
>         Attachments: 14887.after.png, 14887.before.png, HDFS-14887.001.patch, 
> HDFS-14887.002.patch, HDFS-14887.003.patch, HDFS-14887.004.patch, 
> HDFS-14887.005.patch, HDFS-14887.006.patch
>
>
> In Router Web UI, Observer Namenode Information displaying as Unavailable.
> We should show a proper icon for them.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to