本文整理汇总了Java中org.opennms.netmgt.model.OnmsEvent.setEventCreateTime方法的典型用法代码示例。如果您正苦于以下问题:Java OnmsEvent.setEventCreateTime方法的具体用法?Java OnmsEvent.setEventCreateTime怎么用?Java OnmsEvent.setEventCreateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opennms.netmgt.model.OnmsEvent
的用法示例。
在下文中一共展示了OnmsEvent.setEventCreateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createOutageForService
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
protected void createOutageForService(OnmsMonitoredService monSvc) {
OnmsEvent outageEvent = new OnmsEvent();
outageEvent.setEventUei("TEST_UEI");
outageEvent.setDistPoller(monSvc.getIpInterface().getNode().getDistPoller());
outageEvent.setEventTime(new Date());
outageEvent.setEventSource("Me");
outageEvent.setEventCreateTime(new Date());
outageEvent.setEventSeverity(0);
outageEvent.setEventLog("L");
outageEvent.setEventDisplay("D");
m_eventDao.save(outageEvent);
m_eventDao.flush();
OnmsOutage outage = new OnmsOutage(new Date(), outageEvent, monSvc);
m_outageDao.save(outage);
m_outageDao.flush();
}
示例2: testEventsForNodeId
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Test
public void testEventsForNodeId() throws Exception {
OnmsNode node = new OnmsNode();
node.setId(1);
OnmsEvent event = new OnmsEvent();
event.setDistPoller(m_distPollerDao.get("localhost"));
event.setEventUei("uei.opennms.org/test");
event.setEventTime(new Date());
event.setEventSource("test");
event.setEventCreateTime(new Date());
event.setEventSeverity(1);
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setNode(node);
m_eventDao.save(event);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("limit", "50");
parameters.put("node.id", "1");
String xml = sendRequest(GET, "/events", parameters, 200);
assertTrue(xml.contains("totalCount=\"1\""));
assertTrue(xml.contains("uei.opennms.org/test"));
}
示例3: setUp
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Before
public void setUp(){
m_dbPopulator.populateDatabase();
OnmsEvent event = new OnmsEvent();
event.setDistPoller(getDistPoller("localhost", "127.0.0.1"));
event.setAlarm(m_dbPopulator.getAlarmDao().get(1));
event.setNode(m_dbPopulator.getNode1());
event.setEventUei("uei.opennms.org/test2");
event.setEventTime(new Date());
event.setEventSource("test");
event.setEventCreateTime(new Date());
event.setEventSeverity(OnmsSeverity.CLEARED.getId());
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setIfIndex(11);
event.setIpAddr(InetAddressUtils.getInetAddress("192.168.1.1"));
event.setEventLogMsg("This is a test log message");
event.setEventDescr("This is a test event");
event.setServiceType(m_dbPopulator.getServiceTypeDao().get(1));
m_dbPopulator.getEventDao().save(event);
m_dbPopulator.getEventDao().flush();
}
示例4: testEventsForNodeId
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Test
public void testEventsForNodeId() throws Exception {
OnmsNode node = new OnmsNode();
node.setId(1);
OnmsEvent event = new OnmsEvent();
event.setDistPoller(m_distPollerDao.get("localhost"));
event.setEventUei("uei.opennms.org/test");
event.setEventTime(new Date());
event.setEventSource("test");
event.setEventCreateTime(new Date());
event.setEventSeverity(1);
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setNode(node);
m_eventDao.save(event);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("limit", "50");
parameters.put("node.id", "1");
String xml = sendRequest(GET, "/events", parameters, 200);
assertTrue(xml.contains("totalCount=\"1\""));
assertTrue(xml.contains("uei.opennms.org/test"));
}
示例5: testWithoutDistPoller
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Test
@Transactional
public void testWithoutDistPoller() {
OnmsEvent event = new OnmsEvent();
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setEventCreateTime(new Date());
event.setDistPoller(m_distPollerDao.load("localhost"));
event.setEventTime(new Date());
event.setEventSeverity(new Integer(7));
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();
}
示例6: testAlarmSummary
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Test
@Transactional
public void testAlarmSummary() {
OnmsEvent event = new OnmsEvent();
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setEventCreateTime(new Date());
event.setDistPoller(m_distPollerDao.load("localhost"));
event.setEventTime(new Date());
event.setEventSeverity(new Integer(7));
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);
alarm.setDistPoller(m_distPollerDao.load("localhost"));
m_alarmDao.save(alarm);
List<AlarmSummary> summary = m_alarmDao.getNodeAlarmSummaries();
Assert.assertNotNull(summary);
Assert.assertEquals(1, summary.size());
AlarmSummary sum = summary.get(0);
Assert.assertEquals(node.getLabel(), sum.getNodeLabel());
Assert.assertEquals(alarm.getSeverity().getId(), sum.getMaxSeverity().getId());
Assert.assertNotSame("N/A", sum.getFuzzyTimeDown());
}
示例7: getEvent
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
private OnmsEvent getEvent() {
OnmsEvent event = new OnmsEvent();
event.setDistPoller(getLocalHostDistPoller());
event.setEventUei("foo!");
event.setEventTime(new Date());
event.setEventCreateTime(new Date());
event.setEventSeverity(1);
event.setEventSource("your mom");
event.setEventLog("Y");
event.setEventDisplay("Y");
m_eventDao.save(event);
return event;
}
示例8: testSave
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Test
@Transactional
public void testSave() {
OnmsEvent event = new OnmsEvent();
event.setDistPoller(m_distPollerDao.load("localhost"));
event.setEventCreateTime(new Date());
event.setEventDescr("event dao test");
event.setEventHost("localhost");
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setEventLogGroup("event dao test log group");
event.setEventLogMsg("event dao test log msg");
event.setEventSeverity(7);
event.setEventSource("EventDaoTest");
event.setEventTime(new Date());
event.setEventUei("uei://org/opennms/test/EventDaoTest");
OnmsNode node = (OnmsNode) m_nodeDao.findAll().iterator().next();
OnmsIpInterface iface = (OnmsIpInterface)node.getIpInterfaces().iterator().next();
OnmsMonitoredService service = (OnmsMonitoredService)iface.getMonitoredServices().iterator().next();
event.setNode(node);
event.setServiceType(service.getServiceType());
OnmsAlarm alarm = new OnmsAlarm();
event.setAlarm(alarm);
event.setIpAddr(iface.getIpAddress());
m_eventDao.save(event);
OnmsEvent newEvent = m_eventDao.load(event.getId());
assertEquals("uei://org/opennms/test/EventDaoTest", newEvent.getEventUei());
assertNotNull(newEvent.getServiceType());
assertEquals(service.getNodeId(), newEvent.getNode().getId());
assertEquals(event.getIpAddr(), newEvent.getIpAddr());
}
示例9: testNotificationSave
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Test
@Transactional
public void testNotificationSave() {
OnmsEvent event = new OnmsEvent();
event.setDistPoller(m_distPollerDao.load("localhost"));
event.setEventCreateTime(new Date());
event.setEventDescr("event dao test");
event.setEventHost("localhost");
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setEventLogGroup("event dao test log group");
event.setEventLogMsg("event dao test log msg");
event.setEventSeverity(7);
event.setEventSource("EventDaoTest");
event.setEventTime(new Date());
event.setEventUei("uei://org/opennms/test/NotificationDaoTest");
// OnmsAlarm alarm = new OnmsAlarm();
// event.setAlarm(alarm);
OnmsNode node = m_nodeDao.findAll().iterator().next();
OnmsIpInterface iface = node.getIpInterfaces().iterator().next();
OnmsMonitoredService service = iface.getMonitoredServices().iterator().next();
event.setNode(node);
event.setServiceType(service.getServiceType());
event.setIpAddr(iface.getIpAddress());
m_eventDao.save(event);
OnmsEvent newEvent = m_eventDao.load(event.getId());
assertEquals("uei://org/opennms/test/NotificationDaoTest", newEvent.getEventUei());
OnmsNotification notification = new OnmsNotification();
notification.setEvent(newEvent);
notification.setTextMsg("Tests are fun!");
m_notificationDao.save(notification);
OnmsNotification newNotification = m_notificationDao.load(notification.getNotifyId());
assertEquals("uei://org/opennms/test/NotificationDaoTest", newNotification.getEvent().getEventUei());
}
示例10: getEvent
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
private OnmsEvent getEvent(OnmsNode node) {
OnmsEvent event = new OnmsEvent();
event.setDistPoller(node.getDistPoller());
event.setEventUei(EventConstants.NODE_DOWN_EVENT_UEI);
event.setEventTime(new Date());
event.setEventSource("test");
event.setEventCreateTime(new Date());
event.setEventSeverity(1);
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setNode(node);
m_eventDao.save(event);
m_eventDao.flush();
return event;
}
示例11: createEvent
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
protected OnmsEvent createEvent() {
final Calendar c = new GregorianCalendar();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
long time = c.getTimeInMillis();
time = (time - (time % 1000));
final Date date = new Date(time + (count * 60 * 60 * 1000));
final OnmsEvent event = new OnmsEvent();
event.setDistPoller(getDistPollerDao().load("localhost"));
event.setEventUei("uei.opennms.org/test/" + count);
event.setEventCreateTime(date);
event.setEventTime(date);
event.setEventDescr("Test event " + count);
event.setEventDisplay("Y");
event.setEventLog("Y");
event.setEventHost("es-with-the-most-es");
event.setEventLogMsg("Test event " + count + " (log)");
event.setEventSeverity(OnmsSeverity.MAJOR.getId());
event.setEventSource("AlarmStatsRestServiceTest");
event.setNode(m_databasePopulator.getNode1());
getEventDao().save(event);
getEventDao().flush();
count++;
return event;
}
示例12: setUp
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Before
public void setUp(){
m_dbPopulator.populateDatabase();
OnmsEvent event = new OnmsEvent();
event.setDistPoller(getDistPoller("localhost", "127.0.0.1"));
event.setEventUei("uei.opennms.org/test2");
event.setEventTime(new Date());
event.setEventSource("test");
event.setEventCreateTime(new Date());
event.setEventSeverity(OnmsSeverity.CLEARED.getId());
event.setEventLog("Y");
event.setEventDisplay("Y");
m_dbPopulator.getEventDao().save(event);
m_dbPopulator.getEventDao().flush();
OnmsEvent event2 = new OnmsEvent();
event2.setDistPoller(getDistPoller("localhost", "127.0.0.1"));
event2.setEventUei("uei.opennms.org/test3");
event2.setEventTime(new Date());
event2.setEventSource("test");
event2.setEventCreateTime(new Date());
event2.setEventSeverity(OnmsSeverity.CLEARED.getId());
event2.setEventLog("Y");
event2.setEventDisplay("N");
m_dbPopulator.getEventDao().save(event2);
m_dbPopulator.getEventDao().flush();
}
示例13: testSave
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Test
@Transactional
public void testSave() {
OnmsEvent event = new OnmsEvent();
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setEventCreateTime(new Date());
event.setDistPoller(m_distPollerDao.load("localhost"));
event.setEventTime(new Date());
event.setEventSeverity(new Integer(7));
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);
alarm.setDistPoller(m_distPollerDao.load("localhost"));
m_alarmDao.save(alarm);
// It works we're so smart! hehe
OnmsAlarm newAlarm = m_alarmDao.load(alarm.getId());
assertEquals("uei://org/opennms/test/EventDaoTest", newAlarm.getUei());
assertEquals(alarm.getLastEvent().getId(), newAlarm.getLastEvent().getId());
}
示例14: setUp
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Before
public void setUp(){
assertNotNull(m_daoEventRepo);
m_dbPopulator.populateDatabase();
OnmsEvent event = new OnmsEvent();
event.setDistPoller(getDistPoller("localhost", "127.0.0.1"));
event.setEventUei("uei.opennms.org/test2");
event.setEventTime(new Date());
event.setEventSource("test");
event.setEventCreateTime(new Date());
event.setEventSeverity(OnmsSeverity.CLEARED.getId());
event.setEventLog("Y");
event.setEventDisplay("Y");
m_dbPopulator.getEventDao().save(event);
m_dbPopulator.getEventDao().flush();
OnmsEvent event2 = new OnmsEvent();
event2.setDistPoller(getDistPoller("localhost", "127.0.0.1"));
event2.setEventUei("uei.opennms.org/test3");
event2.setEventTime(new Date());
event2.setEventSource("test");
event2.setEventCreateTime(new Date());
event2.setEventSeverity(OnmsSeverity.CLEARED.getId());
event2.setEventLog("Y");
event2.setEventDisplay("N");
m_dbPopulator.getEventDao().save(event2);
m_dbPopulator.getEventDao().flush();
}
示例15: testActions
import org.opennms.netmgt.model.OnmsEvent; //导入方法依赖的package包/类
@Test
@Transactional
public void testActions() {
OnmsEvent event = new OnmsEvent();
event.setEventLog("Y");
event.setEventDisplay("Y");
event.setEventCreateTime(new Date());
event.setDistPoller(m_distPollerDao.load("localhost"));
event.setEventTime(new Date());
event.setEventSeverity(Integer.valueOf(6));
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.setSeverity(OnmsSeverity.get(event.getEventSeverity()));
alarm.setSeverityId(event.getEventSeverity());
alarm.setFirstEventTime(event.getEventTime());
alarm.setLastEvent(event);
alarm.setCounter(1);
alarm.setDistPoller(m_distPollerDao.load("localhost"));
m_alarmDao.save(alarm);
OnmsAlarm newAlarm = m_alarmDao.load(alarm.getId());
assertEquals("uei://org/opennms/test/EventDaoTest", newAlarm.getUei());
assertEquals(alarm.getLastEvent().getId(), newAlarm.getLastEvent().getId());
assertEquals(OnmsSeverity.MAJOR, newAlarm.getSeverity());
newAlarm.escalate("admin");
assertEquals(OnmsSeverity.CRITICAL, newAlarm.getSeverity());
newAlarm.clear("admin");
assertEquals(OnmsSeverity.CLEARED, newAlarm.getSeverity());
newAlarm.unacknowledge("admin");
assertNull(newAlarm.getAckUser());
assertNull(newAlarm.getAlarmAckTime());
}