use of org.opennms.netmgt.model.OnmsAlarm 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.netmgt.model.OnmsAlarm in project opennms by OpenNMS.
the class AlarmRepositoryFilterIT method testBeforeFirstEventTimeFilter.
@Test
@Transactional
@JUnitTemporaryDatabase
public void testBeforeFirstEventTimeFilter() {
OnmsAlarm[] alarms = m_daoAlarmRepo.getMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new BeforeFirstEventTimeFilter(new Date()))));
assertEquals(1, alarms.length);
alarms = m_daoAlarmRepo.getMatchingAlarms(AlarmUtil.getOnmsCriteria(new AlarmCriteria(new BeforeLastEventTimeFilter(new Date()))));
assertEquals(1, alarms.length);
}
use of org.opennms.netmgt.model.OnmsAlarm in project opennms by OpenNMS.
the class AlarmRepositoryIT method testSortAndSearchBySameProperty.
@Test
@Transactional
@JUnitTemporaryDatabase
public void testSortAndSearchBySameProperty() {
Filter[] filters = new Filter[] { new NodeNameLikeFilter("node") };
AlarmCriteria sorted = new AlarmCriteria(filters, SortStyle.NODE, AcknowledgeType.UNACKNOWLEDGED, 100, 0);
OnmsAlarm[] alarms = m_alarmRepo.getMatchingAlarms(AlarmUtil.getOnmsCriteria(sorted));
assertTrue("Failed to sort with style " + SortStyle.NODE, alarms.length > 0);
}
use of org.opennms.netmgt.model.OnmsAlarm 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.netmgt.model.OnmsAlarm in project opennms by OpenNMS.
the class TestUtils method createAlarm.
public static OnmsAlarm createAlarm(OnmsNode node, OnmsSeverity severity, OnmsDistPoller distpoller) {
OnmsAlarm alarm = new OnmsAlarm();
alarm.setUei(EventConstants.NODE_DOWN_EVENT_UEI);
alarm.setDistPoller(distpoller);
alarm.setCounter(1);
alarm.setSeverity(severity);
alarm.setNode(node);
return alarm;
}
Aggregations