NamenodeJspHelper { static String getRollingUpgradeText(FSNamesystem fsn) { if (fsn == null) { return ""; } DatanodeManager dm = fsn.getBlockManager().getDatanodeManager(); Map<String, Integer> list = dm.getDatanodesSoftwareVersions(); if(list.size() > 1) { StringBuffer status = new StringBuffer("Rolling upgrades in progress. " + "There are " + list.size() + " versions of datanodes currently live: "); for(Map.Entry<String, Integer> ver: list.entrySet()) { status.append(ver.getKey() + "(" + ver.getValue() + "), "); } return status.substring(0, status.length()-2); } return ""; }    }
@Test public void testGetRollingUpgradeText() { Assert.assertEquals("", NamenodeJspHelper.getRollingUpgradeText(null)); }