@Deactivate
    public void deactivate() {
        cfgService.unregisterProperties(getClass(), false);
        providerRegistry.unregister(this);
        mastershipService.removeListener(mastershipListener);
        deviceService.removeListener(deviceListener);
        alarmsExecutor.shutdown();
        providerService = null;
        log.info("Stopped");
    }
@Test
    public void deactivate() throws Exception {
        provider.deactivate();
        assertEquals("Device listener should be removed", 0, deviceListeners.size());
        assertEquals("Mastership listener should be removed", 0, mastershipListeners.size());
        assertFalse("Provider should not be registered", providerRegistry.getProviders().contains(provider.id()));
        assertTrue(provider.alarmsExecutor.isShutdown());
        assertNull(provider.providerService);
    }