Bug 8153: Enforce check-style rules for netconf - yanglib 51/56351/4
authormatus.kubica <matus.kubica@pantheon.tech>
Tue, 2 May 2017 07:54:31 +0000 (09:54 +0200)
committerMatúš Kubica <Matus.Kubica@pantheon.tech>
Wed, 10 May 2017 08:38:41 +0000 (08:38 +0000)
    Organize Imports for Checkstyle compliance.
    Checkstyle compliance: line length.
    Checkstyle compliance: various types of small changes.
    Checkstyle compliant Exception handling.
    Checkstyle final clean up & enforcement.
    Add the fail on violation flag into the pom.xml .

Change-Id: I841ed5ba3ba57f91e18a82015c7582195cec5562
Signed-off-by: matus.kubica <matus.kubica@pantheon.tech>
netconf/yanglib/src/main/java/org/opendaylight/controller/config/yang/yanglib/impl/YanglibModule.java
netconf/yanglib/src/main/java/org/opendaylight/controller/config/yang/yanglib/impl/YanglibModuleFactory.java
netconf/yanglib/src/main/java/org/opendaylight/yanglib/api/YangLibRestAppService.java
netconf/yanglib/src/main/java/org/opendaylight/yanglib/api/YangLibService.java
netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java
netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibServiceImpl.java
netconf/yanglib/src/test/java/org/opendaylight/yanglib/impl/YangLibProviderTest.java
netconf/yanglib/src/test/java/org/opendaylight/yanglib/impl/YangLibRestAppTest.java
netconf/yanglib/src/test/java/org/opendaylight/yanglib/impl/YangLibServiceImplTest.java

