Fix checkstyle warnings for config-persister-impl 52/12852/2
authorMarian Dubai <mdubai@cisco.com>
Fri, 14 Nov 2014 13:16:07 +0000 (14:16 +0100)
committerMarian Dubai <mdubai@cisco.com>
Wed, 19 Nov 2014 13:57:26 +0000 (13:57 +0000)
Change-Id: Ife66b5fea7bb6d1fe293d6181d6da7221e296731
Signed-off-by: Marian Dubai <mdubai@cisco.com>
15 files changed:
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/CapabilityStrippingConfigSnapshotHolder.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusherImpl.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/NoOpStorageAdapter.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregator.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/PropertiesProviderBaseImpl.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/CapabilityStrippingConfigSnapshotHolderTest.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandlerTest.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationListenerTest.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/DummyAdapter.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregatorTest.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterTest.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/MockedBundleContext.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/TestingExceptionHandler.java

index ab353e3..eac58cb 100644 (file)
@@ -9,6 +9,12 @@
 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;
@@ -17,19 +23,12 @@ import org.slf4j.LoggerFactory;
 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;
@@ -54,7 +53,7 @@ public class CapabilityStrippingConfigSnapshotHolder implements ConfigSnapshotHo
     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
@@ -68,7 +67,7 @@ public class CapabilityStrippingConfigSnapshotHolder implements ConfigSnapshotHo
             }
         }
 
-        logger.trace("Required capabilities {}, \nObsolete capabilities {}",
+        LOG.trace("Required capabilities {}, \nObsolete capabilities {}",
                 requiredCapabilities, obsoleteCapabilities);
 
         return new StripCapabilitiesResult(requiredCapabilities, obsoleteCapabilities);
index d72c26c..7618807 100644 (file)
@@ -8,21 +8,20 @@
 
 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
@@ -32,7 +31,7 @@ import java.io.IOException;
 @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;
 
@@ -48,7 +47,7 @@ public class ConfigPersisterNotificationHandler implements Closeable {
     }
 
     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) {
@@ -65,13 +64,13 @@ public class ConfigPersisterNotificationHandler implements Closeable {
                 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;
 
@@ -87,14 +86,14 @@ class ConfigPersisterNotificationListener implements NotificationListener {
         // 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 {
@@ -106,7 +105,7 @@ class ConfigPersisterNotificationListener implements NotificationListener {
         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);
         }
index b346522..b06219c 100644 (file)
@@ -53,7 +53,7 @@ import org.xml.sax.SAXException;
 
 @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;
@@ -83,35 +83,35 @@ public class ConfigPusherImpl implements ConfigPusher {
                  * 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;
     }
 
@@ -133,7 +133,7 @@ public class ConfigPusherImpl implements ConfigPusher {
                 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);
@@ -148,7 +148,7 @@ public class ConfigPusherImpl implements ConfigPusher {
             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();
             }
@@ -187,9 +187,9 @@ public class ConfigPusherImpl implements ConfigPusher {
             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);
         }
@@ -234,7 +234,7 @@ public class ConfigPusherImpl implements ConfigPusher {
         } 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);
 
@@ -244,16 +244,16 @@ public class ConfigPusherImpl implements ConfigPusher {
         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);
     }
index 27f9309..26e4973 100644 (file)
@@ -8,6 +8,9 @@
 
 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;
@@ -15,32 +18,28 @@ import org.opendaylight.controller.config.persist.api.StorageAdapter;
 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");
     }
 }
index 7e68ac1..0c51166 100644 (file)
@@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory;
  *
  */
 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 {
 
@@ -139,7 +139,7 @@ public final class PersisterAggregator implements Persister {
                 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);
     }
 
@@ -147,7 +147,7 @@ public final class PersisterAggregator implements Persister {
     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);
             }
         }
@@ -169,12 +169,12 @@ public final class PersisterAggregator implements Persister {
                 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();
     }
 
@@ -190,7 +190,7 @@ public final class PersisterAggregator implements Persister {
             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 {
index 8e9f997..135d5ff 100644 (file)
@@ -8,13 +8,12 @@
 
 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;
@@ -34,11 +33,9 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
 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";
@@ -57,7 +54,7 @@ public class ConfigPersisterActivator implements BundleActivator {
 
     @Override
     public void start(final BundleContext context) throws Exception {
-        logger.debug("ConfigPersister starting");
+        LOG.debug("ConfigPersister starting");
         this.context = context;
 
         autoCloseables = new ArrayList<>();
@@ -68,7 +65,7 @@ public class ConfigPersisterActivator implements BundleActivator {
         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);
@@ -117,7 +114,7 @@ public class ConfigPersisterActivator implements BundleActivator {
 
         @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 {
@@ -156,15 +153,15 @@ public class ConfigPersisterActivator implements BundleActivator {
 
         @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
@@ -177,12 +174,12 @@ public class ConfigPersisterActivator implements BundleActivator {
                             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) {
index 2a95cca..d73f3b8 100644 (file)
@@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory;
 
 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) {
@@ -28,7 +28,7 @@ public class PropertiesProviderBaseImpl implements PropertiesProvider {
     }
 
     public String getPropertyWithoutPrefix(String fullKey){
-        logger.trace("Full key {}", fullKey);
+        LOG.trace("Full key {}", fullKey);
         return bundleContext.getProperty(fullKey);
     }
 
index 7e9d80a..b22924a 100644 (file)
@@ -7,18 +7,17 @@
  */
 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
index bf031f1..f0cd267 100644 (file)
@@ -8,10 +8,9 @@
 
 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;
@@ -25,8 +24,6 @@ import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification;
 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
index e824b58..792f8cd 100644 (file)
@@ -7,15 +7,14 @@
  */
 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;
index bef1237..e6464f8 100644 (file)
@@ -8,21 +8,6 @@
 
 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;
@@ -31,7 +16,19 @@ import static org.junit.Assert.fail;
 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 {
 
@@ -72,7 +69,7 @@ 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);
@@ -107,7 +104,7 @@ public class PersisterAggregatorTest {
 
     @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);
@@ -118,7 +115,7 @@ public class PersisterAggregatorTest {
     @Test
     public void testFileStorageNumberOfBackups() throws Exception {
         try {
-            PersisterAggregator.createFromProperties(loadFile("test3.properties"));
+            PersisterAggregator.createFromProperties(TestingPropertiesProvider.loadFile("test3.properties"));
             fail();
         } catch (RuntimeException e) {
             assertThat(
index e02e27a..142d8f5 100644 (file)
@@ -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,17 +33,8 @@ import org.slf4j.LoggerFactory;
 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;
@@ -136,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();
index 3e52494..0d866ec 100644 (file)
@@ -13,6 +13,8 @@ import static org.mockito.Matchers.eq;
 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;
@@ -20,7 +22,6 @@ import java.util.Dictionary;
 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;
@@ -38,9 +39,6 @@ import org.osgi.framework.ServiceListener;
 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;
index c814097..fcd39d6 100644 (file)
@@ -19,13 +19,13 @@ import org.slf4j.LoggerFactory;
 
 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;
     }