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.anyObject;
12 import static org.mockito.ArgumentMatchers.eq;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.mockito.Mockito;
18 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
19 import org.opendaylight.mdsal.binding.api.RpcProviderService;
20 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
21 import org.opendaylight.transportpce.common.network.RequestProcessor;
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.rev200128.TransportpcePceService;
27 import org.opendaylight.yangtools.concepts.ObjectRegistration;
30 public class PceProviderTest extends AbstractTest {
32 private RpcProviderService rpcService;
33 private PathComputationService pathComputationService;
34 private NotificationPublishService notificationPublishService;
35 private NetworkTransactionImpl networkTransaction;
36 private RequestProcessor requestProcessor;
37 private ObjectRegistration<TransportpcePceService> rpcRegistration;
38 private PceProvider pceProvider;
42 rpcService = Mockito.mock(RpcProviderService.class);
43 notificationPublishService = new NotificationPublishServiceMock();
44 requestProcessor = Mockito.mock(RequestProcessor.class);
45 networkTransaction = new NetworkTransactionImpl(requestProcessor);
46 pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService);
47 pceProvider = new PceProvider(rpcService, pathComputationService);
51 public void testInit() {
52 this.rpcRegistration = new ObjectRegistration<TransportpcePceService>() {
55 public TransportpcePceService getInstance() {
56 return new PceServiceRPCImpl(pathComputationService);
68 .registerRpcImplementation(eq(TransportpcePceService.class), anyObject()))
69 .thenReturn(rpcRegistration);