From: Gilles Thouenon Date: Mon, 13 Mar 2023 16:25:58 +0000 (+0100) Subject: Convert OlmPowerServiceImpl into a Component X-Git-Tag: 8.0.0~90 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F104937%2F4;p=transportpce.git Convert OlmPowerServiceImpl into a Component JIRA: TRNSPRTPCE-736 Signed-off-by: Gilles Thouenon Change-Id: I5a77219ea44649cb151ae333c7c49e99ab005c31 --- diff --git a/olm/src/main/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImpl.java b/olm/src/main/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImpl.java index 606bdbe04..2419fd96e 100644 --- a/olm/src/main/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImpl.java +++ b/olm/src/main/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImpl.java @@ -92,9 +92,13 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.top import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; import org.opendaylight.yangtools.yang.common.Decimal64; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@Component public class OlmPowerServiceImpl implements OlmPowerService { private static final Logger LOG = LoggerFactory.getLogger(OlmPowerServiceImpl.class); private final MappingUtils mappingUtils; @@ -104,26 +108,22 @@ public class OlmPowerServiceImpl implements OlmPowerService { private final DeviceTransactionManager deviceTransactionManager; private final PortMapping portMapping; - public OlmPowerServiceImpl(DataBroker dataBroker, PowerMgmt powerMgmt, - DeviceTransactionManager deviceTransactionManager, PortMapping portMapping, - MappingUtils mappingUtils, OpenRoadmInterfaces openRoadmInterfaces) { + @Activate + public OlmPowerServiceImpl(@Reference DataBroker dataBroker, + @Reference PowerMgmt powerMgmt, + @Reference DeviceTransactionManager deviceTransactionManager, + @Reference PortMapping portMapping, + @Reference MappingUtils mappingUtils, + @Reference OpenRoadmInterfaces openRoadmInterfaces) { this.dataBroker = dataBroker; this.powerMgmt = powerMgmt; this.portMapping = portMapping; this.deviceTransactionManager = deviceTransactionManager; this.mappingUtils = mappingUtils; this.openRoadmInterfaces = openRoadmInterfaces; + LOG.debug("OlmPowerServiceImpl Instantiated"); } - public void init() { - LOG.info("init ..."); - } - - public void close() { - LOG.info("close ..."); - } - - @Override public GetPmOutput getPm(GetPmInput pmInput) { GetPmOutputBuilder pmOutputBuilder = new GetPmOutputBuilder(); diff --git a/olm/src/main/resources/OSGI-INF/blueprint/olm-blueprint.xml b/olm/src/main/resources/OSGI-INF/blueprint/olm-blueprint.xml index 986cbf56d..f85f4cb63 100644 --- a/olm/src/main/resources/OSGI-INF/blueprint/olm-blueprint.xml +++ b/olm/src/main/resources/OSGI-INF/blueprint/olm-blueprint.xml @@ -8,22 +8,8 @@ terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html --> - - - - - - - - - - - - - - - + diff --git a/olm/src/test/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImplTest.java b/olm/src/test/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImplTest.java index 86113ab5f..513987fe4 100644 --- a/olm/src/test/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImplTest.java +++ b/olm/src/test/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImplTest.java @@ -62,13 +62,6 @@ public class OlmPowerServiceImplTest extends AbstractTest { this.portMapping, this.mappingUtils, this.openRoadmInterfaces); } - @Test - void dummyTest() { - OlmPowerServiceImpl olmPowerServiceImpl = (OlmPowerServiceImpl) this.olmPowerService; - olmPowerServiceImpl.init(); - olmPowerServiceImpl.close(); - } - @Test void testGetPm() { when(this.mappingUtils.getOpenRoadmVersion(anyString()))