Enable checkstyle on objectcache and mockito-config 84/58284/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 5 Jun 2017 21:12:41 +0000 (23:12 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 5 Jun 2017 21:42:14 +0000 (23:42 +0200)
Just a few fixes and flip the switch.

Change-Id: I83d8b9b4e959e03a912d2cbf4c3c26311af4fc0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
common/mockito-configuration/pom.xml
common/mockito-configuration/src/main/java/org/mockito/configuration/ArgumentsExtractorVerifier.java
common/object-cache-api/pom.xml
common/object-cache-api/src/main/java/org/opendaylight/yangtools/objcache/ObjectCache.java
common/object-cache-api/src/main/java/org/opendaylight/yangtools/objcache/ObjectCacheFactory.java
common/object-cache-api/src/main/java/org/opendaylight/yangtools/objcache/spi/AbstractObjectCache.java
common/object-cache-api/src/test/java/org/opendaylight/yangtools/objcache/spi/CacheTest.java
common/object-cache-api/src/test/java/org/opendaylight/yangtools/objcache/spi/SoftKeyTest.java
common/object-cache-guava/pom.xml
common/object-cache-guava/src/main/java/org/opendaylight/yangtools/objcache/guava/GuavaObjectCache.java
common/object-cache-noop/pom.xml

index 5c3833620cd8777747b8b8170e9ef78341087eec..4bb8e13167bb44e4569d9155768cd755ad18bcbf 100644 (file)
         </dependency>
     </dependencies>
 
-  <!--
-      Maven Site Configuration
-
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
-
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                                       <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <!--
+        Maven Site Configuration
+
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+
+    <distributionManagement>
+        <site>
+            <id>opendaylight-site</id>
+            <url>${nexus.site.url}/${project.artifactId}/</url>
+        </site>
+    </distributionManagement>
 </project>
index d8983f40fbac5062cf694e36f2f12c92b122d1e5..ffc4a5d4865794527300fc8062aff54232ebc71a 100644 (file)
@@ -25,13 +25,15 @@ public class ArgumentsExtractorVerifier implements VerificationMode {
         InvocationsFinder finder = new InvocationsFinder();
         List<Invocation> actualInvocations = finder.findInvocations(data.getAllInvocations(), data.getWanted());
         if (actualInvocations.size() != 1) {
-            throw new MockitoException("This verifier can only be used with 1 invocation, got " + actualInvocations.size());
+            throw new MockitoException("This verifier can only be used with 1 invocation, got "
+                    + actualInvocations.size());
         }
         Invocation invocation = actualInvocations.get(0);
         arguments = invocation.getArguments();
         invocation.markVerified();
 
     }
+
     public Object[] getArguments() {
         return arguments;
     }
index d0b08ce586e8be6e4f0bcb33abe5c3c1ffd39e5d..9b37956f15a6ebbe3a50b56a4cbde71438c25fbc 100644 (file)
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                                       <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
-  <!--
-      Maven Site Configuration
+    <!--
+        Maven Site Configuration
 
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
 
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+    <distributionManagement>
+        <site>
+            <id>opendaylight-site</id>
+            <url>${nexus.site.url}/${project.artifactId}/</url>
+        </site>
+    </distributionManagement>
 </project>
index 4e275924248252ac351f971dcc026f1b4d93337e..6390abcf86205b3978ea48f95c0ecbb28bbc2b8b 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.yangtools.concepts.ProductAwareBuilder;
  * indexes and spend some CPU cycles on walking the index to potentially
  * end up with a reused object.
  *
+ * <p>
  * Note that the cached objects should really be semantically {@link Immutable}.
  * This interface does not enforce that interface contract simply because
  * there are third-party objects which fulfill this contract.
index 30edbf4d01983543e6af8aa2633db8e3c9085000..ac9087a899ca17b92e4d8d7132454cb07655f875 100644 (file)
@@ -27,19 +27,19 @@ public final class ObjectCacheFactory {
     @GuardedBy("this")
     private static synchronized IObjectCacheFactory initialize() {
         // Double-check under lock
-        IObjectCacheFactory f = factory;
-        if (f != null) {
-            return f;
+        IObjectCacheFactory fa = factory;
+        if (fa != null) {
+            return fa;
         }
 
         try {
-            f = StaticObjectCacheBinder.getInstance().getProductCacheFactory();
-            factory = f;
+            fa = StaticObjectCacheBinder.getInstance().getProductCacheFactory();
+            factory = fa;
         } catch (NoClassDefFoundError e) {
-            f = NoopObjectCacheBinder.INSTANCE.getProductCacheFactory();
+            fa = NoopObjectCacheBinder.INSTANCE.getProductCacheFactory();
         }
 
-        return f;
+        return fa;
     }
 
     public static synchronized void reset() {
@@ -54,11 +54,11 @@ public final class ObjectCacheFactory {
      * @return Object cache instance.
      */
     public static ObjectCache getObjectCache(@Nonnull final Class<?> objClass) {
-        IObjectCacheFactory f = factory;
-        if (f == null) {
-            f = initialize();
+        IObjectCacheFactory fa = factory;
+        if (fa == null) {
+            fa = initialize();
         }
 
-        return f.getObjectCache(Preconditions.checkNotNull(objClass));
+        return fa.getObjectCache(Preconditions.checkNotNull(objClass));
     }
 }
index 71eb2ca184f5b8fcdc3d10c5bf634ec27530c5fc..0bced73ded4fa853dca9c0f69bdb19a4f007a748 100644 (file)
@@ -64,9 +64,11 @@ public abstract class AbstractObjectCache implements ObjectCache {
      * Key used in the underlying map. It is essentially a soft reference, with
      * slightly special properties.
      *
+     * <p>
      * It acts as a proxy for the object it refers to and essentially delegates
      * to it. There are three exceptions here:
      *
+     * <p>
      * 1) This key needs to have a cached hash code. The requirement is that the
      *    key needs to be able to look itself up after the reference to the object
      *    has been cleared (and thus we can no longer look it up from there). One
index 9b7fb55efd1c6de1994e239533c6ce87e816c8f2..57f835f9ff158486f2b7634ba1943c9abef59308 100644 (file)
@@ -11,14 +11,13 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 
+import com.google.common.base.FinalizableReferenceQueue;
+import com.google.common.cache.CacheBuilder;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.objcache.ObjectCache;
 
-import com.google.common.base.FinalizableReferenceQueue;
-import com.google.common.cache.CacheBuilder;
-
 public class CacheTest {
     private FinalizableReferenceQueue queue;
     private ObjectCache oc;
index dc16f77e92a5e280880254b7cce20d562127bcc9..3caaf65220524d73029243616fe619275f55a520 100644 (file)
@@ -13,13 +13,12 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
+import com.google.common.base.FinalizableReferenceQueue;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.objcache.spi.AbstractObjectCache.SoftKey;
 
-import com.google.common.base.FinalizableReferenceQueue;
-
 public class SoftKeyTest {
     private FinalizableReferenceQueue queue;
 
index 06cd0781488014d56dc66245f6fd9a37be3b49a9..e3bcb1edcd64e574f3b932f0f1ea1db236add252 100644 (file)
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                                       <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
-  <!--
-      Maven Site Configuration
+    <!--
+        Maven Site Configuration
 
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
 
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+    <distributionManagement>
+        <site>
+            <id>opendaylight-site</id>
+            <url>${nexus.site.url}/${project.artifactId}/</url>
+        </site>
+    </distributionManagement>
 </project>
index 5d0e2589ef9f785c147c35f502d82083ead0865f..6ee1a274f37bf99e1a625c95facf54a6bc1eed7a 100644 (file)
@@ -7,18 +7,17 @@
  */
 package org.opendaylight.yangtools.objcache.guava;
 
-import org.opendaylight.yangtools.objcache.spi.AbstractObjectCache;
-
 import com.google.common.base.FinalizableReferenceQueue;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheBuilderSpec;
+import org.opendaylight.yangtools.objcache.spi.AbstractObjectCache;
 
 final class GuavaObjectCache extends AbstractObjectCache {
-    public GuavaObjectCache(final FinalizableReferenceQueue  queue) {
+    GuavaObjectCache(final FinalizableReferenceQueue  queue) {
         super(CacheBuilder.newBuilder().softValues().build(), queue);
     }
 
-    public GuavaObjectCache(final FinalizableReferenceQueue  queue, final CacheBuilderSpec spec) {
+    GuavaObjectCache(final FinalizableReferenceQueue  queue, final CacheBuilderSpec spec) {
         super(CacheBuilder.from(spec).build(), queue);
     }
 }
index 58d8cf0297dc821d8d7e10a27a3192e657f341ee..9ffa0fe38cfa2b1972e3db8ca2ae035dd0ad63b5 100644 (file)
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                                       <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
-  <!--
-      Maven Site Configuration
+    <!--
+        Maven Site Configuration
 
-      The following configuration is necessary for maven-site-plugin to
-      correctly identify the correct deployment path for OpenDaylight Maven
-      sites.
-  -->
-  <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
 
-  <distributionManagement>
-    <site>
-      <id>opendaylight-site</id>
-      <url>${nexus.site.url}/${project.artifactId}/</url>
-    </site>
-  </distributionManagement>
+    <distributionManagement>
+        <site>
+            <id>opendaylight-site</id>
+            <url>${nexus.site.url}/${project.artifactId}/</url>
+        </site>
+    </distributionManagement>
 </project>