From dfc4bf9604f126da4ab2adbd3f782371ef18430f Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Fri, 12 May 2017 15:13:20 +0200 Subject: [PATCH] config-persister-impl: final parameters This automatically-generated patch flags all appropriate parameters as final (including caught exceptions). Change-Id: Ib950fb9560113b780898767f03c58edfa022c568 Signed-off-by: Stephen Kitt --- ...pabilityStrippingConfigSnapshotHolder.java | 8 ++-- .../config/persist/impl/ConfigPusherImpl.java | 42 +++++++++---------- .../persist/impl/NoOpStorageAdapter.java | 4 +- .../persist/impl/PersisterAggregator.java | 12 +++--- .../impl/PropertiesProviderAdapterImpl.java | 8 ++-- .../impl/osgi/ConfigPersisterActivator.java | 14 +++---- .../impl/osgi/PropertiesProviderBaseImpl.java | 8 ++-- ...lityStrippingConfigSnapshotHolderTest.java | 4 +- .../persist/impl/ConfigPusherImplTest.java | 4 +- .../config/persist/impl/DummyAdapter.java | 4 +- .../persist/impl/PersisterAggregatorTest.java | 18 ++++---- 11 files changed, 63 insertions(+), 63 deletions(-) diff --git a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/CapabilityStrippingConfigSnapshotHolder.java b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/CapabilityStrippingConfigSnapshotHolder.java index 27948222bc..3d916f60f4 100644 --- a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/CapabilityStrippingConfigSnapshotHolder.java +++ b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/CapabilityStrippingConfigSnapshotHolder.java @@ -33,7 +33,7 @@ public class CapabilityStrippingConfigSnapshotHolder implements ConfigSnapshotHo private final String configSnapshot; private final StripCapabilitiesResult stripCapabilitiesResult; - public CapabilityStrippingConfigSnapshotHolder(Element snapshot, Set capabilities) { + public CapabilityStrippingConfigSnapshotHolder(final Element snapshot, final Set capabilities) { final XmlElement configElement = XmlElement.fromDomElement(snapshot); configSnapshot = XmlUtil.toString(configElement.getDomElement()); stripCapabilitiesResult = stripCapabilities(configElement, capabilities); @@ -43,7 +43,7 @@ public class CapabilityStrippingConfigSnapshotHolder implements ConfigSnapshotHo private final SortedSet requiredCapabilities; private final SortedSet obsoleteCapabilities; - private StripCapabilitiesResult(SortedSet requiredCapabilities, SortedSet obsoleteCapabilities) { + private StripCapabilitiesResult(final SortedSet requiredCapabilities, final SortedSet obsoleteCapabilities) { this.requiredCapabilities = Collections.unmodifiableSortedSet(requiredCapabilities); this.obsoleteCapabilities = Collections.unmodifiableSortedSet(obsoleteCapabilities); } @@ -51,7 +51,7 @@ public class CapabilityStrippingConfigSnapshotHolder implements ConfigSnapshotHo @VisibleForTesting - static StripCapabilitiesResult stripCapabilities(XmlElement configElement, Set allCapabilitiesFromHello) { + static StripCapabilitiesResult stripCapabilities(final XmlElement configElement, final Set allCapabilitiesFromHello) { // collect all namespaces Set foundNamespacesInXML = getNamespaces(configElement); LOG.trace("All capabilities {}\nFound namespaces in XML {}", allCapabilitiesFromHello, foundNamespacesInXML); @@ -74,7 +74,7 @@ public class CapabilityStrippingConfigSnapshotHolder implements ConfigSnapshotHo return new StripCapabilitiesResult(requiredCapabilities, obsoleteCapabilities); } - static Set getNamespaces(XmlElement element){ + static Set getNamespaces(final XmlElement element){ Set result = new HashSet<>(); for (Entry attribute : element.getAttributes().entrySet()) { if (attribute.getKey().startsWith("xmlns")){ diff --git a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/ConfigPusherImpl.java b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/ConfigPusherImpl.java index 6fcc7dcd4d..ae4fb09ddc 100644 --- a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/ConfigPusherImpl.java +++ b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/ConfigPusherImpl.java @@ -58,21 +58,21 @@ public class ConfigPusherImpl implements ConfigPusher { private final ConfigSubsystemFacadeFactory facade; private ConfigPersisterNotificationHandler jmxNotificationHandler; - public ConfigPusherImpl(ConfigSubsystemFacadeFactory facade, long maxWaitForCapabilitiesMillis, - long conflictingVersionTimeoutMillis) { + public ConfigPusherImpl(final ConfigSubsystemFacadeFactory facade, final long maxWaitForCapabilitiesMillis, + final long conflictingVersionTimeoutMillis) { this.maxWaitForCapabilitiesMillis = maxWaitForCapabilitiesMillis; this.conflictingVersionTimeoutMillis = conflictingVersionTimeoutMillis; this.facade = facade; } - public void process(List autoCloseables, MBeanServerConnection platformMBeanServer, - Persister persisterAggregator, boolean propagateExceptions) throws InterruptedException { + public void process(final List autoCloseables, final MBeanServerConnection platformMBeanServer, + final Persister persisterAggregator, final boolean propagateExceptions) throws InterruptedException { while(processSingle(autoCloseables, platformMBeanServer, persisterAggregator, propagateExceptions)) { } } boolean processSingle(final List autoCloseables, final MBeanServerConnection platformMBeanServer, - final Persister persisterAggregator, boolean propagateExceptions) throws InterruptedException { + final Persister persisterAggregator, final boolean propagateExceptions) throws InterruptedException { final List configs = queue.take(); try { internalPushConfigs(configs); @@ -87,7 +87,7 @@ public class ConfigPusherImpl implements ConfigPusher { } LOG.debug("ConfigPusher has pushed configs {}", configs); - } catch (Exception e) { + } catch (final Exception e) { // Exceptions are logged to error downstream LOG.debug("Failed to push some of configs: {}", configs, e); @@ -106,12 +106,12 @@ public class ConfigPusherImpl implements ConfigPusher { } @Override - public void pushConfigs(List configs) throws InterruptedException { + public void pushConfigs(final List configs) throws InterruptedException { LOG.debug("Requested to push configs {}", configs); this.queue.put(configs); } - private LinkedHashMap internalPushConfigs(List configs) + private LinkedHashMap internalPushConfigs(final List configs) throws DocumentedException { LOG.debug("Last config snapshots to be pushed to netconf: {}", configs); LinkedHashMap result = new LinkedHashMap<>(); @@ -122,11 +122,11 @@ public class ConfigPusherImpl implements ConfigPusher { boolean pushResult = false; try { pushResult = pushConfigWithConflictingVersionRetries(configSnapshotHolder); - } catch (ConfigSnapshotFailureException e) { + } catch (final ConfigSnapshotFailureException e) { LOG.error("Failed to apply configuration snapshot: {}. Config snapshot is not semantically correct and will be IGNORED. " + "for detailed information see enclosed exception.", e.getConfigIdForReporting(), e); throw new IllegalStateException("Failed to apply configuration snapshot " + e.getConfigIdForReporting(), e); - } catch (Exception e) { + } catch (final Exception e) { String msg = String.format("Failed to apply configuration snapshot: %s", configSnapshotHolder); LOG.error(msg, e); throw new IllegalStateException(msg, e); @@ -140,7 +140,7 @@ public class ConfigPusherImpl implements ConfigPusher { return result; } - private synchronized boolean pushConfigWithConflictingVersionRetries(ConfigSnapshotHolder configSnapshotHolder) throws ConfigSnapshotFailureException { + private synchronized boolean pushConfigWithConflictingVersionRetries(final ConfigSnapshotHolder configSnapshotHolder) throws ConfigSnapshotFailureException { ConflictingVersionException lastException; Stopwatch stopwatch = Stopwatch.createUnstarted(); do { @@ -157,7 +157,7 @@ public class ConfigPusherImpl implements ConfigPusher { stopwatch.start(); } return pushConfig(configSnapshotHolder); - } catch (ConflictingVersionException e) { + } catch (final ConflictingVersionException e) { lastException = e; LOG.info("Conflicting version detected, will retry after timeout"); sleep(); @@ -167,7 +167,7 @@ public class ConfigPusherImpl implements ConfigPusher { lastException); } - private void waitForCapabilities(Set expectedCapabilities, String idForReporting) { + private void waitForCapabilities(final Set expectedCapabilities, final String idForReporting) { Stopwatch stopwatch = Stopwatch.createStarted(); ConfigPusherException lastException; do { @@ -184,7 +184,7 @@ public class ConfigPusherImpl implements ConfigPusher { throw new NotEnoughCapabilitiesException( "Not enough capabilities for " + idForReporting + ". Expected but not found: " + notFoundCapabilities, notFoundCapabilities); } - } catch (ConfigPusherException e) { + } catch (final ConfigPusherException e) { LOG.debug("Not enough capabilities: {}", e.toString()); lastException = e; sleep(); @@ -204,7 +204,7 @@ public class ConfigPusherImpl implements ConfigPusher { + ((NotEnoughCapabilitiesException) lastException).getMissingCaps(), lastException); } - private static Set computeNotFoundCapabilities(Set expectedCapabilities, Set currentCapabilities) { + private static Set computeNotFoundCapabilities(final Set expectedCapabilities, final Set currentCapabilities) { Collection actual = transformCapabilities(currentCapabilities); Set allNotFound = new HashSet<>(expectedCapabilities); allNotFound.removeAll(actual); @@ -235,7 +235,7 @@ public class ConfigPusherImpl implements ConfigPusher { private static final long serialVersionUID = 1L; private final Set missingCaps; - NotEnoughCapabilitiesException(String message, Set missingCaps) { + NotEnoughCapabilitiesException(final String message, final Set missingCaps) { super(message); this.missingCaps = missingCaps; } @@ -262,13 +262,13 @@ public class ConfigPusherImpl implements ConfigPusher { private void sleep() { try { Thread.sleep(100); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException(e); } } - private synchronized boolean pushConfig(ConfigSnapshotHolder configSnapshotHolder) throws ConfigSnapshotFailureException, ConflictingVersionException { + private synchronized boolean pushConfig(final ConfigSnapshotHolder configSnapshotHolder) throws ConfigSnapshotFailureException, ConflictingVersionException { Element xmlToBePersisted; try { xmlToBePersisted = XmlUtil.readXmlToElement(configSnapshotHolder.getConfigSnapshot()); @@ -299,7 +299,7 @@ public class ConfigPusherImpl implements ConfigPusher { return true; } - private void executeWithMissingModuleFactoryRetries(ConfigSubsystemFacade facade, ConfigExecution configExecution) + private void executeWithMissingModuleFactoryRetries(final ConfigSubsystemFacade facade, final ConfigExecution configExecution) throws DocumentedException, ValidationException, ModuleFactoryNotFoundException { Stopwatch stopwatch = Stopwatch.createStarted(); ModuleFactoryNotFoundException lastException = null; @@ -307,7 +307,7 @@ public class ConfigPusherImpl implements ConfigPusher { try { facade.executeConfigExecution(configExecution); return; - } catch (ModuleFactoryNotFoundException e) { + } catch (final ModuleFactoryNotFoundException e) { LOG.debug("{} - will retry after timeout", e.toString()); lastException = e; sleep(); @@ -317,7 +317,7 @@ public class ConfigPusherImpl implements ConfigPusher { throw lastException; } - private ConfigExecution createConfigExecution(Element xmlToBePersisted, final ConfigSubsystemFacade currentFacade) throws DocumentedException { + private ConfigExecution createConfigExecution(final Element xmlToBePersisted, final ConfigSubsystemFacade currentFacade) throws DocumentedException { final Config configMapping = currentFacade.getConfigMapping(); return currentFacade.getConfigExecution(configMapping, xmlToBePersisted); } diff --git a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/NoOpStorageAdapter.java b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/NoOpStorageAdapter.java index a558601cd1..c8f48d7fc3 100644 --- a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/NoOpStorageAdapter.java +++ b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/NoOpStorageAdapter.java @@ -22,13 +22,13 @@ public class NoOpStorageAdapter implements StorageAdapter, Persister { private static final Logger LOG = LoggerFactory.getLogger(NoOpStorageAdapter.class); @Override - public Persister instantiate(PropertiesProvider propertiesProvider) { + public Persister instantiate(final PropertiesProvider propertiesProvider) { LOG.debug("instantiate called with {}", propertiesProvider); return this; } @Override - public void persistConfig(ConfigSnapshotHolder holder) throws IOException { + public void persistConfig(final ConfigSnapshotHolder holder) throws IOException { LOG.debug("persistConfig called with {}", holder); } diff --git a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/PersisterAggregator.java b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/PersisterAggregator.java index ebe9982153..8926b4ce61 100644 --- a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/PersisterAggregator.java +++ b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/PersisterAggregator.java @@ -63,7 +63,7 @@ public final class PersisterAggregator implements Persister { private final Persister storage; private final boolean readOnly; - public PersisterWithConfiguration(Persister storage, boolean readOnly) { + public PersisterWithConfiguration(final Persister storage, final boolean readOnly) { this.storage = storage; this.readOnly = readOnly; } @@ -92,7 +92,7 @@ public final class PersisterAggregator implements Persister { */ private final List persisterWithConfigurations; - public PersisterAggregator(List persisterWithConfigurations) { + public PersisterAggregator(final List persisterWithConfigurations) { this.persisterWithConfigurations = persisterWithConfigurations; } @@ -126,7 +126,7 @@ public final class PersisterAggregator implements Persister { } } - public static PersisterAggregator createFromProperties(PropertiesProvider propertiesProvider) { + public static PersisterAggregator createFromProperties(final PropertiesProvider propertiesProvider) { List persisterWithConfigurations = new ArrayList<>(); String prefixes = propertiesProvider.getProperty("active"); if (prefixes!=null && !prefixes.isEmpty()) { @@ -140,7 +140,7 @@ public final class PersisterAggregator implements Persister { } @Override - public void persistConfig(ConfigSnapshotHolder holder) throws IOException { + public void persistConfig(final ConfigSnapshotHolder holder) throws IOException { for (PersisterWithConfiguration persisterWithConfiguration: persisterWithConfigurations){ if (!persisterWithConfiguration.readOnly){ LOG.debug("Calling {}.persistConfig", persisterWithConfiguration.getStorage()); @@ -161,7 +161,7 @@ public final class PersisterAggregator implements Persister { List configs = null; try { configs = persisterWithConfiguration.storage.loadLastConfigs(); - } catch (IOException e) { + } catch (final IOException e) { throw new RuntimeException("Error while calling loadLastConfig on " + persisterWithConfiguration, e); } if (!configs.isEmpty()) { @@ -185,7 +185,7 @@ public final class PersisterAggregator implements Persister { for (PersisterWithConfiguration persisterWithConfiguration: persisterWithConfigurations){ try{ persisterWithConfiguration.storage.close(); - }catch(RuntimeException e) { + }catch(final RuntimeException e) { LOG.error("Error while closing {}", persisterWithConfiguration.storage, e); if (lastException == null){ lastException = e; diff --git a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/PropertiesProviderAdapterImpl.java b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/PropertiesProviderAdapterImpl.java index 2ac059bb09..acef56ff1a 100644 --- a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/PropertiesProviderAdapterImpl.java +++ b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/PropertiesProviderAdapterImpl.java @@ -13,13 +13,13 @@ public class PropertiesProviderAdapterImpl implements PropertiesProvider { private final PropertiesProvider inner; private final String index; - public PropertiesProviderAdapterImpl(PropertiesProvider inner, String index) { + public PropertiesProviderAdapterImpl(final PropertiesProvider inner, final String index) { this.inner = inner; this.index = index; } @Override - public String getProperty(String key) { + public String getProperty(final String key) { String fullKey = getFullKeyForReporting(key); return inner.getPropertyWithoutPrefix(fullKey); } @@ -29,13 +29,13 @@ public class PropertiesProviderAdapterImpl implements PropertiesProvider { } @Override - public String getPropertyWithoutPrefix(String fullKey) { + public String getPropertyWithoutPrefix(final String fullKey) { return inner.getPropertyWithoutPrefix(fullKey); } @Override - public String getFullKeyForReporting(String key) { + public String getFullKeyForReporting(final String key) { return getPrefix() + "." + key; } } diff --git a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/osgi/ConfigPersisterActivator.java b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/osgi/ConfigPersisterActivator.java index c67522e97f..412309bdf6 100644 --- a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/osgi/ConfigPersisterActivator.java +++ b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/osgi/ConfigPersisterActivator.java @@ -65,7 +65,7 @@ public class ConfigPersisterActivator implements BundleActivator { ServiceTrackerCustomizer schemaServiceTrackerCustomizer = new ServiceTrackerCustomizer() { @Override - public ConfigSubsystemFacadeFactory addingService(ServiceReference reference) { + public ConfigSubsystemFacadeFactory addingService(final ServiceReference reference) { LOG.debug("Got addingService(SchemaContextProvider) event"); // Yang store service should not be registered multiple times ConfigSubsystemFacadeFactory configSubsystemFacadeFactory = reference.getBundle().getBundleContext().getService(reference); @@ -74,12 +74,12 @@ public class ConfigPersisterActivator implements BundleActivator { } @Override - public void modifiedService(ServiceReference reference, ConfigSubsystemFacadeFactory service) { + public void modifiedService(final ServiceReference reference, final ConfigSubsystemFacadeFactory service) { LOG.warn("Config manager facade was modified unexpectedly"); } @Override - public void removedService(ServiceReference reference, ConfigSubsystemFacadeFactory service) { + public void removedService(final ServiceReference reference, final ConfigSubsystemFacadeFactory service) { LOG.warn("Config manager facade was removed unexpectedly"); } }; @@ -89,18 +89,18 @@ public class ConfigPersisterActivator implements BundleActivator { schemaContextProviderServiceTracker.open(); } - private long getConflictingVersionTimeoutMillis(PropertiesProviderBaseImpl propertiesProvider) { + private long getConflictingVersionTimeoutMillis(final PropertiesProviderBaseImpl propertiesProvider) { String timeoutProperty = propertiesProvider.getProperty(CONFLICTING_VERSION_TIMEOUT_MILLIS_PROPERTY); return timeoutProperty == null ? CONFLICTING_VERSION_TIMEOUT_MILLIS_DEFAULT : Long.valueOf(timeoutProperty); } - private long getMaxWaitForCapabilitiesMillis(PropertiesProviderBaseImpl propertiesProvider) { + private long getMaxWaitForCapabilitiesMillis(final PropertiesProviderBaseImpl propertiesProvider) { String timeoutProperty = propertiesProvider.getProperty(MAX_WAIT_FOR_CAPABILITIES_MILLIS_PROPERTY); return timeoutProperty == null ? MAX_WAIT_FOR_CAPABILITIES_MILLIS_DEFAULT : Long.valueOf(timeoutProperty); } @Override - public void stop(BundleContext context) throws Exception { + public void stop(final BundleContext context) throws Exception { synchronized(autoCloseables) { CloseableUtil.closeAll(autoCloseables); autoCloseables.clear(); @@ -132,7 +132,7 @@ public class ConfigPersisterActivator implements BundleActivator { } else { LOG.warn("Unable to process configs as BundleContext is null"); } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { LOG.info("ConfigPusher thread stopped"); } LOG.info("Configuration Persister initialization completed."); diff --git a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/osgi/PropertiesProviderBaseImpl.java b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/osgi/PropertiesProviderBaseImpl.java index 5ad31e8780..5a5f7e77b5 100644 --- a/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/osgi/PropertiesProviderBaseImpl.java +++ b/opendaylight/config/config-persister-impl/src/main/java/org/opendaylight/controller/config/persist/impl/osgi/PropertiesProviderBaseImpl.java @@ -17,17 +17,17 @@ public class PropertiesProviderBaseImpl implements PropertiesProvider { private static final Logger LOG = LoggerFactory.getLogger(PropertiesProviderBaseImpl.class); private final BundleContext bundleContext; - public PropertiesProviderBaseImpl(BundleContext bundleContext) { + public PropertiesProviderBaseImpl(final BundleContext bundleContext) { this.bundleContext = bundleContext; } @Override - public String getProperty(String key) { + public String getProperty(final String key) { String fullKey = getFullKeyForReporting(key); return getPropertyWithoutPrefix(fullKey); } - public String getPropertyWithoutPrefix(String fullKey){ + public String getPropertyWithoutPrefix(final String fullKey){ LOG.trace("Full key {}", fullKey); return bundleContext.getProperty(fullKey); } @@ -37,7 +37,7 @@ public class PropertiesProviderBaseImpl implements PropertiesProvider { } @Override - public String getFullKeyForReporting(String key) { + public String getFullKeyForReporting(final String key) { return getPrefix() + "." + key; } } diff --git a/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/CapabilityStrippingConfigSnapshotHolderTest.java b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/CapabilityStrippingConfigSnapshotHolderTest.java index 970805e1ef..2a20939ba7 100644 --- a/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/CapabilityStrippingConfigSnapshotHolderTest.java +++ b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/CapabilityStrippingConfigSnapshotHolderTest.java @@ -36,11 +36,11 @@ public class CapabilityStrippingConfigSnapshotHolderTest { assertEquals(obsoleteCapabilities, tested.getObsoleteCapabilities()); } - private Set readLines(String fileName) throws IOException { + private Set readLines(final String fileName) throws IOException { return new HashSet<>(Resources.readLines(getClass().getResource(fileName), StandardCharsets.UTF_8)); } - private String readToString(String fileName) throws IOException { + private String readToString(final String fileName) throws IOException { return Resources.toString(getClass().getResource(fileName), StandardCharsets.UTF_8); } diff --git a/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/ConfigPusherImplTest.java b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/ConfigPusherImplTest.java index 8bfb3d73b9..bfb606e9ac 100644 --- a/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/ConfigPusherImplTest.java +++ b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/ConfigPusherImplTest.java @@ -93,7 +93,7 @@ public class ConfigPusherImplTest { try { configPusher.process(Lists.newArrayList(), ManagementFactory.getPlatformMBeanServer(), mockedAggregator, true); - } catch(IllegalStateException e) { + } catch(final IllegalStateException e) { Throwable cause = Throwables.getRootCause(e); assertTrue(cause instanceof ConfigPusherImpl.NotEnoughCapabilitiesException); final Set missingCaps = ((ConfigPusherImpl.NotEnoughCapabilitiesException) cause).getMissingCaps(); @@ -145,7 +145,7 @@ public class ConfigPusherImplTest { configPusher.pushConfigs(Collections.singletonList(mockedConfigSnapshot)); try { configPusher.processSingle(Lists.newArrayList(), mBeanServer, mockedAggregator, true); - } catch (IllegalStateException e) { + } catch (final IllegalStateException e) { Throwable cause = Throwables.getRootCause(e); assertTrue(cause instanceof ConflictingVersionException); return; diff --git a/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/DummyAdapter.java b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/DummyAdapter.java index a11129035e..9984b143db 100644 --- a/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/DummyAdapter.java +++ b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/DummyAdapter.java @@ -20,7 +20,7 @@ public class DummyAdapter implements StorageAdapter, Persister { static int persist = 0; @Override - public void persistConfig(ConfigSnapshotHolder holder) throws IOException { + public void persistConfig(final ConfigSnapshotHolder holder) throws IOException { persist++; } @@ -35,7 +35,7 @@ public class DummyAdapter implements StorageAdapter, Persister { static int props = 0; @Override - public Persister instantiate(PropertiesProvider propertiesProvider) { + public Persister instantiate(final PropertiesProvider propertiesProvider) { props++; return this; } diff --git a/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/PersisterAggregatorTest.java b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/PersisterAggregatorTest.java index cf183b8f3d..f17626783d 100644 --- a/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/PersisterAggregatorTest.java +++ b/opendaylight/config/config-persister-impl/src/test/java/org/opendaylight/controller/config/persist/impl/PersisterAggregatorTest.java @@ -38,33 +38,33 @@ public class PersisterAggregatorTest { private final Properties prop; - public TestingPropertiesProvider(Properties prop) { + public TestingPropertiesProvider(final Properties prop) { super(null); this.prop = prop; } - public static TestingPropertiesProvider loadFile(String fileName) { + public static TestingPropertiesProvider loadFile(final String fileName) { Properties prop = new Properties(); try { prop.load(TestingPropertiesProvider.class.getClassLoader().getResourceAsStream(fileName)); - } catch (IOException e) { + } catch (final IOException e) { throw new RuntimeException(e); } return new TestingPropertiesProvider(prop); } @Override - public String getFullKeyForReporting(String key) { + public String getFullKeyForReporting(final String key) { return ConfigPersisterActivator.NETCONF_CONFIG_PERSISTER + "." + key; } @Override - public String getProperty(String key) { + public String getProperty(final String key) { return prop.getProperty(getFullKeyForReporting(key)); } @Override - public String getPropertyWithoutPrefix(String fullKey){ + public String getPropertyWithoutPrefix(final String fullKey){ return prop.getProperty(fullKey); } } @@ -127,20 +127,20 @@ public class PersisterAggregatorTest { try { PersisterAggregator.createFromProperties(TestingPropertiesProvider.loadFile("test3.properties")); fail(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { assertThat( e.getMessage(), containsString("numberOfBackups property should be either set to positive value, or ommited. Can not be set to 0.")); } } - private ConfigSnapshotHolder mockHolder(String name){ + private ConfigSnapshotHolder mockHolder(final String name){ ConfigSnapshotHolder result = mock(ConfigSnapshotHolder.class); doReturn("mock:" + name).when(result).toString(); return result; } - private Persister mockPersister(String name){ + private Persister mockPersister(final String name){ Persister result = mock(Persister.class); doReturn("mock:" + name).when(result).toString(); doNothing().when(result).close(); -- 2.36.6