package org.opendaylight.controller.netconf.persist.impl;
import com.google.common.annotations.VisibleForTesting;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
import org.opendaylight.controller.netconf.util.xml.XmlElement;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
/**
* Inspects snapshot xml to be stored, remove all capabilities that are not referenced by it.
* Useful when persisting current configuration.
*/
public class CapabilityStrippingConfigSnapshotHolder implements ConfigSnapshotHolder {
- private static final Logger logger = LoggerFactory.getLogger(CapabilityStrippingConfigSnapshotHolder.class);
+ private static final Logger LOG = LoggerFactory.getLogger(CapabilityStrippingConfigSnapshotHolder.class);
private final String configSnapshot;
private final StripCapabilitiesResult stripCapabilitiesResult;
static StripCapabilitiesResult stripCapabilities(XmlElement configElement, Set<String> allCapabilitiesFromHello) {
// collect all namespaces
Set<String> foundNamespacesInXML = getNamespaces(configElement);
- logger.trace("All capabilities {}\nFound namespaces in XML {}", allCapabilitiesFromHello, foundNamespacesInXML);
+ LOG.trace("All capabilities {}\nFound namespaces in XML {}", allCapabilitiesFromHello, foundNamespacesInXML);
// required are referenced both in xml and hello
SortedSet<String> requiredCapabilities = new TreeSet<>();
// can be removed
}
}
- logger.trace("Required capabilities {}, \nObsolete capabilities {}",
+ LOG.trace("Required capabilities {}, \nObsolete capabilities {}",
requiredCapabilities, obsoleteCapabilities);
return new StripCapabilitiesResult(requiredCapabilities, obsoleteCapabilities);
package org.opendaylight.controller.netconf.persist.impl;
-import org.opendaylight.controller.config.persist.api.Persister;
-import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification;
-import org.opendaylight.controller.netconf.api.jmx.DefaultCommitOperationMXBean;
-import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import java.io.Closeable;
+import java.io.IOException;
import javax.annotation.concurrent.ThreadSafe;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanServerConnection;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
-import java.io.Closeable;
-import java.io.IOException;
+import org.opendaylight.controller.config.persist.api.Persister;
+import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification;
+import org.opendaylight.controller.netconf.api.jmx.DefaultCommitOperationMXBean;
+import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Responsible for listening for notifications from netconf (via JMX) containing latest
@ThreadSafe
public class ConfigPersisterNotificationHandler implements Closeable {
- private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterNotificationHandler.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigPersisterNotificationHandler.class);
private final MBeanServerConnection mBeanServerConnection;
private final NotificationListener listener;
}
private static void registerAsJMXListener(final MBeanServerConnection mBeanServerConnection, final NotificationListener listener) {
- logger.trace("Called registerAsJMXListener");
+ LOG.trace("Called registerAsJMXListener");
try {
mBeanServerConnection.addNotificationListener(DefaultCommitOperationMXBean.OBJECT_NAME, listener, null, null);
} catch (InstanceNotFoundException | IOException e) {
mBeanServerConnection.removeNotificationListener(on, listener);
}
} catch (final Exception e) {
- logger.warn("Unable to unregister {} as listener for {}", listener, on, e);
+ LOG.warn("Unable to unregister {} as listener for {}", listener, on, e);
}
}
}
class ConfigPersisterNotificationListener implements NotificationListener {
- private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterNotificationListener.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigPersisterNotificationListener.class);
private final Persister persisterAggregator;
// Socket should not be closed at this point
// Activator unregisters this as JMX listener before close is called
- logger.trace("Received notification {}", notification);
+ LOG.trace("Received notification {}", notification);
if (notification instanceof CommitJMXNotification) {
try {
handleAfterCommitNotification((CommitJMXNotification) notification);
} catch (final Exception e) {
// log exceptions from notification Handler here since
// notificationBroadcastSupport logs only DEBUG level
- logger.warn("Failed to handle notification {}", notification, e);
+ LOG.warn("Failed to handle notification {}", notification, e);
throw e;
}
} else {
try {
persisterAggregator.persistConfig(new CapabilityStrippingConfigSnapshotHolder(notification.getConfigSnapshot(),
notification.getCapabilities()));
- logger.trace("Configuration persisted successfully");
+ LOG.trace("Configuration persisted successfully");
} catch (final IOException e) {
throw new RuntimeException("Unable to persist configuration snapshot", e);
}
@Immutable
public class ConfigPusherImpl implements ConfigPusher {
- private static final Logger logger = LoggerFactory.getLogger(ConfigPusherImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigPusherImpl.class);
private final long maxWaitForCapabilitiesMillis;
private final long conflictingVersionTimeoutMillis;
* it is good idea to perform garbage collection to prune
* any garbage we have accumulated during startup.
*/
- logger.debug("Running post-initialization garbage collection...");
+ LOG.debug("Running post-initialization garbage collection...");
System.gc();
- logger.debug("Post-initialization garbage collection completed.");
- logger.debug("ConfigPusher has pushed configs {}, gc completed", configs);
+ LOG.debug("Post-initialization garbage collection completed.");
+ LOG.debug("ConfigPusher has pushed configs {}, gc completed", configs);
}
catch (NetconfDocumentedException e) {
- logger.error("Error pushing configs {}",configs);
+ LOG.error("Error pushing configs {}",configs);
throw new IllegalStateException(e);
}
}
}
public void pushConfigs(List<? extends ConfigSnapshotHolder> configs) throws InterruptedException {
- logger.debug("Requested to push configs {}", configs);
+ LOG.debug("Requested to push configs {}", configs);
this.queue.put(configs);
}
private LinkedHashMap<? extends ConfigSnapshotHolder, EditAndCommitResponse> internalPushConfigs(List<? extends ConfigSnapshotHolder> configs) throws NetconfDocumentedException {
- logger.debug("Last config snapshots to be pushed to netconf: {}", configs);
+ LOG.debug("Last config snapshots to be pushed to netconf: {}", configs);
LinkedHashMap<ConfigSnapshotHolder, EditAndCommitResponse> result = new LinkedHashMap<>();
// start pushing snapshots:
for (ConfigSnapshotHolder configSnapshotHolder : configs) {
if(configSnapshotHolder != null) {
EditAndCommitResponse editAndCommitResponseWithRetries = pushConfigWithConflictingVersionRetries(configSnapshotHolder);
- logger.debug("Config snapshot pushed successfully: {}, result: {}", configSnapshotHolder, result);
+ LOG.debug("Config snapshot pushed successfully: {}, result: {}", configSnapshotHolder, result);
result.put(configSnapshotHolder, editAndCommitResponseWithRetries);
}
}
- logger.debug("All configuration snapshots have been pushed successfully.");
+ LOG.debug("All configuration snapshots have been pushed successfully.");
return result;
}
return pushConfig(configSnapshotHolder, operationService);
} catch (ConflictingVersionException e) {
lastException = e;
- logger.debug("Conflicting version detected, will retry after timeout");
+ LOG.debug("Conflicting version detected, will retry after timeout");
sleep();
}
} while (stopwatch.elapsed(TimeUnit.MILLISECONDS) < conflictingVersionTimeoutMillis);
try {
return getOperationService(expectedCapabilities, idForReporting);
} catch (NotEnoughCapabilitiesException e) {
- logger.debug("Not enough capabilities: " + e.toString());
+ LOG.debug("Not enough capabilities: {}", e.toString());
lastException = e;
sleep();
}
return serviceCandidate;
} else {
serviceCandidate.close();
- logger.trace("Netconf server did not provide required capabilities for {} " +
+ LOG.trace("Netconf server did not provide required capabilities for {} ", idForReporting,
"Expected but not found: {}, all expected {}, current {}",
- idForReporting, notFoundDiff, expectedCapabilities, serviceCandidate.getCapabilities()
+ notFoundDiff, expectedCapabilities, serviceCandidate.getCapabilities()
);
throw new NotEnoughCapabilitiesException("Not enough capabilities for " + idForReporting + ". Expected but not found: " + notFoundDiff);
}
} catch (SAXException | IOException e) {
throw new IllegalStateException("Cannot parse " + configSnapshotHolder);
}
- logger.trace("Pushing last configuration to netconf: {}", configSnapshotHolder);
+ LOG.trace("Pushing last configuration to netconf: {}", configSnapshotHolder);
Stopwatch stopwatch = new Stopwatch().start();
NetconfMessage editConfigMessage = createEditConfigMessage(xmlToBePersisted);
Document commitResponseMessage = sendRequestGetResponseCheckIsOK(getCommitMessage(), operationService,
"commit", configSnapshotHolder.toString());
- if (logger.isTraceEnabled()) {
+ if (LOG.isTraceEnabled()) {
StringBuilder response = new StringBuilder("editConfig response = {");
response.append(XmlUtil.toString(editResponseMessage));
response.append("}");
response.append("commit response = {");
response.append(XmlUtil.toString(commitResponseMessage));
response.append("}");
- logger.trace("Last configuration loaded successfully");
- logger.trace("Detailed message {}", response);
- logger.trace("Total time spent {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS));
+ LOG.trace("Last configuration loaded successfully");
+ LOG.trace("Detailed message {}", response);
+ LOG.trace("Total time spent {} ms", stopwatch.elapsed(TimeUnit.MILLISECONDS));
}
return new EditAndCommitResponse(editResponseMessage, commitResponseMessage);
}
package org.opendaylight.controller.netconf.persist.impl;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
import org.opendaylight.controller.config.persist.api.Persister;
import org.opendaylight.controller.config.persist.api.PropertiesProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-
public class NoOpStorageAdapter implements StorageAdapter, Persister {
- private static final Logger logger = LoggerFactory.getLogger(NoOpStorageAdapter.class);
+ private static final Logger LOG = LoggerFactory.getLogger(NoOpStorageAdapter.class);
@Override
public Persister instantiate(PropertiesProvider propertiesProvider) {
- logger.debug("instantiate called with {}", propertiesProvider);
+ LOG.debug("instantiate called with {}", propertiesProvider);
return this;
}
@Override
public void persistConfig(ConfigSnapshotHolder holder) throws IOException {
- logger.debug("persistConfig called with {}", holder);
+ LOG.debug("persistConfig called with {}", holder);
}
@Override
public List<ConfigSnapshotHolder> loadLastConfigs() throws IOException {
- logger.debug("loadLastConfig called");
+ LOG.debug("loadLastConfig called");
return Collections.emptyList();
}
@Override
public void close() {
- logger.debug("close called");
+ LOG.debug("close called");
}
}
*
*/
public final class PersisterAggregator implements Persister {
- private static final Logger logger = LoggerFactory.getLogger(PersisterAggregator.class);
+ private static final Logger LOG = LoggerFactory.getLogger(PersisterAggregator.class);
public static class PersisterWithConfiguration {
persisterWithConfigurations.add(PersisterAggregator.loadConfiguration(index, propertiesProvider));
}
}
- logger.debug("Initialized persister with following adapters {}", persisterWithConfigurations);
+ LOG.debug("Initialized persister with following adapters {}", persisterWithConfigurations);
return new PersisterAggregator(persisterWithConfigurations);
}
public void persistConfig(ConfigSnapshotHolder holder) throws IOException {
for (PersisterWithConfiguration persisterWithConfiguration: persisterWithConfigurations){
if (!persisterWithConfiguration.readOnly){
- logger.debug("Calling {}.persistConfig", persisterWithConfiguration.getStorage());
+ LOG.debug("Calling {}.persistConfig", persisterWithConfiguration.getStorage());
persisterWithConfiguration.getStorage().persistConfig(holder);
}
}
throw new RuntimeException("Error while calling loadLastConfig on " + persisterWithConfiguration, e);
}
if (!configs.isEmpty()) {
- logger.debug("Found non empty configs using {}:{}", persisterWithConfiguration, configs);
+ LOG.debug("Found non empty configs using {}:{}", persisterWithConfiguration, configs);
return configs;
}
}
// no storage had an answer
- logger.debug("No non-empty list of configuration snapshots found");
+ LOG.debug("No non-empty list of configuration snapshots found");
return Collections.emptyList();
}
try{
persisterWithConfiguration.storage.close();
}catch(RuntimeException e) {
- logger.error("Error while closing {}", persisterWithConfiguration.storage, e);
+ LOG.error("Error while closing {}", persisterWithConfiguration.storage, e);
if (lastException == null){
lastException = e;
} else {
package org.opendaylight.controller.netconf.persist.impl.osgi;
+import com.google.common.annotations.VisibleForTesting;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
-
import javax.management.MBeanServer;
-
import org.opendaylight.controller.config.persist.api.ConfigPusher;
import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
import org.opendaylight.controller.netconf.mapping.api.NetconfOperationProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.annotations.VisibleForTesting;
-
public class ConfigPersisterActivator implements BundleActivator {
- private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterActivator.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigPersisterActivator.class);
private static final MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
public static final String MAX_WAIT_FOR_CAPABILITIES_MILLIS_PROPERTY = "maxWaitForCapabilitiesMillis";
@Override
public void start(final BundleContext context) throws Exception {
- logger.debug("ConfigPersister starting");
+ LOG.debug("ConfigPersister starting");
this.context = context;
autoCloseables = new ArrayList<>();
long maxWaitForCapabilitiesMillis = getMaxWaitForCapabilitiesMillis(propertiesProvider);
List<ConfigSnapshotHolder> configs = persisterAggregator.loadLastConfigs();
long conflictingVersionTimeoutMillis = getConflictingVersionTimeoutMillis(propertiesProvider);
- logger.debug("Following configs will be pushed: {}", configs);
+ LOG.debug("Following configs will be pushed: {}", configs);
InnerCustomizer innerCustomizer = new InnerCustomizer(configs, maxWaitForCapabilitiesMillis,
conflictingVersionTimeoutMillis, persisterAggregator);
@Override
public NetconfOperationProvider addingService(ServiceReference<NetconfOperationProvider> reference) {
- logger.trace("Got OuterCustomizer.addingService {}", reference);
+ LOG.trace("Got OuterCustomizer.addingService {}", reference);
// JMX was registered, track config-netconf-connector
Filter filter;
try {
@Override
public NetconfOperationServiceFactory addingService(ServiceReference<NetconfOperationServiceFactory> reference) {
- logger.trace("Got InnerCustomizer.addingService {}", reference);
+ LOG.trace("Got InnerCustomizer.addingService {}", reference);
NetconfOperationServiceFactory service = reference.getBundle().getBundleContext().getService(reference);
- logger.debug("Creating new job queue");
+ LOG.debug("Creating new job queue");
final ConfigPusherImpl configPusher = new ConfigPusherImpl(service, maxWaitForCapabilitiesMillis, conflictingVersionTimeoutMillis);
- logger.debug("Configuration Persister got {}", service);
- logger.debug("Context was {}", context);
- logger.debug("Registration was {}", registration);
+ LOG.debug("Configuration Persister got {}", service);
+ LOG.debug("Context was {}", context);
+ LOG.debug("Registration was {}", registration);
final Thread pushingThread = new Thread(new Runnable() {
@Override
registration = context.registerService(ConfigPusher.class.getName(), configPusher, null);
configPusher.process(autoCloseables, platformMBeanServer, persisterAggregator);
} else {
- logger.warn("Unable to process configs as BundleContext is null");
+ LOG.warn("Unable to process configs as BundleContext is null");
}
} catch (InterruptedException e) {
- logger.info("ConfigPusher thread stopped",e);
+ LOG.info("ConfigPusher thread stopped",e);
}
- logger.info("Configuration Persister initialization completed.");
+ LOG.info("Configuration Persister initialization completed.");
}
}, "config-pusher");
synchronized (autoCloseables) {
public class PropertiesProviderBaseImpl implements PropertiesProvider {
- private static final Logger logger = LoggerFactory.getLogger(PropertiesProviderBaseImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(PropertiesProviderBaseImpl.class);
private final BundleContext bundleContext;
public PropertiesProviderBaseImpl(BundleContext bundleContext) {
}
public String getPropertyWithoutPrefix(String fullKey){
- logger.trace("Full key {}", fullKey);
+ LOG.trace("Full key {}", fullKey);
return bundleContext.getProperty(fullKey);
}
*/
package org.opendaylight.controller.netconf.persist.impl;
+import static org.junit.Assert.assertEquals;
+
import com.google.common.collect.Sets;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
import org.w3c.dom.Element;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-
public class CapabilityStrippingConfigSnapshotHolderTest {
@Test
import static org.mockito.Mockito.verify;
import javax.management.MBeanServerConnection;
-
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.management.ObjectName;
package org.opendaylight.controller.netconf.persist.impl;
+import com.google.common.collect.Lists;
import java.util.Collections;
-
import javax.management.Notification;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
-import com.google.common.collect.Lists;
-
public class ConfigPersisterNotificationListenerTest {
@Mock
*/
package org.opendaylight.controller.netconf.persist.impl;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
import org.opendaylight.controller.config.persist.api.Persister;
import org.opendaylight.controller.config.persist.api.PropertiesProvider;
import org.opendaylight.controller.config.persist.api.StorageAdapter;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-
public class DummyAdapter implements StorageAdapter, Persister {
static int persist = 0;
package org.opendaylight.controller.netconf.persist.impl;
-import com.google.common.collect.Lists;
-
-import org.junit.Test;
-import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
-import org.opendaylight.controller.config.persist.api.Persister;
-import org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter;
-import org.opendaylight.controller.netconf.persist.impl.osgi.ConfigPersisterActivator;
-import org.opendaylight.controller.netconf.persist.impl.osgi.PropertiesProviderBaseImpl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.opendaylight.controller.netconf.persist.impl.PersisterAggregator.PersisterWithConfiguration;
-import static org.opendaylight.controller.netconf.persist.impl.PersisterAggregatorTest.TestingPropertiesProvider.loadFile;
+
+import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import org.junit.Test;
+import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
+import org.opendaylight.controller.config.persist.api.Persister;
+import org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter;
+import org.opendaylight.controller.netconf.persist.impl.osgi.ConfigPersisterActivator;
+import org.opendaylight.controller.netconf.persist.impl.osgi.PropertiesProviderBaseImpl;
public class PersisterAggregatorTest {
@Test
public void testDummyAdapter() throws Exception {
- PersisterAggregator persisterAggregator = PersisterAggregator.createFromProperties(loadFile("test1.properties"));
+ PersisterAggregator persisterAggregator = PersisterAggregator.createFromProperties(TestingPropertiesProvider.loadFile("test1.properties"));
List<PersisterWithConfiguration> persisters = persisterAggregator.getPersisterWithConfigurations();
assertEquals(1, persisters.size());
PersisterWithConfiguration persister = persisters.get(0);
@Test
public void testLoadFromPropertyFile() throws Exception {
- PersisterAggregator persisterAggregator = PersisterAggregator.createFromProperties(loadFile("test2.properties"));
+ PersisterAggregator persisterAggregator = PersisterAggregator.createFromProperties(TestingPropertiesProvider.loadFile("test2.properties"));
List<PersisterWithConfiguration> persisters = persisterAggregator.getPersisterWithConfigurations();
assertEquals(1, persisters.size());
PersisterWithConfiguration persister = persisters.get(0);
@Test
public void testFileStorageNumberOfBackups() throws Exception {
try {
- PersisterAggregator.createFromProperties(loadFile("test3.properties"));
+ PersisterAggregator.createFromProperties(TestingPropertiesProvider.loadFile("test3.properties"));
fail();
} catch (RuntimeException e) {
assertThat(
*/
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;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-import java.io.IOException;
-
-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;
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();
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import java.io.Closeable;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
-
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.opendaylight.controller.config.persist.api.ConfigPusher;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
final class MockedBundleContext {
@Mock
private BundleContext context;
final class TestingExceptionHandler implements Thread.UncaughtExceptionHandler {
- private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterTest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TestingExceptionHandler.class);
private Throwable t;
@Override
public void uncaughtException(Thread t, Throwable e) {
- logger.debug("Uncaught exception in thread {}", t, e);
+ LOG.debug("Uncaught exception in thread {}", t, e);
this.t = e;
}