use of org.opennms.web.alarm.filter.AlarmIdFilter in project opennms by OpenNMS.
the class AlarmRepositoryIT method testEscalateAlarms.
@Test
@JUnitTemporaryDatabase
public void testEscalateAlarms() {
int[] alarmIds = { 1 };
m_alarmRepo.escalateAlarms(alarmIds, "TestUser", new Date());
OnmsAlarm[] alarms = m_alarmRepo.getMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new AlarmIdFilter(1))));
assertNotNull(alarms);
assertEquals(OnmsSeverity.WARNING.getId(), alarms[0].getSeverity().getId());
}
use of org.opennms.web.alarm.filter.AlarmIdFilter in project opennms by OpenNMS.
the class AlarmRepositoryIT method testAcknowledgeUnacknowledge.
@Test
@JUnitTemporaryDatabase
public void testAcknowledgeUnacknowledge() {
String user = "TestUser";
m_alarmRepo.acknowledgeMatchingAlarms(user, new Date(), AlarmUtil.getOnmsCriteria(new AlarmCriteria(new AlarmIdFilter(1))));
int matchingAlarmCount = m_alarmRepo.countMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new AcknowledgedByFilter(user))));
assertEquals(1, matchingAlarmCount);
m_alarmRepo.unacknowledgeMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new AlarmIdFilter(1))), user);
matchingAlarmCount = m_alarmRepo.countMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new AcknowledgedByFilter(user))));
assertEquals(0, matchingAlarmCount);
}
use of org.opennms.web.alarm.filter.AlarmIdFilter in project opennms by OpenNMS.
the class AlarmRepositoryIT method testGetMatchingAlarms.
@Test
@JUnitTemporaryDatabase
public void testGetMatchingAlarms() {
OnmsAlarm[] alarms = m_alarmRepo.getMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new SeverityFilter(OnmsSeverity.NORMAL), new AlarmIdFilter(1))));
assertNotNull(alarms);
assertEquals(1, alarms.length);
alarms = m_alarmRepo.getMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new SeverityFilter(OnmsSeverity.MAJOR))));
assertNotNull(alarms);
assertEquals(0, alarms.length);
}
use of org.opennms.web.alarm.filter.AlarmIdFilter in project opennms by OpenNMS.
the class WebEventRepositoryFilterIT method testAlarmIdFilter.
@Test
// Relies on specific IDs so we need a fresh database
@JUnitTemporaryDatabase
public void testAlarmIdFilter() {
AlarmIdFilter filter = new AlarmIdFilter(1);
Event[] events = getMatchingDaoEvents(filter);
assertEquals(1, events.length);
}
use of org.opennms.web.alarm.filter.AlarmIdFilter in project opennms by OpenNMS.
the class AlarmRepositoryIT method testCountMatchingAlarms.
@Test
@JUnitTemporaryDatabase
public void testCountMatchingAlarms() {
int alarms = m_alarmRepo.countMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new AlarmIdFilter(1))));
assertEquals(1, alarms);
alarms = m_alarmRepo.countMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new AlarmIdFilter(2))));
assertEquals(0, alarms);
}
Aggregations