Search in sources :

Example 1 with SchedulingCompletedFlag

use of org.opennms.netmgt.collectd.Collectd.SchedulingCompletedFlag 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);
}
Also used : ResourceStorageDao(org.opennms.netmgt.dao.api.ResourceStorageDao) HashMap(java.util.HashMap) Scheduler(org.opennms.netmgt.scheduler.Scheduler) CollectionSpecification(org.opennms.netmgt.collection.core.CollectionSpecification) PlatformTransactionManager(org.springframework.transaction.PlatformTransactionManager) IpInterfaceDao(org.opennms.netmgt.dao.api.IpInterfaceDao) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) RrdPersisterFactory(org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory) ServiceParameters(org.opennms.netmgt.collection.api.ServiceParameters) SchedulingCompletedFlag(org.opennms.netmgt.collectd.Collectd.SchedulingCompletedFlag)

Aggregations

HashMap (java.util.HashMap)1 SchedulingCompletedFlag (org.opennms.netmgt.collectd.Collectd.SchedulingCompletedFlag)1 ServiceParameters (org.opennms.netmgt.collection.api.ServiceParameters)1 CollectionSpecification (org.opennms.netmgt.collection.core.CollectionSpecification)1 RrdPersisterFactory (org.opennms.netmgt.collection.persistence.rrd.RrdPersisterFactory)1 IpInterfaceDao (org.opennms.netmgt.dao.api.IpInterfaceDao)1 ResourceStorageDao (org.opennms.netmgt.dao.api.ResourceStorageDao)1 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)1 Scheduler (org.opennms.netmgt.scheduler.Scheduler)1 PlatformTransactionManager (org.springframework.transaction.PlatformTransactionManager)1