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.Ignore;
17 import org.junit.Test;
18 import org.mockito.Mockito;
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.common.network.RequestProcessor;
23 import org.opendaylight.transportpce.pce.service.PathComputationService;
24 import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
25 import org.opendaylight.transportpce.pce.utils.NotificationPublishServiceMock;
26 import org.opendaylight.transportpce.test.AbstractTest;
27 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.TransportpcePceService;
28 import org.opendaylight.yangtools.concepts.ObjectRegistration;
31 public class PceProviderTest extends AbstractTest {
33 private RpcProviderService rpcService;
34 private PathComputationService pathComputationService;
35 private NotificationPublishService notificationPublishService;
36 private NetworkTransactionImpl networkTransaction;
37 private RequestProcessor requestProcessor;
38 private ObjectRegistration<TransportpcePceService> rpcRegistration;
39 private PceProvider pceProvider;
43 rpcService = Mockito.mock(RpcProviderService.class);
44 notificationPublishService = new NotificationPublishServiceMock();
45 requestProcessor = Mockito.mock(RequestProcessor.class);
46 networkTransaction = new NetworkTransactionImpl(requestProcessor);
47 pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService);
48 pceProvider = new PceProvider(rpcService, pathComputationService);
52 public void testInit() {
53 this.rpcRegistration = new ObjectRegistration<TransportpcePceService>() {
56 public TransportpcePceService getInstance() {
57 return new PceServiceRPCImpl(pathComputationService);
69 .registerRpcImplementation(eq(TransportpcePceService.class), anyObject()))
70 .thenReturn(rpcRegistration);