use of org.opennms.netmgt.dao.api.IpInterfaceDao in project opennms by OpenNMS.
the class CollectableServiceTest method createCollectableService.
private void createCollectableService() throws CollectionInitializationException, IOException {
// Mock it all!
OnmsIpInterface iface = mock(OnmsIpInterface.class, RETURNS_DEEP_STUBS);
IpInterfaceDao ifaceDao = mock(IpInterfaceDao.class);
spec = mock(CollectionSpecification.class);
scheduler = mock(Scheduler.class);
SchedulingCompletedFlag schedulingCompletedFlag = mock(SchedulingCompletedFlag.class);
PlatformTransactionManager transMgr = mock(PlatformTransactionManager.class);
RrdPersisterFactory persisterFactory = new RrdPersisterFactory();
persisterFactory.setRrdStrategy(rrdStrategy);
ResourceStorageDao resourceStorageDao = mock(ResourceStorageDao.class);
// Disable thresholding
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("thresholding-enabled", Boolean.FALSE.toString());
ServiceParameters params = new ServiceParameters(paramsMap);
when(iface.getNode().getId()).thenReturn(1);
when(spec.getServiceParameters()).thenReturn(params);
when(spec.getRrdRepository(any())).thenReturn(createRrdRepository());
when(ifaceDao.load(any())).thenReturn(iface);
when(iface.getIpAddress()).thenReturn(InetAddrUtils.getLocalHostAddress());
service = new CollectableService(iface, ifaceDao, spec, scheduler, schedulingCompletedFlag, transMgr, persisterFactory, resourceStorageDao);
}
Aggregations