Networkmodel class renaming
[transportpce.git] / networkmodel / src / test / java / org / opendaylight / transportpce / networkmodel / NetworkModelProviderTest.java
1 /*
2  * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.networkmodel;
9
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;
14
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;
29
30 @RunWith(MockitoJUnitRunner.StrictStubs.class)
31 public class NetworkModelProviderTest extends AbstractTest {
32     @Mock
33     NetworkTransactionService networkTransactionService;
34     @Mock
35     RpcProviderService rpcProviderService;
36     @Mock
37     TransportpceNetworkutilsService networkutilsService;
38     @Mock
39     NetConfTopologyListener topologyListener;
40     @Mock
41     private NotificationService notificationService;
42     @Mock
43     private FrequenciesService networkModelWavelengthService;
44
45
46     @Test
47     public void networkmodelProviderInitTest() {
48         NetworkModelProvider provider = new NetworkModelProvider(networkTransactionService, getDataBroker(),
49             rpcProviderService, networkutilsService, topologyListener, notificationService,
50             networkModelWavelengthService);
51         Answer<FluentFuture<CommitInfo>> answer = new Answer<FluentFuture<CommitInfo>>() {
52
53             @Override
54             public FluentFuture<CommitInfo> answer(InvocationOnMock invocation) throws Throwable {
55                 return CommitInfo.emptyFluentFuture();
56             }
57
58         };
59         when(networkTransactionService.commit()).then(answer);
60
61         provider.init();
62
63         verify(rpcProviderService, times(1))
64             .registerRpcImplementation(any(), any(TransportpceNetworkutilsService.class));
65     }
66
67 }