X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-persister-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fpersist%2Fimpl%2FConfigPersisterNotificationHandlerTest.java;fp=opendaylight%2Fnetconf%2Fconfig-persister-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fpersist%2Fimpl%2FConfigPersisterNotificationHandlerTest.java;h=a89520a7a801ab5ddb6a10dee397e499a83bb68b;hp=e96b547169c6dda0abbe5a4c1a40ff57e9a2ac70;hb=refs%2Fchanges%2F13%2F23413%2F26;hpb=071a641d7c12c0e6112d5ce0afe806b54f116ed2 diff --git a/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandlerTest.java b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/ConfigPersisterNotificationHandlerTest.java similarity index 80% rename from opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandlerTest.java rename to opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/ConfigPersisterNotificationHandlerTest.java index e96b547169..a89520a7a8 100644 --- a/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandlerTest.java +++ b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/ConfigPersisterNotificationHandlerTest.java @@ -6,10 +6,11 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.netconf.persist.impl; +package org.opendaylight.controller.config.persist.impl; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; @@ -24,7 +25,10 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opendaylight.controller.config.facade.xml.ConfigSubsystemFacade; +import org.opendaylight.controller.config.facade.xml.ConfigSubsystemFacadeFactory; import org.opendaylight.controller.config.persist.api.Persister; +import org.opendaylight.controller.config.util.ConfigRegistryClient; public class ConfigPersisterNotificationHandlerTest { @@ -32,10 +36,19 @@ public class ConfigPersisterNotificationHandlerTest { private MBeanServerConnection mBeanServer; @Mock private Persister notificationListener; + @Mock + private ConfigSubsystemFacadeFactory facadeFactory; + @Mock + private ConfigSubsystemFacade facade; + @Mock + private ConfigRegistryClient configRegistryClient; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); + + doReturn(facade).when(facadeFactory).createFacade(anyString()); + doNothing().when(mBeanServer).addNotificationListener(any(ObjectName.class), any(NotificationListener.class), any(NotificationFilter.class), anyObject()); } @@ -45,7 +58,7 @@ public class ConfigPersisterNotificationHandlerTest { doReturn(true).when(mBeanServer).isRegistered(any(ObjectName.class)); doThrow(Exception.class).when(mBeanServer).removeNotificationListener(any(ObjectName.class), any(NotificationListener.class)); - final ConfigPersisterNotificationHandler testedHandler = new ConfigPersisterNotificationHandler(mBeanServer, notificationListener); + final ConfigPersisterNotificationHandler testedHandler = new ConfigPersisterNotificationHandler(mBeanServer, notificationListener, facadeFactory); verify(mBeanServer).addNotificationListener(any(ObjectName.class), any(NotificationListener.class), any(NotificationFilter.class), anyObject()); @@ -57,7 +70,7 @@ public class ConfigPersisterNotificationHandlerTest { public void testNotificationHandlerCloseNotRegistered() throws Exception { doReturn(false).when(mBeanServer).isRegistered(any(ObjectName.class)); - final ConfigPersisterNotificationHandler testedHandler = new ConfigPersisterNotificationHandler(mBeanServer, notificationListener); + final ConfigPersisterNotificationHandler testedHandler = new ConfigPersisterNotificationHandler(mBeanServer, notificationListener, facadeFactory); testedHandler.close(); verify(mBeanServer, times(0)).removeNotificationListener(any(ObjectName.class), any(NotificationListener.class));