NamenodeJspHelper { static String getVersionTable(FSNamesystem fsn) { StringBuilder sb = new StringBuilder(); sb.append("<div class='dfstable'><table>"); if (fsn != null) { sb.append("\n <tr><td class='col1'>Started:</td><td>" + fsn.getStartTime()); } sb.append("</td></tr>\n" + "\n <tr><td class='col1'>Version:</td><td>"); sb.append(VersionInfo.getVersion() + ", " + VersionInfo.getRevision()); sb.append("</td></tr>\n" + "\n <tr><td class='col1'>Compiled:</td><td>" + VersionInfo.getDate()); sb.append(" by " + VersionInfo.getUser() + " from " + VersionInfo.getBranch()); if (fsn != null) { sb.append("</td></tr>\n <tr><td class='col1'>Cluster ID:</td><td>" + fsn.getClusterId()); sb.append("</td></tr>\n <tr><td class='col1'>Block Pool ID:</td><td>" + fsn.getBlockPoolId()); } sb.append("</td></tr>\n</table></div>"); return sb.toString(); }    }
@Test(timeout = 15000) public void testGetVersionTable() { NameNode nameNode = cluster.getNameNode(); FSNamesystem fsn = nameNode.getNamesystem(); ImmutableSet<String> patterns = ImmutableSet.of(VersionInfo.getVersion(), VersionInfo.getRevision(), VersionInfo.getUser(), VersionInfo.getBranch(), fsn.getClusterId(), fsn.getBlockPoolId()); String line = NamenodeJspHelper.getVersionTable(fsn); for(String pattern: patterns) { assertTrue("testGetVersionTable error " + pattern, line.contains(pattern)); } }