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.listeners.PortMappingListener;
27 import org.opendaylight.transportpce.networkmodel.service.FrequenciesService;
28 import org.opendaylight.transportpce.test.AbstractTest;
29 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.TransportpceNetworkutilsService;
31 @RunWith(MockitoJUnitRunner.StrictStubs.class)
32 public class NetworkModelProviderTest extends AbstractTest {
34 NetworkTransactionService networkTransactionService;
36 RpcProviderService rpcProviderService;
38 TransportpceNetworkutilsService networkutilsService;
40 NetConfTopologyListener topologyListener;
42 private NotificationService notificationService;
44 private FrequenciesService frequenciesService;
46 private PortMappingListener portMappingListener;
50 public void networkmodelProviderInitTest() {
51 NetworkModelProvider provider = new NetworkModelProvider(networkTransactionService, getDataBroker(),
52 rpcProviderService, networkutilsService, topologyListener, notificationService,
53 frequenciesService, portMappingListener);
54 Answer<FluentFuture<CommitInfo>> answer = new Answer<FluentFuture<CommitInfo>>() {
57 public FluentFuture<CommitInfo> answer(InvocationOnMock invocation) throws Throwable {
58 return CommitInfo.emptyFluentFuture();
62 when(networkTransactionService.commit()).then(answer);
66 verify(rpcProviderService, times(1))
67 .registerRpcImplementation(any(), any(TransportpceNetworkutilsService.class));