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.eq;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.mockito.Mockito;
17 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
18 import org.opendaylight.mdsal.binding.api.RpcProviderService;
19 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
20 import org.opendaylight.transportpce.common.network.RequestProcessor;
21 import org.opendaylight.transportpce.pce.service.PathComputationService;
22 import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
23 import org.opendaylight.transportpce.pce.utils.NotificationPublishServiceMock;
24 import org.opendaylight.transportpce.test.AbstractTest;
25 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.TransportpcePceService;
26 import org.opendaylight.yangtools.concepts.ObjectRegistration;
28 public class PceProviderTest extends AbstractTest {
30 private RpcProviderService rpcService;
31 private PathComputationService pathComputationService;
32 private NotificationPublishService notificationPublishService;
33 private NetworkTransactionImpl networkTransaction;
34 private RequestProcessor requestProcessor;
35 private ObjectRegistration<TransportpcePceService> rpcRegistration;
36 private PceProvider pceProvider;
40 rpcService = Mockito.mock(RpcProviderService.class);
41 notificationPublishService = new NotificationPublishServiceMock();
42 requestProcessor = Mockito.mock(RequestProcessor.class);
43 networkTransaction = new NetworkTransactionImpl(requestProcessor);
44 pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService,
46 pceProvider = new PceProvider(rpcService, pathComputationService);
50 public void testInit() {
51 this.rpcRegistration = new ObjectRegistration<TransportpcePceService>() {
54 public TransportpcePceService getInstance() {
55 return new PceServiceRPCImpl(pathComputationService);
65 .registerRpcImplementation(eq(TransportpcePceService.class), Mockito.any()))
66 .thenReturn(rpcRegistration);