2 * Copyright © 2020 Orange Labs, 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
9 package org.opendaylight.transportpce.pce.impl;
11 import static org.mockito.ArgumentMatchers.any;
12 import static org.mockito.ArgumentMatchers.eq;
13 import static org.mockito.Mockito.mock;
14 import static org.mockito.Mockito.when;
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.junit.jupiter.api.BeforeEach;
18 import org.junit.jupiter.api.Test;
19 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
20 import org.opendaylight.mdsal.binding.api.RpcProviderService;
21 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
22 import org.opendaylight.transportpce.pce.service.PathComputationService;
23 import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
24 import org.opendaylight.transportpce.pce.utils.NotificationPublishServiceMock;
25 import org.opendaylight.transportpce.test.AbstractTest;
26 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.TransportpcePceService;
27 import org.opendaylight.yangtools.concepts.ObjectRegistration;
29 public class PceProviderTest extends AbstractTest {
31 private RpcProviderService rpcService;
32 private PathComputationService pathComputationService;
33 private NotificationPublishService notificationPublishService;
34 private NetworkTransactionImpl networkTransaction;
35 private ObjectRegistration<TransportpcePceService> rpcRegistration;
36 private PceProvider pceProvider;
40 rpcService = mock(RpcProviderService.class);
41 notificationPublishService = new NotificationPublishServiceMock();
42 networkTransaction = new NetworkTransactionImpl(getDataBroker());
43 pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService,
45 pceProvider = new PceProvider(rpcService, pathComputationService);
50 this.rpcRegistration = new ObjectRegistration<TransportpcePceService>() {
53 public TransportpcePceService getInstance() {
54 return new PceServiceRPCImpl(pathComputationService);
62 when(rpcService.registerRpcImplementation(eq(TransportpcePceService.class), any())).thenReturn(rpcRegistration);