@Test public void resolveNodeTest() { SpecifiersQuestion question = new SpecifiersQuestion(QueryType.NODE); question.setNodeSpecifierInput(_c1.getHostname()); // only c1 should be present assertThat( resolveNode(question, _context).getRows().getData(), equalTo(ImmutableMultiset.of(Row.of(COL_NODE, new Node(_c1.getHostname()))))); } }
@Test public void resolveFilterTest() { SpecifiersQuestion question = new SpecifiersQuestion(QueryType.FILTER); question.setFilterSpecifierInput(_filter1.getName()); // only filter1 should be present (with a node specifier all nodes are included) assertThat( resolveFilter(question, _context).getRows().getData(), equalTo( ImmutableMultiset.of( Row.of( COL_NODE, new Node(_c1.getHostname()), COL_FILTER_NAME, _filter1.getName())))); // nothing should match since the node specifier does not match anything question.setNodeSpecifierInput("foofoo"); assertThat( resolveFilter(question, _context).getRows().getData(), equalTo(ImmutableMultiset.of())); }
@Test public void resolveInterfaceTest() { SpecifiersQuestion question = new SpecifiersQuestion(QueryType.INTERFACE); question.setInterfaceSpecifierInput(_iface1.getName()); // only iface1 should be present (with a node specifier all nodes are included) assertThat( resolveInterface(question, _context).getRows().getData(), equalTo( ImmutableMultiset.of( Row.of( COL_INTERFACE, new NodeInterfacePair(_c1.getHostname(), _iface1.getName()))))); // nothing should match since the node specifier does not match anything question.setNodeSpecifierInput("foofoo"); assertThat( resolveInterface(question, _context).getRows().getData(), equalTo(ImmutableMultiset.of())); }