2 * Copyright © 2019 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.servicehandler.impl;
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.times;
12 import static org.mockito.Mockito.verify;
14 import org.junit.jupiter.api.Test;
15 import org.junit.jupiter.api.extension.ExtendWith;
16 import org.mockito.Mock;
17 import org.mockito.junit.jupiter.MockitoExtension;
18 import org.opendaylight.mdsal.binding.api.DataBroker;
19 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
20 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
21 import org.opendaylight.transportpce.networkmodel.service.NetworkModelService;
22 import org.opendaylight.transportpce.pce.service.PathComputationService;
23 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
24 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelNotificationHandler;
25 import org.opendaylight.transportpce.servicehandler.listeners.PceNotificationHandler;
26 import org.opendaylight.transportpce.servicehandler.listeners.RendererNotificationHandler;
27 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
28 import org.opendaylight.transportpce.test.AbstractTest;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
31 @ExtendWith(MockitoExtension.class)
32 public class ServiceHandlerProviderTest extends AbstractTest {
35 RendererServiceOperations rendererServiceOperations;
37 PathComputationService pathComputationService;
39 NetworkModelService networkModelService;
41 DataBroker dataBroker;
43 ServiceDataStoreOperations serviceDataStoreOperations;
45 NotificationPublishService notificationPublishService;
47 DataTreeChangeListener<Services> serviceListener;
49 private final PceNotificationHandler pceNotificationHandler = new PceNotificationHandler(rendererServiceOperations,
50 pathComputationService, notificationPublishService, serviceDataStoreOperations);
51 private final RendererNotificationHandler rendererNotificationHandler = new RendererNotificationHandler(
52 pathComputationService, notificationPublishService, networkModelService);
53 private final NetworkModelNotificationHandler networkModelNotificationHandler = new NetworkModelNotificationHandler(
54 notificationPublishService, serviceDataStoreOperations);
57 void testInitRegisterServiceHandlerToRpcRegistry() {
58 new ServiceHandlerProvider(dataBroker, getNotificationService(),
59 serviceDataStoreOperations, pceNotificationHandler, rendererNotificationHandler,
60 networkModelNotificationHandler, serviceListener);
61 verify(dataBroker, times(1)).registerTreeChangeListener(any(), any());