DFSAdmin extends FsShell { int startReconfiguration(final String nodeThpe, final String address) throws IOException { return startReconfiguration(nodeThpe, address, System.out, System.err); } DFSAdmin();  DFSAdmin(Configuration conf); void report(String[] argv, int i); void setSafeMode(String[] argv, int idx); int triggerBlockReport(String[] argv); void allowSnapshot(String[] argv); void disallowSnapshot(String[] argv); void provisionSnapshotTrash(String[] argv); int saveNamespace(String[] argv); int rollEdits(); int restoreFailedStorage(String arg); int refreshNodes(); int listOpenFiles(String[] argv); int setBalancerBandwidth(String[] argv, int idx); int getBalancerBandwidth(String[] argv, int idx); int fetchImage(final String[] argv, final int idx); int finalizeUpgrade(); int getUpgradeStatus(); int upgrade(String arg); int metaSave(String[] argv, int idx); int printTopology(); int refreshServiceAcl(); int refreshUserToGroupsMappings(); int refreshSuperUserGroupsConfiguration(); int refreshCallQueue(); int reconfig(String[] argv, int i); int genericRefresh(String[] argv, int i); @Override int run(String[] argv); static void main(String[] argv);  }
@Test(timeout = 30000) public void testNameNodeGetReconfigurationStatus() throws IOException, InterruptedException, TimeoutException { ReconfigurationUtil ru = mock(ReconfigurationUtil.class); namenode.setReconfigurationUtil(ru); final String address = namenode.getHostAndPort(); List<ReconfigurationUtil.PropertyChange> changes = new ArrayList<>(); changes.add(new ReconfigurationUtil.PropertyChange( DFS_HEARTBEAT_INTERVAL_KEY, String.valueOf(6), namenode.getConf().get(DFS_HEARTBEAT_INTERVAL_KEY))); changes.add(new ReconfigurationUtil.PropertyChange( "randomKey", "new123", "old456")); when(ru.parseChangedProperties(any(Configuration.class), any(Configuration.class))).thenReturn(changes); assertThat(admin.startReconfiguration("namenode", address), is(0)); final List<String> outs = Lists.newArrayList(); final List<String> errs = Lists.newArrayList(); awaitReconfigurationFinished("namenode", address, outs, errs); assertEquals( DFS_HEARTBEAT_INTERVAL_KEY + " has wrong value", 6, namenode .getConf() .getLong(DFS_HEARTBEAT_INTERVAL_KEY, DFS_HEARTBEAT_INTERVAL_DEFAULT)); assertEquals(DFS_HEARTBEAT_INTERVAL_KEY + " has wrong value", 6, namenode .getNamesystem() .getBlockManager() .getDatanodeManager() .getHeartbeatInterval()); int offset = 1; assertThat(outs.get(offset), containsString("SUCCESS: Changed property " + DFS_HEARTBEAT_INTERVAL_KEY)); assertThat(outs.get(offset + 1), is(allOf(containsString("From:"), containsString("3")))); assertThat(outs.get(offset + 2), is(allOf(containsString("To:"), containsString("6")))); }