use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class SecurityAuthenticationEventOnmsEventBuilderTest method setUp.
@Override
public void setUp() {
m_mocks = new EasyMockUtils();
m_eventProxy = m_mocks.createMock(EventProxy.class);
}
use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class DefaultResourceDaoTest method setUp.
@Before
public void setUp() throws Exception {
m_fileAnticipator = new FileAnticipator();
m_easyMockUtils = new EasyMockUtils();
m_nodeDao = m_easyMockUtils.createMock(NodeDao.class);
m_locationMonitorDao = m_easyMockUtils.createMock(LocationMonitorDao.class);
m_resourceTypesDao = m_easyMockUtils.createMock(ResourceTypesDao.class);
m_filterDao = m_easyMockUtils.createMock(FilterDao.class);
m_ipInterfaceDao = m_easyMockUtils.createMock(IpInterfaceDao.class);
FilterDaoFactory.setInstance(m_filterDao);
expect(m_filterDao.getActiveIPAddressList("IPADDR IPLIKE *.*.*.*")).andReturn(new ArrayList<InetAddress>(0)).anyTimes();
m_easyMockUtils.replayAll();
setUpCollectdConfigFactory();
m_easyMockUtils.verifyAll();
RrdStrategy<?, ?> rrdStrategy = new JRobinRrdStrategy();
m_rrdFileExtension = rrdStrategy.getDefaultFileExtension();
m_resourceStorageDao.setRrdDirectory(m_fileAnticipator.getTempDir());
m_resourceStorageDao.setRrdStrategy(rrdStrategy);
m_resourceDao = new DefaultResourceDao();
m_resourceDao.setNodeDao(m_nodeDao);
m_resourceDao.setLocationMonitorDao(m_locationMonitorDao);
m_resourceDao.setIpInterfaceDao(m_ipInterfaceDao);
m_resourceDao.setCollectdConfig(m_collectdConfig);
m_resourceDao.setResourceTypesDao(m_resourceTypesDao);
m_resourceDao.setResourceStorageDao(m_resourceStorageDao);
expect(m_resourceTypesDao.getResourceTypes()).andReturn(new HashMap<String, ResourceType>());
expect(m_resourceTypesDao.getLastUpdate()).andReturn(m_lastUpdateTime);
m_easyMockUtils.replayAll();
m_resourceDao.afterPropertiesSet();
m_easyMockUtils.verifyAll();
}
use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class ResourceDaoIntegrityIT method setUp.
@Before
public void setUp() throws Exception {
setStoreByForeignSource(false);
m_easyMockUtils = new EasyMockUtils();
m_resourceTypesDao = m_easyMockUtils.createMock(ResourceTypesDao.class);
m_filterDao = m_easyMockUtils.createMock(FilterDao.class);
FilterDaoFactory.setInstance(m_filterDao);
expect(m_filterDao.getActiveIPAddressList("IPADDR IPLIKE *.*.*.*")).andReturn(new ArrayList<InetAddress>(0)).anyTimes();
m_easyMockUtils.replayAll();
InputStream stream = ConfigurationTestUtils.getInputStreamForResource(this, "/collectdconfiguration-testdata.xml");
m_collectdConfig = new CollectdConfigFactory(stream, "localhost", false);
m_easyMockUtils.verifyAll();
m_resourceStorageDao.setRrdDirectory(m_tempFolder.getRoot());
// Match up with the extensions in resource-tree-files.txt
m_resourceStorageDao.setRrdExtension(".rrd");
m_resourceDao = new DefaultResourceDao();
m_resourceDao.setNodeDao(m_nodeDao);
m_resourceDao.setLocationMonitorDao(m_locationMonitorDao);
m_resourceDao.setCollectdConfig(m_collectdConfig);
m_resourceDao.setResourceStorageDao(m_resourceStorageDao);
m_resourceDao.setResourceTypesDao(m_resourceTypesDao);
m_resourceDao.setIpInterfaceDao(m_ipInterfaceDao);
}
use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class AnnotationBasedEventListenerAdapterTest method setUp.
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
*/
@Before
public void setUp() throws Exception {
m_mockUtils = new EasyMockUtils();
m_eventIpcMgr = m_mockUtils.createMock(EventSubscriptionService.class);
m_annotatedListener = new AnnotatedListener();
m_adapter = new AnnotationBasedEventListenerAdapter();
m_adapter.setAnnotatedListener(m_annotatedListener);
m_adapter.setEventSubscriptionService(m_eventIpcMgr);
m_subscriptions = new HashSet<String>();
Collections.addAll(m_subscriptions, EventConstants.NODE_DOWN_EVENT_UEI, EventConstants.ADD_NODE_EVENT_UEI, EventConstants.NODE_LOST_SERVICE_EVENT_UEI);
m_eventIpcMgr.addEventListener(m_adapter, m_subscriptions);
}
use of org.opennms.test.mock.EasyMockUtils in project opennms by OpenNMS.
the class SnmpCollectorITCase method setUp.
@Before
@Override
public void setUp() throws Exception {
setStartEventd(false);
super.setUp();
m_mockAgent = MockSnmpAgent.createAgentAndRun(new ClassPathResource("org/opennms/netmgt/snmp/snmpTestData1.properties").getURL(), InetAddressUtils.str(myLocalHost()) + "/9161");
m_config = new MockDataCollectionConfig();
DataCollectionConfigFactory.setInstance(m_config);
m_sysNameOid = SnmpObjId.get(".1.3.6.1.2.1.1.5");
m_ifOutOctets = SnmpObjId.get("..1.3.6.1.2.1.2.2.1.16");
m_invalid = SnmpObjId.get(".1.5.6.1.2.1.1.5");
m_ifDescr = SnmpObjId.get(".1.3.6.1.2.1.2.2.1.2");
m_easyMockUtils = new EasyMockUtils();
m_ifaceDao = m_easyMockUtils.createMock(IpInterfaceDao.class);
createAgent(1, PrimaryType.PRIMARY);
}
Aggregations