Remove tapi-blueprint.xml file
[transportpce.git] / tapi / src / test / java / org / opendaylight / transportpce / tapi / provider / TapiProviderTest.java
index 878c7633ed23281f0ab0d3d910fd0c3f4446bf59..9427914c4aca2a6b2758ebde1968cf1384c37327 100644 (file)
@@ -11,96 +11,61 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
-import org.opendaylight.transportpce.common.network.RequestProcessor;
 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
 import org.opendaylight.transportpce.tapi.impl.TapiProvider;
-import org.opendaylight.transportpce.tapi.listeners.TapiPceListenerImpl;
-import org.opendaylight.transportpce.tapi.listeners.TapiRendererListenerImpl;
-import org.opendaylight.transportpce.tapi.listeners.TapiServiceHandlerListenerImpl;
-import org.opendaylight.transportpce.tapi.topology.TapiNetconfTopologyListener;
-import org.opendaylight.transportpce.tapi.topology.TapiPortMappingListener;
-import org.opendaylight.transportpce.tapi.utils.TapiListener;
+import org.opendaylight.transportpce.tapi.topology.TapiNetworkModelService;
 import org.opendaylight.transportpce.test.AbstractTest;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.tapinetworkutils.rev210408.TransportpceTapinetworkutilsService;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TapiCommonService;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.TapiConnectivityService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationListener;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.TapiTopologyService;
 
+@ExtendWith(MockitoExtension.class)
 public class TapiProviderTest extends AbstractTest {
-    public static NetworkTransactionService networkTransactionService;
+    private static NetworkTransactionService networkTransactionService;
 
     @Mock
-    RpcProviderService rpcProviderRegistry;
-
+    private RpcProviderService rpcProviderRegistry;
     @Mock
-    OrgOpenroadmServiceService serviceHandler;
-
+    private NotificationService notificationService;
     @Mock
-    ServiceDataStoreOperations serviceDataStoreOperations;
-
+    private NotificationPublishService notificationPublishService;
     @Mock
-    TapiListener tapiListener;
-
+    private OrgOpenroadmServiceService serviceHandler;
     @Mock
-    TransportpceTapinetworkutilsService tapiNetworkUtils;
-
-    @Mock
-    TapiPortMappingListener tapiPortMappingListener;
-
-    @Mock
-    TapiNetconfTopologyListener topologyListener;
-
+    private ServiceDataStoreOperations serviceDataStoreOperations;
     @Mock
-    TapiPceListenerImpl pceListenerImpl;
-
+    private TransportpceTapinetworkutilsService tapiNetworkUtils;
     @Mock
-    TapiRendererListenerImpl rendererListenerImpl;
-
+    private TapiNotificationListener tapiNetworkModelListenerImpl;
     @Mock
-    TapiServiceHandlerListenerImpl serviceHandlerListenerImpl;
-
-    private AutoCloseable closeable;
-
-    @Before
-    public void openMocks() {
-        closeable = MockitoAnnotations.openMocks(this);
-    }
+    private TapiNetworkModelService tapiNetworkModelServiceImpl;
 
-    @BeforeClass
-    public static void setUp() {
-        networkTransactionService = new NetworkTransactionImpl(
-            new RequestProcessor(getDataBroker()));
+    @BeforeAll
+    static void setUp() {
+        networkTransactionService = new NetworkTransactionImpl(getDataBroker());
     }
 
     @Test
-    public void testInitRegisterTapiToRpcRegistry() {
-        TapiProvider provider =  new TapiProvider(getDataBroker(), rpcProviderRegistry, serviceHandler,
-            serviceDataStoreOperations, tapiListener, networkTransactionService, topologyListener,
-            tapiPortMappingListener, tapiNetworkUtils, pceListenerImpl, rendererListenerImpl,
-            serviceHandlerListenerImpl, getNotificationService());
-
-        provider.init();
-
-        verify(rpcProviderRegistry, times(1))
-            .registerRpcImplementation(any(), any(TapiConnectivityService.class));
-        verify(rpcProviderRegistry, times(2))
-            .registerRpcImplementation(any(), any(TapiTopologyService.class));
-        verify(rpcProviderRegistry, times(2))
-            .registerRpcImplementation(any(), any(TapiCommonService.class));
-    }
-
-    @After
-    public void releaseMocks() throws Exception {
-        closeable.close();
+    void testInitRegisterTapiToRpcRegistry() {
+        TapiProvider provider =  new TapiProvider(getDataBroker(), rpcProviderRegistry, notificationService,
+            notificationPublishService, networkTransactionService, serviceHandler, serviceDataStoreOperations,
+            tapiNetworkUtils, tapiNetworkModelListenerImpl, tapiNetworkModelServiceImpl);
+
+        verify(rpcProviderRegistry, times(1)).registerRpcImplementation(any(), any(TapiConnectivityService.class));
+        verify(rpcProviderRegistry, times(2)).registerRpcImplementation(any(), any(TapiTopologyService.class));
+        verify(rpcProviderRegistry, times(2)).registerRpcImplementation(any(), any(TapiCommonService.class));
     }
-}
+}
\ No newline at end of file