X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-persister-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fpersist%2Fimpl%2Fosgi%2FConfigPersisterTest.java;h=142d8f5226d0f7141336dcfc181428f59bd0bf42;hb=330c67bcbc25e7f5586b9a75bc8c65ef5f403b8a;hp=493ecd9250262959e78523c4ed1dc49c7d177474;hpb=a7bc1dbcfefd7a349f4792242ea0f7a2ad072374;p=controller.git diff --git a/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterTest.java b/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterTest.java index 493ecd9250..142d8f5226 100644 --- a/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterTest.java +++ b/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterTest.java @@ -7,7 +7,15 @@ */ package org.opendaylight.controller.netconf.persist.impl.osgi; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; + import com.google.common.collect.Sets; +import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -25,23 +33,11 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.xml.sax.SAXException; -import javax.management.MBeanServer; -import java.io.IOException; -import java.lang.management.ManagementFactory; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; - public class ConfigPersisterTest { - private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterTest.class); + private static final Logger LOG = LoggerFactory.getLogger(ConfigPersisterTest.class); private MockedBundleContext ctx; private ConfigPersisterActivator configPersisterActivator; - private static final MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); private TestingExceptionHandler handler; @@ -84,7 +80,7 @@ public class ConfigPersisterTest { // this means pushing of config was successful public void assertCannotRegisterAsJMXListener_pushWasSuccessful() { - handler.assertException(RuntimeException.class, "Cannot register as JMX listener to netconf"); + handler.assertException(IllegalStateException.class, "Cannot register as JMX listener to netconf"); } public NetconfOperationService getWorkingService(Document document) throws SAXException, IOException, NetconfDocumentedException { @@ -139,7 +135,7 @@ public class ConfigPersisterTest { doReturn(getConflictingService()).when(ctx.serviceFactory).createService(anyString()); Thread.sleep(500); // working service: - logger.info("Switching to working service **"); + LOG.info("Switching to working service **"); doReturn(getWorkingService(getOKDocument())).when(ctx.serviceFactory).createService(anyString()); Thread.sleep(1000); assertCannotRegisterAsJMXListener_pushWasSuccessful();