use of org.opennms.web.event.filter.EventCriteria in project opennms by OpenNMS.
the class DaoWebEventRepositoryIT method testFilterBySeverity.
@Test
@Transactional
public void testFilterBySeverity() {
NegativeSeverityFilter filter = new NegativeSeverityFilter(OnmsSeverity.NORMAL.getId());
EventCriteria criteria = new EventCriteria(filter);
Event[] events = m_daoEventRepo.getMatchingEvents(criteria);
assertTrue(events.length > 0);
EventCriteria sortedCriteria = new EventCriteria(new Filter[] { filter }, SortStyle.ID, AcknowledgeType.UNACKNOWLEDGED, 100, 0);
Event[] sortedEvents = m_daoEventRepo.getMatchingEvents(sortedCriteria);
assertTrue(sortedEvents.length > 0);
}
use of org.opennms.web.event.filter.EventCriteria in project opennms by OpenNMS.
the class DaoWebEventRepositoryIT method testCountMatchingBySeverity.
@Test
@Transactional
public void testCountMatchingBySeverity() {
int[] matchingEventCount = m_daoEventRepo.countMatchingEventsBySeverity(new EventCriteria(new SeverityFilter(3)));
assertNotNull(matchingEventCount);
assertEquals(8, matchingEventCount.length);
}
use of org.opennms.web.event.filter.EventCriteria in project opennms by OpenNMS.
the class DaoWebEventRepositoryIT method testAcknowledgeUnacknowledgeMatchingAlarms.
@Test
// Relies on specific IDs so we need a fresh database
@JUnitTemporaryDatabase
public void testAcknowledgeUnacknowledgeMatchingAlarms() {
m_daoEventRepo.acknowledgeMatchingEvents("TestUser", new Date(), new EventCriteria(new EventIdFilter(1)));
int matchingEventCount = m_daoEventRepo.countMatchingEvents(new EventCriteria(new AcknowledgedByFilter("TestUser")));
assertEquals(1, matchingEventCount);
m_daoEventRepo.unacknowledgeMatchingEvents(new EventCriteria(new AcknowledgedByFilter("TestUser")));
matchingEventCount = m_daoEventRepo.countMatchingEvents(new EventCriteria(new AcknowledgedByFilter("TestUser")));
assertEquals(0, matchingEventCount);
}
use of org.opennms.web.event.filter.EventCriteria in project opennms by OpenNMS.
the class DaoWebEventRepositoryIT method testAcknowledgeUnacknowledgeAllAlarms.
@Test
@Transactional
public void testAcknowledgeUnacknowledgeAllAlarms() {
m_daoEventRepo.acknowledgeAll("TestUser", new Date());
int matchingEventCount = m_daoEventRepo.countMatchingEvents(new EventCriteria(new AcknowledgedByFilter("TestUser")));
assertEquals(2, matchingEventCount);
m_daoEventRepo.unacknowledgeAll();
matchingEventCount = m_daoEventRepo.countMatchingEvents(new EventCriteria(new AcknowledgedByFilter("TestUser")));
assertEquals(0, matchingEventCount);
}
use of org.opennms.web.event.filter.EventCriteria in project opennms by OpenNMS.
the class DaoWebEventRepositoryIT method testCountMatchingEvents.
@Test
@Transactional
public void testCountMatchingEvents() {
EventCriteria criteria = new EventCriteria();
int event = m_daoEventRepo.countMatchingEvents(criteria);
assertEquals(2, event);
}
Aggregations