added cfgService for AlarmPollingProvider
Change-Id: Ia8a19bd52495cb2cf07ef0dabbe9dbfe28d56555
(cherry picked from commit 8ee2be9f8581b71e8c13216e38248d20a85db04a)
diff --git a/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/PollingAlarmProvider.java b/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/PollingAlarmProvider.java
index 7222bac..c74934c 100644
--- a/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/PollingAlarmProvider.java
+++ b/apps/faultmanagement/fmmgr/src/main/java/org/onosproject/faultmanagement/impl/PollingAlarmProvider.java
@@ -22,6 +22,7 @@
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.incubator.net.faultmanagement.alarm.AlarmConsumer;
import org.onosproject.incubator.net.faultmanagement.alarm.AlarmProvider;
import org.onosproject.incubator.net.faultmanagement.alarm.AlarmProviderRegistry;
@@ -70,6 +71,9 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected AlarmProviderRegistry providerRegistry;
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected ComponentConfigService cfgService;
+
protected AlarmProviderService providerService;
protected ScheduledExecutorService alarmsExecutor;
@@ -101,6 +105,7 @@
@Activate
public void activate(ComponentContext context) {
+ cfgService.registerProperties(getClass());
alarmsExecutor = newScheduledThreadPool(CORE_POOL_SIZE,
groupedThreads("onos/pollingalarmprovider",
"alarm-executor-%d", log));
@@ -127,6 +132,7 @@
@Deactivate
public void deactivate() {
+ cfgService.unregisterProperties(getClass(), false);
providerRegistry.unregister(this);
mastershipService.removeListener(mastershipListener);
deviceService.removeListener(deviceListener);
diff --git a/apps/faultmanagement/fmmgr/src/test/java/org/onosproject/faultmanagement/impl/PollingAlarmProviderTest.java b/apps/faultmanagement/fmmgr/src/test/java/org/onosproject/faultmanagement/impl/PollingAlarmProviderTest.java
index b2f2469..560203b 100644
--- a/apps/faultmanagement/fmmgr/src/test/java/org/onosproject/faultmanagement/impl/PollingAlarmProviderTest.java
+++ b/apps/faultmanagement/fmmgr/src/test/java/org/onosproject/faultmanagement/impl/PollingAlarmProviderTest.java
@@ -22,6 +22,8 @@
import org.junit.Test;
import org.onlab.osgi.ComponentContextAdapter;
import org.onlab.packet.ChassisId;
+import org.onosproject.cfg.ComponentConfigAdapter;
+import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.cluster.NodeId;
import org.onosproject.cluster.RoleInfo;
import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
@@ -80,6 +82,8 @@
private final AlarmProviderService alarmProviderService = new MockAlarmProviderService();
+ private final ComponentConfigService cfgService = new ComponentConfigAdapter();
+
private final ComponentContext context = new MockComponentContext();
private static final DeviceId DEVICE_ID = DeviceId.deviceId("foo:1.1.1.1:1");
@@ -114,6 +118,7 @@
provider.providerRegistry = providerRegistry;
provider.deviceService = deviceService;
provider.mastershipService = mastershipService;
+ provider.cfgService = cfgService;
AbstractProjectableModel.setDriverService(null, new DriverServiceAdapter());
provider.activate(context);
}