X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fsal-netconf-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fsal%2Fconnect%2Fnetconf%2Fsal%2FNetconfDeviceSalFacadeTest.java;h=69f491dfe600c7ec030f4d0fa9779e4e2b9ec485;hb=a0833fb27c69d919a4420c6ecbd11a3b2a1119cb;hp=89f0ee26422afa6913ee219028d33618896d6404;hpb=6d7e12bf3ef64e5004703a1d540e7e26f30a9595;p=netconf.git diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java index 89f0ee2642..69f491dfe6 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacadeTest.java @@ -8,8 +8,9 @@ package org.opendaylight.netconf.sal.connect.netconf.sal; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -22,32 +23,29 @@ import java.util.Arrays; import java.util.List; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import org.mockito.Mock; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMNotification; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.dom.api.DOMDataBroker; +import org.opendaylight.mdsal.dom.api.DOMNotification; +import org.opendaylight.mdsal.dom.api.DOMRpcService; import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCapabilities; import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences; import org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil; import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -@RunWith(PowerMockRunner.class) -@PrepareForTest({NetconfDeviceTopologyAdapter.class, NetconfDeviceSalProvider.MountInstance.class, - NetconfSessionPreferences.class}) public class NetconfDeviceSalFacadeTest { private NetconfDeviceSalFacade deviceFacade; + @Mock private NetconfDeviceTopologyAdapter netconfDeviceTopologyAdapter; + @Mock private NetconfDeviceSalProvider.MountInstance mountInstance; - @Mock private NetconfDeviceSalProvider salProvider; + @Mock + private DataBroker dataBroker; @Before public void setUp() throws Exception { @@ -55,10 +53,7 @@ public class NetconfDeviceSalFacadeTest { final InetSocketAddress address = new InetSocketAddress("127.0.0.1", 8000); final RemoteDeviceId remoteDeviceId = new RemoteDeviceId("test", address); - deviceFacade = new NetconfDeviceSalFacade(remoteDeviceId, salProvider); - - netconfDeviceTopologyAdapter = PowerMockito.mock(NetconfDeviceTopologyAdapter.class); - mountInstance = PowerMockito.mock(NetconfDeviceSalProvider.MountInstance.class); + deviceFacade = new NetconfDeviceSalFacade(remoteDeviceId, salProvider, dataBroker, "mockTopo"); doReturn(netconfDeviceTopologyAdapter).when(salProvider).getTopologyDatastoreAdapter(); doNothing().when(netconfDeviceTopologyAdapter) @@ -100,10 +95,11 @@ public class NetconfDeviceSalFacadeTest { NetconfSessionPreferences.fromStrings(getCapabilities()); final DOMRpcService deviceRpc = mock(DOMRpcService.class); - deviceFacade.onDeviceConnected(schemaContext, netconfSessionPreferences, deviceRpc); + deviceFacade.onDeviceConnected(schemaContext, netconfSessionPreferences, deviceRpc, null); verify(mountInstance, times(1)).onTopologyDeviceConnected(eq(schemaContext), - any(DOMDataBroker.class), eq(deviceRpc), any(NetconfDeviceNotificationService.class)); + any(DOMDataBroker.class), eq(deviceRpc), any(NetconfDeviceNotificationService.class), + isNull()); verify(netconfDeviceTopologyAdapter, times(1)).updateDeviceData(true, netconfSessionPreferences.getNetconfDeviceCapabilities()); }