summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java2
-rw-r--r--main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterHandler.java7
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java3
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/ApiRestServer.java19
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/HealthCheckProvider.java2
-rw-r--r--main/src/main/java/org/onap/policy/api/main/startstop/ApiActivator.java5
-rw-r--r--main/src/main/java/org/onap/policy/api/main/startstop/ApiCommandLineArguments.java12
-rw-r--r--main/src/main/java/org/onap/policy/api/main/startstop/Main.java7
-rw-r--r--main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java1
-rw-r--r--pom.xml49
11 files changed, 63 insertions, 47 deletions
diff --git a/.gitignore b/.gitignore
index a949ed33..e0c495fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.DS_Store
+.checkstyle
.project
.settings
.classpath
@@ -8,3 +9,5 @@ target
.metadata/
/bin/
.idea
+logs/
+debug-logs/
diff --git a/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java b/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java
index 1b149d03..af12f016 100644
--- a/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java
+++ b/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java
@@ -60,7 +60,7 @@ public class ApiParameterGroup implements ParameterGroup {
*/
@Override
public void setName(String name) {
- this.name=name;
+ this.name = name;
}
/**
diff --git a/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterHandler.java b/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterHandler.java
index 4cee10a1..92923d0d 100644
--- a/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterHandler.java
+++ b/main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterHandler.java
@@ -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.
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java b/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
index 1dd01a32..9b4d75df 100644
--- a/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
+++ b/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
@@ -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.
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/ApiRestServer.java b/main/src/main/java/org/onap/policy/api/main/rest/ApiRestServer.java
index 1050dbf6..b6d69602 100644
--- a/main/src/main/java/org/onap/policy/api/main/rest/ApiRestServer.java
+++ b/main/src/main/java/org/onap/policy/api/main/rest/ApiRestServer.java
@@ -20,15 +20,14 @@
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() {
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/HealthCheckProvider.java b/main/src/main/java/org/onap/policy/api/main/rest/HealthCheckProvider.java
index 33eda9dc..dd223384 100644
--- a/main/src/main/java/org/onap/policy/api/main/rest/HealthCheckProvider.java
+++ b/main/src/main/java/org/onap/policy/api/main/rest/HealthCheckProvider.java
@@ -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.
diff --git a/main/src/main/java/org/onap/policy/api/main/startstop/ApiActivator.java b/main/src/main/java/org/onap/policy/api/main/startstop/ApiActivator.java
index 2173ef3a..1f7b05aa 100644
--- a/main/src/main/java/org/onap/policy/api/main/startstop/ApiActivator.java
+++ b/main/src/main/java/org/onap/policy/api/main/startstop/ApiActivator.java
@@ -20,12 +20,12 @@
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();
diff --git a/main/src/main/java/org/onap/policy/api/main/startstop/ApiCommandLineArguments.java b/main/src/main/java/org/onap/policy/api/main/startstop/ApiCommandLineArguments.java
index 4306ef30..f165b16f 100644
--- a/main/src/main/java/org/onap/policy/api/main/startstop/ApiCommandLineArguments.java
+++ b/main/src/main/java/org/onap/policy/api/main/startstop/ApiCommandLineArguments.java
@@ -20,21 +20,21 @@
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.
diff --git a/main/src/main/java/org/onap/policy/api/main/startstop/Main.java b/main/src/main/java/org/onap/policy/api/main/startstop/Main.java
index a533bed5..00d36873 100644
--- a/main/src/main/java/org/onap/policy/api/main/startstop/Main.java
+++ b/main/src/main/java/org/onap/policy/api/main/startstop/Main.java
@@ -20,13 +20,12 @@
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.
diff --git a/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java b/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java
index 6ad8c72b..7a59dad6 100644
--- a/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java
@@ -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 b2d885c7..288052e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,12 +27,11 @@
<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>
@@ -124,12 +122,11 @@
</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>
@@ -145,7 +142,7 @@
<dependency>
<groupId>org.onap.oparent</groupId>
<artifactId>checkstyle</artifactId>
- <version>1.1.0</version>
+ <version>${oparent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -158,8 +155,7 @@
<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>
@@ -168,8 +164,8 @@
</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>
@@ -179,8 +175,7 @@
<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>
@@ -193,6 +188,30 @@
</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>