Adapt UT and blueprint file accordingly.
JIRA: TRNSPRTPCE-736
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: Ifbcd73c6a2390bbaa5fa468617ff46ba1515892c
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.ServicePathNotificationTypes;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParametersBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeaderBuilder;
+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(immediate = true)
public class PathComputationServiceImpl implements PathComputationService {
private static final Logger LOG = LoggerFactory.getLogger(PathComputationServiceImpl.class);
private final GnpyConsumer gnpyConsumer;
private PortMapping portMapping;
- public PathComputationServiceImpl(NetworkTransactionService networkTransactionService,
- NotificationPublishService notificationPublishService,
- GnpyConsumer gnpyConsumer, PortMapping portMapping) {
+ @Activate
+ public PathComputationServiceImpl(@Reference NetworkTransactionService networkTransactionService,
+ @Reference NotificationPublishService notificationPublishService,
+ @Reference GnpyConsumer gnpyConsumer,
+ @Reference PortMapping portMapping) {
this.notificationPublishService = notificationPublishService;
this.networkTransactionService = networkTransactionService;
this.executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(5));
this.gnpyConsumer = gnpyConsumer;
this.portMapping = portMapping;
- }
-
- public void init() {
- LOG.info("init ...");
- }
-
- public void close() {
- LOG.info("close.");
+ LOG.debug("PathComputationServiceImpl instantiated");
}
@SuppressFBWarnings(
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
- <reference id="networkTransactionImpl" interface="org.opendaylight.transportpce.common.network.NetworkTransactionService" />
<reference id="rpcService" interface="org.opendaylight.mdsal.binding.api.RpcProviderService"/>
- <reference id="notificationPublishService" interface="org.opendaylight.mdsal.binding.api.NotificationPublishService"/>
- <reference id="portMapping" interface="org.opendaylight.transportpce.common.mapping.PortMapping"/>
- <reference id="gnpyConsumer" interface="org.opendaylight.transportpce.pce.gnpy.consumer.GnpyConsumer"/>
-
- <bean id="pceServiceImpl"
- class="org.opendaylight.transportpce.pce.service.PathComputationServiceImpl"
- init-method="init" destroy-method="close">
- <argument ref="networkTransactionImpl"/>
- <argument ref="notificationPublishService" />
- <argument ref="gnpyConsumer" />
- <argument ref="portMapping" />
- </bean>
+ <reference id="pceServiceImpl" interface="org.opendaylight.transportpce.pce.service.PathComputationService"/>
<bean id="provider"
class="org.opendaylight.transportpce.pce.impl.PceProvider"
<argument ref="rpcService" />
<argument ref="pceServiceImpl" />
</bean>
-
- <service ref="pceServiceImpl"
- interface="org.opendaylight.transportpce.pce.service.PathComputationService"/>
-
</blueprint>
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Map;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
pathComputationServiceImpl = new PathComputationServiceImpl(
networkTransactionService,
this.getNotificationPublishService(), null, null);
- pathComputationServiceImpl.init();
}
@Test
pathComputationServiceImpl.generateGnpyResponse(null,"path");
assertNotNull(pathComputationServiceImpl.pathComputationRerouteRequest(PceTestData.getPCEReroute()));
}
-
- @AfterEach
- void destroy() {
- pathComputationServiceImpl.close();
- }
}