@Test
public void testParseMultipleNameNodes() throws Exception {

  // start with an empty configuration
  Configuration conf = new Configuration(false);
  // add in keys for each of the NNs
  String nameservice = "ns1";
  MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new MiniDFSNNTopology.NSConf(nameservice)
          .addNN(new MiniDFSNNTopology.NNConf("nn1").setIpcPort(10001))
          .addNN(new MiniDFSNNTopology.NNConf("nn2").setIpcPort(10002))
          .addNN(new MiniDFSNNTopology.NNConf("nn3").setIpcPort(10003)));
  // add the configurations of the NNs to the passed conf, so we can parse it back out
  MiniDFSCluster.configureNameNodes(topology, false, conf);
  // set the 'local' one as nn1
  conf.set(DFSConfigKeys.DFS_HA_NAMENODE_ID_KEY, "nn1");
  List<RemoteNameNodeInfo> nns = RemoteNameNodeInfo.getRemoteNameNodes(conf);
  // make sure it matches when we pass in the nameservice
  List<RemoteNameNodeInfo> nns2 = RemoteNameNodeInfo.getRemoteNameNodes(conf,
      nameservice);
  assertEquals(nns, nns2);
}