@Test public void testCreateMetadata() { BgpSessionStatusQuestion q = new BgpSessionStatusQuestion(); TableMetadata metadata = createMetadata(q); assertThat( metadata.getTextDesc(), equalTo("On ${Node} session ${VRF}:${Remote_IP} has status ${Established_Status}.")); assertThat(metadata.getColumnMetadata(), equalTo(COLUMN_METADATA)); q.setDisplayHints(new DisplayHints(null, null, "display hints")); metadata = createMetadata(q); assertThat(metadata.getTextDesc(), equalTo("display hints")); assertThat(metadata.getColumnMetadata(), equalTo(COLUMN_METADATA)); }
@VisibleForTesting static TableMetadata createMetadata(Question question) { String textDesc = String.format( "On ${%s} session ${%s}:${%s} has status ${%s}.", COL_NODE, COL_VRF, COL_REMOTE_IP, COL_ESTABLISHED_STATUS); DisplayHints dhints = question.getDisplayHints(); if (dhints != null && dhints.getTextDesc() != null) { textDesc = dhints.getTextDesc(); } return new TableMetadata(COLUMN_METADATA, textDesc); }
BgpSessionStatusAnswerer extends Answerer { @VisibleForTesting static TableMetadata createMetadata(Question question) { String textDesc = String.format( "On ${%s} session ${%s}:${%s} has status ${%s}.", COL_NODE, COL_VRF, COL_REMOTE_IP, COL_ESTABLISHED_STATUS); DisplayHints dhints = question.getDisplayHints(); if (dhints != null && dhints.getTextDesc() != null) { textDesc = dhints.getTextDesc(); } return new TableMetadata(COLUMN_METADATA, textDesc); } }
BgpSessionStatusAnswerer extends Answerer { @VisibleForTesting static TableMetadata createMetadata(Question question) { String textDesc = String.format( "On ${%s} session ${%s}:${%s} has status ${%s}.", COL_NODE, COL_VRF, COL_REMOTE_IP, COL_ESTABLISHED_STATUS); DisplayHints dhints = question.getDisplayHints(); if (dhints != null && dhints.getTextDesc() != null) { textDesc = dhints.getTextDesc(); } return new TableMetadata(COLUMN_METADATA, textDesc); } BgpSessionStatusAnswerer(Question question, IBatfish batfish); }
BgpSessionStatusAnswerer extends Answerer { @VisibleForTesting static TableMetadata createMetadata(Question question) { String textDesc = String.format( "On ${%s} session ${%s}:${%s} has status ${%s}.", COL_NODE, COL_VRF, COL_REMOTE_IP, COL_ESTABLISHED_STATUS); DisplayHints dhints = question.getDisplayHints(); if (dhints != null && dhints.getTextDesc() != null) { textDesc = dhints.getTextDesc(); } return new TableMetadata(COLUMN_METADATA, textDesc); } BgpSessionStatusAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot); }
BgpSessionStatusAnswerer extends Answerer { @VisibleForTesting static TableMetadata createMetadata(Question question) { String textDesc = String.format( "On ${%s} session ${%s}:${%s} has status ${%s}.", COL_NODE, COL_VRF, COL_REMOTE_IP, COL_ESTABLISHED_STATUS); DisplayHints dhints = question.getDisplayHints(); if (dhints != null && dhints.getTextDesc() != null) { textDesc = dhints.getTextDesc(); } return new TableMetadata(COLUMN_METADATA, textDesc); } BgpSessionStatusAnswerer(Question question, IBatfish batfish); @Override AnswerElement answer(NetworkSnapshot snapshot);  }