use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventIpcManagerDefaultImplTest method testAddEventListenerTwoArgumentListNullUeiList.
public void testAddEventListenerTwoArgumentListNullUeiList() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("ueilist argument cannot be null"));
try {
m_manager.addEventListener(m_listener, (List<String>) null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class AlarmDaoIT method testWithoutDistPoller.
@Test
@Transactional
@Ignore
public void testWithoutDistPoller() {
OnmsEvent event = new OnmsEvent();
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setEventCreateTime(new Date());
event.setDistPoller(m_distPollerDao.whoami());
event.setEventTime(new Date());
event.setEventSeverity(OnmsSeverity.CRITICAL.getId());
event.setEventUei("uei://org/opennms/test/EventDaoTest");
event.setEventSource("test");
m_eventDao.save(event);
OnmsNode node = m_nodeDao.findAll().iterator().next();
OnmsAlarm alarm = new OnmsAlarm();
alarm.setNode(node);
alarm.setUei(event.getEventUei());
alarm.setSeverityId(event.getEventSeverity());
alarm.setFirstEventTime(event.getEventTime());
alarm.setLastEvent(event);
alarm.setCounter(1);
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new DataIntegrityViolationException("not-null property references a null or transient value: org.opennms.netmgt.model.OnmsAlarm.distPoller; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: org.opennms.netmgt.model.OnmsAlarm.distPoller"));
try {
m_alarmDao.save(alarm);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class AlarmdIT method testNullEvent.
@Test
public void testNullEvent() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("Incoming event was null, aborting"));
try {
m_alarmd.getPersister().persist(null, true);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class AlarmdIT method testNoDbid.
@Test
public void testNoDbid() throws Exception {
EventBuilder bldr = new EventBuilder("testNoDbid", "AlarmdTest");
bldr.setLogMessage(null);
bldr.setAlarmData(new AlarmData());
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("Incoming event has an illegal dbid (0), aborting"));
try {
m_alarmd.getPersister().persist(bldr.getEvent(), false);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class AlarmdIT method testNoLogmsg.
@Test
public void testNoLogmsg() throws Exception {
EventBuilder bldr = new EventBuilder("testNoLogmsg", "AlarmdTest");
bldr.setAlarmData(new AlarmData());
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("Incoming event has an illegal dbid (0), aborting"));
try {
m_alarmd.getPersister().persist(bldr.getEvent(), false);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
Aggregations