2 * Copyright © 2020 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.networkmodel;
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.times;
12 import static org.mockito.Mockito.verify;
13 import static org.mockito.Mockito.when;
15 import com.google.common.util.concurrent.FluentFuture;
16 import org.junit.Test;
17 import org.junit.runner.RunWith;
18 import org.mockito.Mock;
19 import org.mockito.invocation.InvocationOnMock;
20 import org.mockito.junit.MockitoJUnitRunner;
21 import org.mockito.stubbing.Answer;
22 import org.opendaylight.mdsal.binding.api.NotificationService;
23 import org.opendaylight.mdsal.binding.api.RpcProviderService;
24 import org.opendaylight.mdsal.common.api.CommitInfo;
25 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
26 import org.opendaylight.transportpce.networkmodel.service.FrequenciesService;
27 import org.opendaylight.transportpce.test.AbstractTest;
28 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.TransportpceNetworkutilsService;
30 @RunWith(MockitoJUnitRunner.StrictStubs.class)
31 public class NetworkModelProviderTest extends AbstractTest {
33 NetworkTransactionService networkTransactionService;
35 RpcProviderService rpcProviderService;
37 TransportpceNetworkutilsService networkutilsService;
39 NetConfTopologyListener topologyListener;
41 private NotificationService notificationService;
43 private FrequenciesService frequenciesService;
47 public void networkmodelProviderInitTest() {
48 NetworkModelProvider provider = new NetworkModelProvider(networkTransactionService, getDataBroker(),
49 rpcProviderService, networkutilsService, topologyListener, notificationService,
51 Answer<FluentFuture<CommitInfo>> answer = new Answer<FluentFuture<CommitInfo>>() {
54 public FluentFuture<CommitInfo> answer(InvocationOnMock invocation) throws Throwable {
55 return CommitInfo.emptyFluentFuture();
59 when(networkTransactionService.commit()).then(answer);
63 verify(rpcProviderService, times(1))
64 .registerRpcImplementation(any(), any(TransportpceNetworkutilsService.class));