@Test
public void testFederationRefresh() throws Exception {

  Configuration conf = new Configuration();
  conf.set(DFSConfigKeys.DFS_NAMESERVICES,
      "ns1,ns2");
  addNN(conf, "ns1", "mock1:8020");
  addNN(conf, "ns2", "mock1:8020");
  bpm.refreshNamenodes(conf);
  assertEquals(
      "create #1\n" +
      "create #2\n", log.toString());
  log.setLength(0);
  // Remove the first NS
  conf.set(DFSConfigKeys.DFS_NAMESERVICES,
      "ns2");
  bpm.refreshNamenodes(conf);
  assertEquals(
      "stop #1\n" +
      "refresh #2\n", log.toString());
  log.setLength(0);
  
  // Add back an NS -- this creates a new BPOS since the old
  // one for ns2 should have been previously retired
  conf.set(DFSConfigKeys.DFS_NAMESERVICES,
      "ns1,ns2");
  bpm.refreshNamenodes(conf);
  assertEquals(
      "create #3\n" +
      "refresh #2\n", log.toString());
}