use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.SimpleNodeMarker in project opennms by OpenNMS.
the class MarkerFilterImplTest method testSubstringMatch.
@Test
public void testSubstringMatch() {
final MarkerFilterImpl filter = new WrappedMarkerFilterImpl("blah", AlarmSeverity.NORMAL, m_eventManager, m_componentTracker);
final SimpleNodeMarker marker = new SimpleNodeMarker();
marker.setNodeLabel("this has the string blah in it");
assertTrue(filter.matches(marker));
marker.setNodeLabel("bla");
assertFalse(filter.matches(marker));
marker.setNodeLabel("blah");
assertTrue(filter.matches(marker));
filter.setSearchString("nodeLabel: blah");
marker.setNodeLabel("this has the string blah in it");
assertTrue(filter.matches(marker));
marker.setNodeLabel("bla");
assertFalse(filter.matches(marker));
marker.setNodeLabel("blah");
assertTrue(filter.matches(marker));
// now try categories
filter.setSearchString("blah");
marker.setNodeLabel("notMatching");
marker.addCategory("bla");
assertFalse(filter.matches(marker));
marker.addCategory("blah");
assertTrue(filter.matches(marker));
marker.setCategoryList(new ArrayList<String>());
assertFalse(filter.matches(marker));
marker.addCategory("this has the string 'blah' in it too!");
assertTrue(filter.matches(marker));
filter.setSearchString("category: blah");
marker.setNodeLabel("notMatching");
marker.setCategoryList(new ArrayList<String>());
marker.addCategory("bla");
assertFalse(marker.getCategoryList() + " should contain blah", filter.matches(marker));
marker.addCategory("blah");
assertTrue(filter.matches(marker));
marker.setCategoryList(new ArrayList<String>());
assertFalse(filter.matches(marker));
marker.addCategory("this has the string 'blah' in it too!");
assertTrue(filter.matches(marker));
marker.setForeignSource("sanJose");
filter.setSearchString("foreignSource:sanJose");
assertTrue(filter.matches(marker));
}
use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.SimpleNodeMarker in project opennms by OpenNMS.
the class MarkerFilterImplTest method testExactMatch.
@Test
public void testExactMatch() {
final MarkerFilterImpl filter = new WrappedMarkerFilterImpl("nodeLabel=blah", AlarmSeverity.NORMAL, m_eventManager, m_componentTracker);
final SimpleNodeMarker marker = new SimpleNodeMarker();
marker.setNodeLabel("blah");
assertTrue(filter.matches(marker));
marker.setNodeLabel("ablah");
assertFalse(filter.matches(marker));
filter.setSearchString("category=blah");
marker.setNodeLabel(null);
marker.addCategory("ablah");
assertFalse(filter.matches(marker));
marker.addCategory("blah");
assertTrue(filter.matches(marker));
marker.setForeignSource("sanJose");
filter.setSearchString("foreignSource=sanJose");
assertTrue(filter.matches(marker));
}
use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.SimpleNodeMarker in project opennms by OpenNMS.
the class MarkerFilterImplTest method testEmptySearch.
@Test
public void testEmptySearch() {
// empty searches should always match
final WrappedMarkerFilterImpl filter = new WrappedMarkerFilterImpl(null, AlarmSeverity.NORMAL, m_eventManager, m_componentTracker);
final NodeMarker marker = new SimpleNodeMarker();
assertTrue(filter.matches(marker));
filter.setSearchString("");
assertTrue(filter.matches(marker));
assertEquals(1, filter.getFilterUpdatedCalls());
}
use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.SimpleNodeMarker in project opennms by OpenNMS.
the class MarkerFilterImplTest method testInMatch.
@Test
public void testInMatch() {
final MarkerFilterImpl filter = new WrappedMarkerFilterImpl("nodeLabel in foo, bar, baz", AlarmSeverity.NORMAL, m_eventManager, m_componentTracker);
final SimpleNodeMarker marker = new SimpleNodeMarker();
marker.setNodeLabel("fo");
assertFalse(filter.matches(marker));
marker.setNodeLabel("foo");
assertTrue(filter.matches(marker));
marker.setNodeLabel("bara");
assertFalse(filter.matches(marker));
marker.setNodeLabel("baz");
assertTrue(filter.matches(marker));
filter.setSearchString("nodeLabel in (foo, bar, baz)");
marker.setNodeLabel("fo");
assertFalse(filter.matches(marker));
marker.setNodeLabel("foo");
assertTrue(filter.matches(marker));
marker.setNodeLabel("bara");
assertFalse(filter.matches(marker));
marker.setNodeLabel("baz");
assertTrue(filter.matches(marker));
filter.setSearchString("category in foo, bar, baz");
marker.setNodeLabel(null);
marker.setCategoryList(new ArrayList<String>());
marker.addCategory("ba");
assertFalse(filter.matches(marker));
marker.addCategory("bar");
assertTrue(filter.matches(marker));
marker.setCategoryList(new ArrayList<String>());
marker.addCategory("baz");
assertTrue(filter.matches(marker));
filter.setSearchString("categories in foo, bar, baz");
marker.setNodeLabel(null);
marker.setCategoryList(new ArrayList<String>());
marker.addCategory("ba");
assertFalse(filter.matches(marker));
marker.addCategory("bar");
assertTrue(filter.matches(marker));
marker.setCategoryList(new ArrayList<String>());
marker.addCategory("baz");
assertTrue(filter.matches(marker));
}
Aggregations