conf.set(FSConstants.DFS_FEDERATION_NAMESERVICES, nameserviceIdList);
}
@Test
public void testRefreshNamenodes() throws Exception {
MiniAvatarCluster cluster = null;
try {
cluster = new MiniAvatarCluster(conf, 1, true, null, null, 1, true);
DataNode dn = cluster.getDataNodes().get(0);
assertEquals(dn.getAllNamespaceServices().length, 1);
cluster.addNameNode(conf);
assertEquals(dn.getAllNamespaceServices().length, 2);
cluster.addNameNode(conf);
assertEquals(dn.getAllNamespaceServices().length, 3);
cluster.addNameNode(conf);
assertEquals(dn.getAllNamespaceServices().length, 4);
int[] nns = null;
nns = new int[]{0, 1, 2, 3};
compareAddress(cluster, dn, nns);
nns = new int[]{0, 1};
Configuration conf1 = new Configuration(conf);
setupAddress(conf1, new int[]{0, 1});
dn.refreshNamenodes(conf1);
waitDataNodeInitialized(dn);
compareAddress(cluster, dn, nns);
nns = new int[]{0,2,3};
Configuration conf2 = new Configuration(conf);
setupAddress(conf2, new int[]{0,2,3});
dn.refreshNamenodes(conf2);
waitDataNodeInitialized(dn);
compareAddress(cluster, dn, nns);
} finally {
cluster.shutDown();
}
}