Clean up checkstyle declaration 65/68865/2
authorPamela Dragosh <pdragosh@research.att.com>
Tue, 25 Sep 2018 13:20:32 +0000 (09:20 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Tue, 25 Sep 2018 15:03:11 +0000 (11:03 -0400)
Fixed the path for finding the src files.

Added eclipse lifecycle to ignore the oparent checkstyle
bug.

Cleaned up existing checkstyle issues.

Added entries into .gitignore to ignore debug logging
directories created.

Issue-ID: POLICY-1136
Change-Id: I684038babcb9723cfc4bef2b2a713425ae077599
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
.gitignore
main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java
main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterHandler.java
main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
main/src/main/java/org/onap/policy/api/main/rest/ApiRestServer.java
main/src/main/java/org/onap/policy/api/main/rest/HealthCheckProvider.java
main/src/main/java/org/onap/policy/api/main/startstop/ApiActivator.java
main/src/main/java/org/onap/policy/api/main/startstop/ApiCommandLineArguments.java
main/src/main/java/org/onap/policy/api/main/startstop/Main.java
main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java
pom.xml

index a949ed3..e0c495f 100644 (file)
@@ -1,4 +1,5 @@
 .DS_Store
+.checkstyle
 .project
 .settings
 .classpath
@@ -8,3 +9,5 @@ target
 .metadata/
 /bin/
 .idea
+logs/
+debug-logs/
index 1b149d0..af12f01 100644 (file)
@@ -60,7 +60,7 @@ public class ApiParameterGroup implements ParameterGroup {
      */
     @Override
     public void setName(String name) {
-        this.name=name;
+        this.name = name;
     }
 
     /**
index 4cee10a..92923d0 100644 (file)
@@ -22,13 +22,12 @@ package org.onap.policy.api.main.parameters;
 
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
+import java.io.FileReader;
+import org.onap.policy.api.main.PolicyApiException;
+import org.onap.policy.api.main.startstop.ApiCommandLineArguments;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.api.main.PolicyApiException;
-import org.onap.policy.api.main.startstop.ApiCommandLineArguments;
-
-import java.io.FileReader;
 
 /**
  * This class handles reading, parsing and validating of policy api parameters from JSON files.
index 1dd01a3..9b4d75d 100644 (file)
@@ -25,13 +25,12 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.Info;
 import io.swagger.annotations.SwaggerDefinition;
 import io.swagger.annotations.Tag;
-import org.onap.policy.common.endpoints.report.HealthCheckReport;
-
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
+import org.onap.policy.common.endpoints.report.HealthCheckReport;
 
 /**
  * Class to provide api REST services.
index 1050dbf..b6d6960 100644 (file)
 
 package org.onap.policy.api.main.rest;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import org.onap.policy.api.main.parameters.RestServerParameters;
 import org.onap.policy.common.capabilities.Startable;
 import org.onap.policy.common.endpoints.http.server.HttpServletServer;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.api.main.parameters.RestServerParameters;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
 
 /**
  * Class to manage life cycle of api rest server.
@@ -54,7 +53,7 @@ public class ApiRestServer implements Startable {
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      */
     @Override
     public boolean start() {
@@ -94,7 +93,7 @@ public class ApiRestServer implements Startable {
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      */
     @Override
     public boolean stop() {
@@ -109,7 +108,7 @@ public class ApiRestServer implements Startable {
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      */
     @Override
     public void shutdown() {
@@ -117,7 +116,7 @@ public class ApiRestServer implements Startable {
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      */
     @Override
     public boolean isAlive() {
@@ -125,7 +124,7 @@ public class ApiRestServer implements Startable {
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      */
     @Override
     public String toString() {
index 33eda9d..dd22338 100644 (file)
@@ -20,8 +20,8 @@
 
 package org.onap.policy.api.main.rest;
 
-import org.onap.policy.common.endpoints.report.HealthCheckReport;
 import org.onap.policy.api.main.startstop.ApiActivator;
+import org.onap.policy.common.endpoints.report.HealthCheckReport;
 
 /**
  * Class to fetch health check of api service.
index 2173ef3..1f7b05a 100644 (file)
 
 package org.onap.policy.api.main.startstop;
 
+import org.onap.policy.api.main.PolicyApiException;
+import org.onap.policy.api.main.parameters.ApiParameterGroup;
 import org.onap.policy.api.main.rest.ApiRestServer;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.common.parameters.ParameterService;
-import org.onap.policy.api.main.PolicyApiException;
-import org.onap.policy.api.main.parameters.ApiParameterGroup;
 
 /**
  * This class wraps a distributor so that it can be activated as a complete service together with all its api
@@ -56,7 +56,6 @@ public class ApiActivator {
      *
      * @throws PolicyApiException on errors in initializing the service
      */
-    @SuppressWarnings("unchecked")
     public void initialize() throws PolicyApiException {
         LOGGER.debug("Policy api starting as a service . . .");
         startApiRestServer();
index 4306ef3..f165b16 100644 (file)
 
 package org.onap.policy.api.main.startstop;
 
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Arrays;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.DefaultParser;
 import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
-import org.onap.policy.common.utils.resources.ResourceUtils;
 import org.onap.policy.api.main.PolicyApiException;
 import org.onap.policy.api.main.PolicyApiRuntimeException;
+import org.onap.policy.common.utils.resources.ResourceUtils;
 
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.Arrays;
 
 /**
  * This class reads and handles command line parameters for the policy api main program.
index a533bed..00d3687 100644 (file)
 
 package org.onap.policy.api.main.startstop;
 
+import java.util.Arrays;
 import org.onap.policy.api.main.PolicyApiException;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.api.main.parameters.ApiParameterGroup;
 import org.onap.policy.api.main.parameters.ApiParameterHandler;
-
-import java.util.Arrays;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
 
 /**
  * This class initiates ONAP Policy Framework policy api.
index 6ad8c72..7a59dad 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.policy.api.main.parameters;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import org.junit.Test;
 import org.onap.policy.common.parameters.GroupValidationResult;
diff --git a/pom.xml b/pom.xml
index b2d885c..288052e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <groupId>org.onap.policy.parent</groupId>
         <artifactId>integration</artifactId>
         <version>2.0.0-SNAPSHOT</version>
-        <relativePath/>
+        <relativePath />
     </parent>
 
     <groupId>org.onap.policy.api</groupId>
     <artifactId>policy-api</artifactId>
-    <version>2.0.0-SNAPSHOT</version>
 
     <packaging>pom</packaging>
 
@@ -41,8 +40,7 @@
 
     <properties>
         <!-- sonar/jacoco overrides -->
-        <!-- Overriding oparent default sonar/jacoco settings Combine all our reports
-            into one file shared across sub-modules -->
+        <!-- Overriding oparent default sonar/jacoco settings Combine all our reports into one file shared across sub-modules -->
         <sonar.jacoco.reportPath>${project.basedir}/../target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
         <sonar.jacoco.itReportPath>${project.basedir}/../target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
         <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
                         </goals>
                         <phase>process-sources</phase>
                         <configuration>
-                            <!-- Use Google Java Style Guide:
-                            https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
-                            with minor changes -->
+                            <!-- Use Google Java Style Guide: https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml 
+                                with minor changes -->
                             <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
                             <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
-                            <sourceDirectory>${project.build.sourceDirectory}/src/main/java</sourceDirectory>
+                            <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                             <includeResources>true</includeResources>
                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
                             <includeTestResources>true</includeTestResources>
                     <dependency>
                         <groupId>org.onap.oparent</groupId>
                         <artifactId>checkstyle</artifactId>
-                        <version>1.1.0</version>
+                        <version>${oparent.version}</version>
                         <scope>compile</scope>
                     </dependency>
                 </dependencies>
                     <artifactId>jacoco-maven-plugin</artifactId>
                     <version>${jacoco.version}</version>
                     <configuration>
-                        <!-- Note: This exclusion list should match <sonar.exclusions> property
-                            above -->
+                        <!-- Note: This exclusion list should match <sonar.exclusions> property above -->
                         <excludes>
                             <exclude>**/gen/**</exclude>
                             <exclude>**/generated-sources/**</exclude>
                         </excludes>
                     </configuration>
                     <executions>
-                        <!-- Prepares the property pointing to the JaCoCo runtime agent which
-                            is passed as VM argument when Maven the Surefire plugin is executed. -->
+                        <!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as VM argument when 
+                            Maven the Surefire plugin is executed. -->
                         <execution>
                             <id>pre-unit-test</id>
                             <goals>
                                 <destFile>${sonar.jacoco.reportPath}</destFile>
                             </configuration>
                         </execution>
-                        <!-- Ensures that the code coverage report for unit tests is created
-                            after unit tests have been run. -->
+                        <!-- Ensures that the code coverage report for unit tests is created after unit tests have been run. -->
                         <execution>
                             <id>post-unit-test</id>
                             <phase>test</phase>
                         </execution>
                     </executions>
                 </plugin>
+                <plugin>
+                    <groupId>org.eclipse.m2e</groupId>
+                    <artifactId>lifecycle-mapping</artifactId>
+                    <version>1.0.0</version>
+                    <configuration>
+                        <lifecycleMappingMetadata>
+                            <pluginExecutions>
+                                <pluginExecution>
+                                    <pluginExecutionFilter>
+                                        <groupId>org.apache.maven.plugins</groupId>
+                                        <artifactId>maven-checkstyle-plugin</artifactId>
+                                        <versionRange>2.17,)</versionRange>
+                                        <goals>
+                                            <goal>check</goal>
+                                        </goals>
+                                    </pluginExecutionFilter>
+                                    <action>
+                                        <ignore />
+                                    </action>
+                                </pluginExecution>
+                            </pluginExecutions>
+                        </lifecycleMappingMetadata>
+                    </configuration>
+                </plugin>
             </plugins>
         </pluginManagement>
     </build>