use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class LatencyStoringServiceMonitorAdaptorIT method setUp.
@Before
public // that uses generics
void setUp() throws Exception {
BeanUtils.setStaticApplicationContext(m_context);
m_mocks = new EasyMockUtils();
m_pollerConfig = m_mocks.createMock(PollerConfig.class);
MockLogAppender.setupLogging();
String previousOpennmsHome = System.setProperty("opennms.home", "src/test/resources");
PollOutagesConfigFactory.init();
System.setProperty("opennms.home", previousOpennmsHome);
MockNetwork network = new MockNetwork();
network.setCriticalService("ICMP");
network.addNode(1, "testNode");
network.addInterface("127.0.0.1");
network.setIfAlias("eth0");
network.addService("ICMP");
network.addService("SNMP");
m_db.populate(network);
}
use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class DefaultRrdGraphServiceTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
m_mockUtils = new EasyMockUtils();
m_fileAnticipator = new FileAnticipator(false);
m_service = new DefaultRrdGraphService();
}
use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class DroolsTicketerServiceLayerTest method setUp.
@Before
public void setUp() throws Exception {
m_eventIpcManager = new MockEventIpcManager();
EventIpcManagerFactory.setIpcManager(m_eventIpcManager);
MockLogAppender.setupLogging();
ResourceLoader loader = new DefaultResourceLoader();
Resource resource = loader.getResource("classpath:/drools-ticketer-rules.drl");
m_easyMockUtils = new EasyMockUtils();
m_configDao = m_easyMockUtils.createMock(DroolsTicketerConfigDao.class);
EasyMock.expect(m_configDao.getRulesFile()).andReturn(resource.getFile()).times(1);
EasyMock.replay(m_configDao);
m_alarmDao = m_easyMockUtils.createMock(AlarmDao.class);
m_ticketerPlugin = m_easyMockUtils.createMock(Plugin.class);
m_droolsTicketerServiceLayer = new DroolsTicketerServiceLayer(m_configDao);
m_droolsTicketerServiceLayer.setAlarmDao(m_alarmDao);
m_droolsTicketerServiceLayer.setTicketerPlugin(m_ticketerPlugin);
EasyMock.reset(m_configDao);
m_alarm = new OnmsAlarm();
m_alarm.setId(1);
m_alarm.setLogMsg("Test Logmsg");
m_alarm.setDescription("Test Description");
m_alarm.setUei("uei.opennms.org/nodes/nodeDown");
m_ticket = new Ticket();
m_ticket.setId("4");
}
use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class TicketNotificationStrategyTest method setUp.
/** {@inheritDoc} */
@Override
protected void setUp() throws Exception {
super.setUp();
m_eventIpcManager = new MockEventIpcManager();
m_eventIpcManager.setSynchronous(true);
EventIpcManagerFactory.setIpcManager(m_eventIpcManager);
MockLogAppender.setupLogging();
m_ticketNotificationStrategy = new MockTicketNotificationStrategy();
m_easyMockUtils = new EasyMockUtils();
m_dataSource = m_easyMockUtils.createMock(DataSource.class);
DataSourceFactory.setInstance(m_dataSource);
}
use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class DefaultTicketerServiceLayerTest method setUp.
@Before
public void setUp() throws Exception {
System.clearProperty(DefaultTicketerServiceLayer.SKIP_CREATE_WHEN_CLEARED_SYS_PROP);
System.clearProperty(DefaultTicketerServiceLayer.SKIP_CLOSE_WHEN_NOT_CLEARED_SYS_PROP);
m_eventIpcManager = new MockEventIpcManager();
EventIpcManagerFactory.setIpcManager(m_eventIpcManager);
MockLogAppender.setupLogging();
m_defaultTicketerServiceLayer = new DefaultTicketerServiceLayer();
m_easyMockUtils = new EasyMockUtils();
m_alarmDao = m_easyMockUtils.createMock(AlarmDao.class);
m_defaultTicketerServiceLayer.setAlarmDao(m_alarmDao);
m_ticketerPlugin = m_easyMockUtils.createMock(Plugin.class);
m_defaultTicketerServiceLayer.setTicketerPlugin(m_ticketerPlugin);
m_alarm = new OnmsAlarm();
m_alarm.setId(1);
m_alarm.setLogMsg("Test Logmsg");
m_alarm.setDescription("Test Description");
m_ticket = new Ticket();
m_ticket.setId("4");
}
Aggregations