@Test public void activate() throws Exception { assertFalse("Provider should be registered", providerRegistry.getProviders().contains(provider)); assertEquals("Device listener should be added", 1, deviceListeners.size()); assertEquals("Incorrect alarm provider service", alarmProviderService, provider.providerService); assertEquals("Mastership listener should be added", 1, mastershipListeners.size()); assertEquals("Incorrect polling frequency", 1, provider.alarmPollFrequencySeconds); assertFalse("Executor should be running", provider.alarmsExecutor.isShutdown()); provider.activate(null); assertEquals("Incorrect polling frequency, should be default", 60, provider.alarmPollFrequencySeconds); }
@Activate public void activate(ComponentContext context) { alarmsExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE); eventHandlingExecutor = Executors.newFixedThreadPool(CORE_POOL_SIZE, groupedThreads("onos/pollingalarmprovider", "device-installer-%d", log)); providerService = providerRegistry.register(this); deviceService.addListener(deviceListener); mastershipService.addListener(mastershipListener); if (context == null) { alarmPollFrequencySeconds = DEFAULT_POLL_FREQUENCY_SECONDS; log.info("No component configuration"); } else { Dictionary<?, ?> properties = context.getProperties(); alarmPollFrequencySeconds = getNewPollFrequency(properties, alarmPollFrequencySeconds); } scheduledTask = schedulePolling(); log.info("Started"); }
PollingAlarmProvider extends AbstractProvider implements AlarmProvider { @Activate public void activate(ComponentContext context) { alarmsExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE); eventHandlingExecutor = Executors.newFixedThreadPool(CORE_POOL_SIZE, groupedThreads("onos/pollingalarmprovider", "device-installer-%d", log)); providerService = providerRegistry.register(this); deviceService.addListener(deviceListener); mastershipService.addListener(mastershipListener); if (context == null) { alarmPollFrequencySeconds = DEFAULT_POLL_FREQUENCY_SECONDS; log.info("No component configuration"); } else { Dictionary<?, ?> properties = context.getProperties(); alarmPollFrequencySeconds = getNewPollFrequency(properties, alarmPollFrequencySeconds); } scheduledTask = schedulePolling(); log.info("Started"); } }
PollingAlarmProvider extends AbstractProvider implements AlarmProvider { @Activate public void activate(ComponentContext context) { alarmsExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE); eventHandlingExecutor = Executors.newFixedThreadPool(CORE_POOL_SIZE, groupedThreads("onos/pollingalarmprovider", "device-installer-%d", log)); providerService = providerRegistry.register(this); deviceService.addListener(deviceListener); mastershipService.addListener(mastershipListener); if (context == null) { alarmPollFrequencySeconds = DEFAULT_POLL_FREQUENCY_SECONDS; log.info("No component configuration"); } else { Dictionary<?, ?> properties = context.getProperties(); alarmPollFrequencySeconds = getNewPollFrequency(properties, alarmPollFrequencySeconds); } scheduledTask = schedulePolling(); log.info("Started"); } PollingAlarmProvider(); }
PollingAlarmProvider extends AbstractProvider implements AlarmProvider { @Activate public void activate(ComponentContext context) { alarmsExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE); eventHandlingExecutor = Executors.newFixedThreadPool(CORE_POOL_SIZE, groupedThreads("onos/pollingalarmprovider", "device-installer-%d", log)); providerService = providerRegistry.register(this); deviceService.addListener(deviceListener); mastershipService.addListener(mastershipListener); if (context == null) { alarmPollFrequencySeconds = DEFAULT_POLL_FREQUENCY_SECONDS; log.info("No component configuration"); } else { Dictionary<?, ?> properties = context.getProperties(); alarmPollFrequencySeconds = getNewPollFrequency(properties, alarmPollFrequencySeconds); } scheduledTask = schedulePolling(); log.info("Started"); } PollingAlarmProvider(); @Activate void activate(ComponentContext context); @Deactivate void deactivate(); @Modified void modified(ComponentContext context); @Override void triggerProbe(DeviceId deviceId); }
PollingAlarmProvider extends AbstractProvider implements AlarmProvider { @Activate public void activate(ComponentContext context) { alarmsExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE); eventHandlingExecutor = Executors.newFixedThreadPool(CORE_POOL_SIZE, groupedThreads("onos/pollingalarmprovider", "device-installer-%d", log)); providerService = providerRegistry.register(this); deviceService.addListener(deviceListener); mastershipService.addListener(mastershipListener); if (context == null) { alarmPollFrequencySeconds = DEFAULT_POLL_FREQUENCY_SECONDS; log.info("No component configuration"); } else { Dictionary<?, ?> properties = context.getProperties(); alarmPollFrequencySeconds = getNewPollFrequency(properties, alarmPollFrequencySeconds); } scheduledTask = schedulePolling(); log.info("Started"); } PollingAlarmProvider(); @Activate void activate(ComponentContext context); @Deactivate void deactivate(); @Modified void modified(ComponentContext context); @Override void triggerProbe(DeviceId deviceId);  }