Do not use RpcService in nbinotifications module
[transportpce.git] / nbinotifications / src / test / java / org / opendaylight / transportpce / nbinotifications / impl / NbiNotificationsProviderTest.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.nbinotifications.impl;
9
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.times;
12 import static org.mockito.Mockito.verify;
13
14 import org.junit.jupiter.api.BeforeEach;
15 import org.junit.jupiter.api.Test;
16 import org.mockito.Mock;
17 import org.mockito.MockitoAnnotations;
18 import org.opendaylight.mdsal.binding.api.NotificationService;
19 import org.opendaylight.mdsal.binding.api.RpcProviderService;
20 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
21 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
22 import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
23 import org.opendaylight.transportpce.test.AbstractTest;
24
25 public class NbiNotificationsProviderTest  extends AbstractTest {
26     public static NetworkTransactionService networkTransactionService;
27
28     @Mock
29     RpcProviderService rpcProviderRegistry;
30     @Mock
31     private NotificationService notificationService;
32
33     @BeforeEach
34     void init() {
35         MockitoAnnotations.openMocks(this);
36     }
37
38     @Test
39     void initTest() {
40         networkTransactionService = new NetworkTransactionImpl(getDataBroker());
41         new NbiNotificationsProvider("localhost:8080", "localhost:8080",
42                 rpcProviderRegistry, notificationService, getDataStoreContextUtil().getBindingDOMCodecServices(),
43                 networkTransactionService);
44         verify(rpcProviderRegistry, times(1)).registerRpcImplementations(any());
45         verify(notificationService, times(1))
46                 .registerNotificationListener(any(NbiNotificationsListenerImpl.class));
47     }
48 }