index 23a73a0bbebd52e603bbcdf084b13961718e7944..6a3b02ec5780ae98d0e23506157514d8af35bdb4 100644 (file)
@@ -20,11 +20,15 @@ import org.slf4j.LoggerFactory;
 public class YanglibModule extends org.opendaylight.controller.config.yang.yanglib.impl.AbstractYanglibModule {
     private static final Logger LOG = LoggerFactory.getLogger(YanglibModule.class);
 
-    public YanglibModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public YanglibModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+                         org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public YanglibModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.yanglib.impl.YanglibModule oldModule, java.lang.AutoCloseable oldInstance) {
+    public YanglibModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+                         org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+                         org.opendaylight.controller.config.yang.yanglib.impl.YanglibModule oldModule,
+                         java.lang.AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
index 7273f3209f60d43d9cbff28e4ab4a503d696206b..0d2de77bf329e893e94fa9ab04da858cc7dd6226 100644 (file)
@@ -15,6 +15,7 @@
 * Do not modify this file unless it is present under src/main directory
 */
 package org.opendaylight.controller.config.yang.yanglib.impl;
-public class YanglibModuleFactory extends org.opendaylight.controller.config.yang.yanglib.impl.AbstractYanglibModuleFactory {
+public class YanglibModuleFactory
+        extends org.opendaylight.controller.config.yang.yanglib.impl.AbstractYanglibModuleFactory {
 
 }
index 2f57145c668deb59970a4c5d603b1be3a15b5d17..cf60e053e9471de995e9d7ccf1c2e1a3c293898d 100644 (file)
@@ -18,7 +18,7 @@ public interface YangLibRestAppService {
 
     /**
      * Get {@link YangLibServiceImpl} via service.
-     * @return
+     * @return YangLibServiceImpl
      */
     YangLibServiceImpl getYangLibService();
 }
index d578813d416fd4abd862b602feb31643cc79fd20..5ae0853584ece7b5d3dd174f367b1fdf93ca1132 100644 (file)
@@ -20,7 +20,7 @@ import javax.ws.rs.Produces;
 public interface YangLibService {
 
     /**
-     * Get module's source for each module from yang library
+     * Get module's source for each module from yang library.
      * @param name Module's name
      * @param revision Module's revision
      * @return Module's source
index 14231dbc0bdfaded2a80621500d156cb56867ae2..2a9e17fea7cd7fd0394fe9bfb07dde831ddd966d 100644 (file)
@@ -51,12 +51,12 @@ import org.slf4j.LoggerFactory;
  * along with source identifier to
  * ietf-netconf-yang-library/modules-state/module list.
  */
-public class YangLibProvider implements BindingAwareProvider, AutoCloseable, SchemaSourceListener{
+public class YangLibProvider implements BindingAwareProvider, AutoCloseable, SchemaSourceListener {
     private static final Logger LOG = LoggerFactory.getLogger(YangLibProvider.class);
 
     private static final OptionalRevision NO_REVISION = new OptionalRevision("");
     private static final Predicate<PotentialSchemaSource<?>> YANG_SCHEMA_SOURCE =
-            input -> YangTextSchemaSource.class.isAssignableFrom(input.getRepresentation());
+        input -> YangTextSchemaSource.class.isAssignableFrom(input.getRepresentation());
 
     protected DataBroker dataBroker;
     protected SchemaListenerRegistration schemaListenerRegistration;
@@ -94,7 +94,7 @@ public class YangLibProvider implements BindingAwareProvider, AutoCloseable, Sch
     public void schemaSourceRegistered(final Iterable<PotentialSchemaSource<?>> sources) {
         final List<Module> newModules = new ArrayList<>();
 
-        for(PotentialSchemaSource<?> potentialYangSource : Iterables.filter(sources, YANG_SCHEMA_SOURCE)) {
+        for (PotentialSchemaSource<?> potentialYangSource : Iterables.filter(sources, YANG_SCHEMA_SOURCE)) {
             final YangIdentifier moduleName = new YangIdentifier(potentialYangSource.getSourceIdentifier().getName());
 
             final OptionalRevision moduleRevision = getRevisionForModule(potentialYangSource.getSourceIdentifier());
@@ -108,7 +108,7 @@ public class YangLibProvider implements BindingAwareProvider, AutoCloseable, Sch
             newModules.add(newModule);
         }
 
-        if(newModules.isEmpty()) {
+        if (newModules.isEmpty()) {
             // If no new yang modules then do nothing
             return;
         }
@@ -124,15 +124,15 @@ public class YangLibProvider implements BindingAwareProvider, AutoCloseable, Sch
             }
 
             @Override
-            public void onFailure(final Throwable t) {
-                LOG.warn("Unable to update modules state", t);
+            public void onFailure(final Throwable throwable) {
+                LOG.warn("Unable to update modules state", throwable);
             }
         });
     }
 
     @Override
     public void schemaSourceUnregistered(final PotentialSchemaSource<?> source) {
-        if(!YANG_SCHEMA_SOURCE.apply(source)) {
+        if (!YANG_SCHEMA_SOURCE.apply(source)) {
             // if representation of potential schema source is not yang text schema source do nothing
             // we do not want to delete this module entry from module list
             return;
@@ -153,8 +153,8 @@ public class YangLibProvider implements BindingAwareProvider, AutoCloseable, Sch
             }
 
             @Override
-            public void onFailure(final Throwable t) {
-                LOG.warn("Unable to update modules state", t);
+            public void onFailure(final Throwable throwable) {
+                LOG.warn("Unable to update modules state", throwable);
             }
         });
     }
index f867971aea5051b9ba984025c48e687b2c6fe434..bf8b04ceb08c3c138091ff935b725e576bf24226 100644 (file)
@@ -23,7 +23,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Provides schema sources from yang library
+ * Provides schema sources from yang library.
  */
 public class YangLibServiceImpl implements YangLibService {
     private static final Logger LOG = LoggerFactory.getLogger(YangLibServiceImpl.class);
@@ -52,7 +52,7 @@ public class YangLibServiceImpl implements YangLibService {
         try {
             final YangTextSchemaSource source = sourceFuture.checkedGet();
             return new String(ByteStreams.toByteArray(source.openStream()));
-        } catch (SchemaSourceException|IOException e) {
+        } catch (SchemaSourceException | IOException e) {
             throw new IllegalStateException("Unable to get schema" + sourceId, e);
         }
     }
index fcd65cc0a909a0ececc15c98db99284c7fa0921d..516767165f0212d9be9930091a9daecd18f4bd3a 100644 (file)
@@ -216,7 +216,8 @@ public class YangLibProviderTest {
 
     private static class TestingYangLibProvider extends YangLibProvider {
 
-        public TestingYangLibProvider(SharedSchemaRepository schemaRepository, String bindingAddress, long bindingPort) {
+        TestingYangLibProvider(
+                SharedSchemaRepository schemaRepository, String bindingAddress, long bindingPort) {
             super(schemaRepository, bindingAddress, bindingPort);
         }
 
index 6a80b04577a263bc411f53874f60b09fc9723e00..62b81599db10ba7911872e0aeedb4e953cfd5f47 100644 (file)
@@ -46,6 +46,7 @@ public class YangLibRestAppTest {
 
         assertTrue(singleton.contains(yangLibRestApp.getYangLibService()));
 
-        then(bundleContext).should(times(1)).registerService(eq(YangLibRestAppService.class.getName()), eq(yangLibRestApp), eq(null));
+        then(bundleContext).should(times(1))
+                .registerService(eq(YangLibRestAppService.class.getName()), eq(yangLibRestApp), eq(null));
     }
 }
index add8d67e699f9868c69b729fdfc624265ec2c0b3..ab1b55210ef24aba15538c347aad24f54296d199 100644 (file)
@@ -29,7 +29,7 @@ import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 
 public class YangLibServiceImplTest {
 
-    private final static String TEST_OUTPUT_STRING = "hello world";
+    private static final String TEST_OUTPUT_STRING = "hello world";
 
     @Test
     public void testSchema() throws SchemaSourceException {