X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fservices%2FSalFlowServiceImplTest.java;h=d19411dac07702b2a2df69f15a68dd1541cc99b8;hb=27c874d7e3717ada0113db3492ebbd05d6188061;hp=53e422c7c5a84fac01b65d0fea11cdf7b542f502;hpb=7bc04367dae6c4acfef928a358e3f3869cb453af;p=openflowplugin.git diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImplTest.java index 53e422c7c5..d19411dac0 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImplTest.java @@ -142,6 +142,7 @@ public class SalFlowServiceImplTest extends TestCase { Mockito.doReturn(Futures.>immediateFailedFuture(new Exception("ut-failed-response"))) .when(requestContext).getFuture(); + mockingFlowRegistryLookup(); final Future> rpcResultFuture = salFlowService.addFlow(mockedAddFlowInput); assertNotNull(rpcResultFuture); @@ -173,6 +174,7 @@ public class SalFlowServiceImplTest extends TestCase { AddFlowInput mockedAddFlowInput = createFlowMock(AddFlowInput.class); salFlowService.setItemLifecycleListener(itemLifecycleListener); + mockingFlowRegistryLookup(); verifyOutput(salFlowService.addFlow(mockedAddFlowInput)); if (itemLifecycleListener != null) { Mockito.verify(itemLifecycleListener).onAdded(Matchers.>any(), Matchers.any()); @@ -236,17 +238,18 @@ public class SalFlowServiceImplTest extends TestCase { verifyOutput(salFlowService.updateFlow(mockedUpdateFlowInput)); if (itemLifecycleListener != null) { - Mockito.verify(itemLifecycleListener).onAdded(Matchers.>any(), Matchers.any()); - Mockito.verify(itemLifecycleListener).onRemoved(Matchers.>any()); + Mockito.verify(itemLifecycleListener).onUpdated(Matchers.>any(), Matchers.any()); } } private void mockingFlowRegistryLookup() { FlowDescriptor mockedFlowDescriptor = mock(FlowDescriptor.class); - when(mockedFlowDescriptor.getFlowId()).thenReturn(new FlowId(DUMMY_FLOW_ID)); + FlowId flowId = new FlowId(DUMMY_FLOW_ID); + when(mockedFlowDescriptor.getFlowId()).thenReturn(flowId); when(mockedFlowDescriptor.getTableKey()).thenReturn(new TableKey(DUMMY_TABLE_ID)); + when(deviceFlowRegistry.storeIfNecessary(Matchers.any(FlowRegistryKey.class))).thenReturn(flowId); when(deviceFlowRegistry.retrieveIdForFlow(Matchers.any(FlowRegistryKey.class))).thenReturn(mockedFlowDescriptor); }