use of org.opennms.netmgt.xml.event.Tticket in project opennms by OpenNMS.
the class EventUtilIT method testExpandTticketId.
@Test
public void testExpandTticketId() {
String testString = "%tticketid%";
String newString = eventUtil.expandParms(testString, m_nodeDownEvent);
assertEquals("", newString);
Tticket ticket = new Tticket();
ticket.setContent("777");
ticket.setState("1");
m_nodeDownEvent.setTticket(ticket);
newString = eventUtil.expandParms(testString, m_nodeDownEvent);
assertEquals("777", newString);
}
use of org.opennms.netmgt.xml.event.Tticket in project opennms by OpenNMS.
the class NotificationManager method getEvent.
/**
* In the absence of DAOs and ORMs this creates an Event object from the persisted
* record.
*
* @param eventid a int.
* @return a populated Event object
*/
public Event getEvent(final int eventid) {
// don't switch using event builder since this event is read from the database
final Event event = new Event();
Querier querier = new Querier(m_dataSource, "select * from events where eventid = ?", new RowProcessor() {
@Override
public void processRow(ResultSet rs) throws SQLException {
event.setDbid(rs.getInt("eventid"));
event.setUei(rs.getString("eventuei"));
event.setNodeid(rs.getLong("nodeid"));
event.setTime(rs.getDate("eventtime"));
event.setHost(rs.getString("eventhost"));
event.setInterface(rs.getString("ipaddr"));
event.setSnmphost(rs.getString("eventsnmphost"));
event.setService(getServiceName(rs.getInt("serviceid")));
event.setCreationTime(rs.getDate("eventcreatetime"));
event.setSeverity(rs.getString("eventseverity"));
event.setPathoutage(rs.getString("eventpathoutage"));
Tticket tticket = new Tticket();
tticket.setContent(rs.getString("eventtticket"));
tticket.setState(rs.getString("eventtticketstate"));
event.setTticket(tticket);
event.setSource(rs.getString("eventsource"));
}
private String getServiceName(int serviceid) {
SingleResultQuerier querier = new SingleResultQuerier(m_dataSource, "select servicename from service where serviceid = ?");
return (String) querier.getResult();
}
});
querier.execute(eventid);
return event;
}
use of org.opennms.netmgt.xml.event.Tticket in project opennms by OpenNMS.
the class NotifdIT method testAutoAcknowledge1.
@Test
public void testAutoAcknowledge1() throws Exception {
m_destinationPathManager.getPath("NoEscalate").setInitialDelay("2000ms");
MockNode node = m_network.getNode(1);
Event downEvent = node.createDownEvent();
Tticket tticket = new Tticket();
tticket.setContent("777");
tticket.setState("1");
downEvent.setTticket(tticket);
m_eventMgr.sendEventToListeners(downEvent);
sleep(1000);
Date date = new Date();
Event upEvent = node.createUpEvent(date);
long endTime = anticipateNotificationsForGroup("node 1 up.", "The node which was previously down is now up.", "UpGroup", date, 0);
m_eventMgr.sendEventToListeners(upEvent);
verifyAnticipated(endTime, 1000, 5000);
}
Aggregations