X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Frpc%2FRpcContextImplTest.java;h=a88fa53f319ee030360182b21f0feecd67640137;hb=867da8f64fbc12f407db3d41e96b216f7f62eb5b;hp=f523828cb17d9c76dac987c531dbc1855e352cac;hpb=fea12aa0c3d66998f5e95c446562757bf0893b91;p=openflowplugin.git diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java index f523828cb1..a88fa53f31 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java @@ -12,6 +12,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,6 +22,7 @@ import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; +import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.DeviceState; import org.opendaylight.openflowplugin.api.openflow.device.RequestContext; import org.opendaylight.openflowplugin.api.openflow.device.XidSequencer; @@ -53,11 +55,13 @@ public class RpcContextImplTest { @Mock private DeviceContext deviceContext; @Mock - private BindingAwareBroker.RoutedRpcRegistration routedRpcReg; + private BindingAwareBroker.RoutedRpcRegistration routedRpcReg; @Mock private NotificationPublishService notificationPublishService; @Mock private TestRpcService serviceInstance; + @Mock + private DeviceInfo deviceInfo; private KeyedInstanceIdentifier nodeInstanceIdentifier; @@ -67,10 +71,16 @@ public class RpcContextImplTest { nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(nodeId)); when(deviceContext.getDeviceState()).thenReturn(deviceState); - when(deviceState.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier); + when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier); when(deviceContext.getMessageSpy()).thenReturn(messageSpy); - rpcContext = new RpcContextImpl(rpcProviderRegistry,deviceContext, messageSpy, MAX_REQUESTS,nodeInstanceIdentifier); + rpcContext = new RpcContextImpl( + deviceInfo, + rpcProviderRegistry, + deviceContext, + messageSpy, + MAX_REQUESTS, + nodeInstanceIdentifier); when(rpcProviderRegistry.addRoutedRpcImplementation(TestRpcService.class, serviceInstance)).thenReturn(routedRpcReg); @@ -78,8 +88,13 @@ public class RpcContextImplTest { @Test public void testStoreOrFail() throws Exception { - try (final RpcContext rpcContext = new RpcContextImpl(rpcProviderRegistry, xidSequencer, - messageSpy, 100, nodeInstanceIdentifier)) { + try (final RpcContext rpcContext = new RpcContextImpl( + deviceInfo, + rpcProviderRegistry, + xidSequencer, + messageSpy, + 100, + nodeInstanceIdentifier)) { final RequestContext requestContext = rpcContext.createRequestContext(); assertNotNull(requestContext); } @@ -87,8 +102,13 @@ public class RpcContextImplTest { @Test public void testStoreOrFailThatFails() throws Exception { - try (final RpcContext rpcContext = new RpcContextImpl(rpcProviderRegistry, xidSequencer, - messageSpy, 0, nodeInstanceIdentifier)) { + try (final RpcContext rpcContext = new RpcContextImpl( + deviceInfo, + rpcProviderRegistry, + xidSequencer, + messageSpy, + 0, + nodeInstanceIdentifier)) { final RequestContext requestContext = rpcContext.createRequestContext(); assertNull(requestContext); } @@ -96,8 +116,13 @@ public class RpcContextImplTest { @Test public void testStoreAndCloseOrFail() throws Exception { - try (final RpcContext rpcContext = new RpcContextImpl(rpcProviderRegistry, deviceContext, messageSpy, - 100, nodeInstanceIdentifier)) { + try (final RpcContext rpcContext = new RpcContextImpl( + deviceInfo, + rpcProviderRegistry, + deviceContext, + messageSpy, + 100, + nodeInstanceIdentifier)) { final RequestContext requestContext = rpcContext.createRequestContext(); assertNotNull(requestContext); requestContext.close();