@Activate
    public void activate(ComponentContext context) {
        providerService = providerRegistry.register(this);
        appId = coreService.registerApplication(APP_NAME);
        deviceService.addListener(deviceListener);
        cfgService.registerProperties(getClass());

        if (context == null) {
            linkPollFrequencySeconds = POLL_FREQUENCY_SECONDS_DEFAULT;
            log.info("No component configuration");
        } else {
            Dictionary<?, ?> properties = context.getProperties();
            linkPollFrequencySeconds =
                    getNewPollFrequency(properties, linkPollFrequencySeconds);
        }
        scheduledTask = schedulePolling();
        log.info("Started");
    }
@Test
    public void activate() throws Exception {
        assertTrue("Provider should be registered", linkRegistry.getProviders().contains(provider.id()));
        assertEquals("Device service should be registered", provider.deviceService, deviceService);
        assertEquals("Device listener should be added", 1, deviceListeners.size());
        assertNotNull("Registration expected", providerService);
        assertEquals("Incorrect  provider", provider, providerService.provider());
        assertFalse("Executor should be running", provider.executor.isShutdown());
        assertFalse("Executor should be running", provider.executor.isTerminated());
        assertEquals("Incorrect polling frequency, should be default", 10,
                     provider.linkPollFrequencySeconds);
        assertEquals("Incorrect polling delay , should be default", 20,
                     provider.linkPollDelaySeconds);
        assertEquals("Incorrect polling discovery delay , should be default", 300,
                     provider.linkDiscoveryTimeoutSeconds);
    }