summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java54
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java42
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsStatisticDistributionRestServer.java46
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java9
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java9
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java9
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java9
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/decoding/PluginTerminationExceptionTest.java6
8 files changed, 86 insertions, 98 deletions
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java
index c7fbbd84..f9673755 100644
--- a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java
+++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java
@@ -38,17 +38,17 @@ import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParamet
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
public class DistributionParameterGroup implements ParameterGroup {
+ // @formatter:off
private String name;
private RestServerParameters restServerParameters;
private Map<String, ReceptionHandlerParameters> receptionHandlerParameters;
- private Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters =
- new LinkedHashMap<>();
- private Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters =
- new LinkedHashMap<>();
- private Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters =
- new LinkedHashMap<>();
-
-
+ private Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters
+ = new LinkedHashMap<>();
+ private Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters
+ = new LinkedHashMap<>();
+ private Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters
+ = new LinkedHashMap<>();
+ // @formatter:on
/**
* Create the distribution parameter group.
@@ -56,10 +56,10 @@ public class DistributionParameterGroup implements ParameterGroup {
* @param name the parameter group name
*/
public DistributionParameterGroup(final String name, final RestServerParameters restServerParameters,
- final Map<String, ReceptionHandlerParameters> receptionHandlerParameters,
- final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters,
- final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters,
- final Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters) {
+ final Map<String, ReceptionHandlerParameters> receptionHandlerParameters,
+ final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters,
+ final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters,
+ final Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters) {
this.name = name;
this.restServerParameters = restServerParameters;
this.receptionHandlerParameters = receptionHandlerParameters;
@@ -118,10 +118,10 @@ public class DistributionParameterGroup implements ParameterGroup {
/**
* Sets the reception handler configuration parameter map.
*
- * @param eventInputParameters the reception handler configuration parameters
+ * @param receptionHandlerConfigurationParameters the reception handler configuration parameters
*/
public void setReceptionHandlerConfigurationParameters(
- final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters) {
+ final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters) {
this.receptionHandlerConfigurationParameters = receptionHandlerConfigurationParameters;
}
@@ -140,7 +140,7 @@ public class DistributionParameterGroup implements ParameterGroup {
* @param policyForwarderConfigurationParameters the policy forwarder configuration parameters
*/
public void setPolicyForwarderConfigurationParameters(
- final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters) {
+ final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters) {
this.policyForwarderConfigurationParameters = policyForwarderConfigurationParameters;
}
@@ -159,7 +159,7 @@ public class DistributionParameterGroup implements ParameterGroup {
* @param policyDecoderConfigurationParameters the policyDecoderConfigurationParameters to set
*/
public void setPolicyDecoderConfigurationParameters(
- final Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters) {
+ final Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters) {
this.policyDecoderConfigurationParameters = policyDecoderConfigurationParameters;
}
@@ -176,7 +176,7 @@ public class DistributionParameterGroup implements ParameterGroup {
}
if (restServerParameters == null) {
validationResult.setResult("restServerParameters", ValidationStatus.INVALID,
- "must have restServerParameters to configure distribution rest server");
+ "must have restServerParameters to configure distribution rest server");
} else {
validationResult.setResult("restServerParameters", restServerParameters.validate());
}
@@ -189,29 +189,33 @@ public class DistributionParameterGroup implements ParameterGroup {
private void validateReceptionHandlers(final GroupValidationResult validationResult) {
if (receptionHandlerParameters == null || receptionHandlerParameters.size() == 0) {
validationResult.setResult("receptionHandlerParameters", ValidationStatus.INVALID,
- "must have at least one reception handler");
+ "must have at least one reception handler");
} else {
for (final Entry<String, ReceptionHandlerParameters> nestedGroupEntry : receptionHandlerParameters
- .entrySet()) {
+ .entrySet()) {
validationResult.setResult("receptionHandlerParameters", nestedGroupEntry.getKey(),
- nestedGroupEntry.getValue().validate());
+ nestedGroupEntry.getValue().validate());
}
}
}
private void validateForwarderConfigurations(final GroupValidationResult validationResult) {
- for (final Entry<String, PolicyForwarderConfigurationParameterGroup> configurationParameters :
- policyForwarderConfigurationParameters.entrySet()) {
+ // @formatter:off
+ for (final Entry<String, PolicyForwarderConfigurationParameterGroup> configurationParameters :
+ policyForwarderConfigurationParameters.entrySet()) {
validationResult.setResult("policyForwarderConfigurationParameters", configurationParameters.getKey(),
- configurationParameters.getValue().validate());
+ configurationParameters.getValue().validate());
}
+ // @formatter:on
}
private void validateDecoderConfigurations(final GroupValidationResult validationResult) {
+ // @formatter:off
for (final Entry<String, PolicyDecoderConfigurationParameterGroup> configurationParameters :
- policyDecoderConfigurationParameters.entrySet()) {
+ policyDecoderConfigurationParameters.entrySet()) {
validationResult.setResult("policyDecoderConfigurationParameters", configurationParameters.getKey(),
- configurationParameters.getValue().validate());
+ configurationParameters.getValue().validate());
}
+ // @formatter:on
}
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
index 604bdd9a..f093b2ac 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
@@ -21,7 +21,6 @@
package org.onap.policy.distribution.main.rest;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
@@ -45,8 +44,6 @@ import org.onap.policy.common.endpoints.report.HealthCheckReport;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.distribution.main.PolicyDistributionException;
-import org.onap.policy.distribution.main.parameters.CommonTestData;
-import org.onap.policy.distribution.main.parameters.RestServerParameters;
import org.onap.policy.distribution.main.startstop.Main;
/**
@@ -57,15 +54,14 @@ import org.onap.policy.distribution.main.startstop.Main;
public class TestHttpsDistributionRestServer {
private static final Logger LOGGER = FlexLogger.getLogger(TestDistributionRestServer.class);
- private static final String NOT_ALIVE = "not alive";
private static final String ALIVE = "alive";
private static final String SELF = "self";
private static final String NAME = "Policy SSD";
private static String KEYSTORE = System.getProperty("user.dir") + "/src/test/resources/ssl/policy-keystore";
@Test
- public void testHealthCheckSuccess() throws PolicyDistributionException, InterruptedException,
- KeyManagementException, NoSuchAlgorithmException {
+ public void testHealthCheckSuccess()
+ throws PolicyDistributionException, InterruptedException, KeyManagementException, NoSuchAlgorithmException {
final String reportString = "Report [name=Policy SSD, url=self, healthy=true, code=200, message=alive]";
final Main main = startDistributionService();
final HealthCheckReport report = performHealthCheck();
@@ -87,32 +83,30 @@ public class TestHttpsDistributionRestServer {
main.shutdown();
}
- private HealthCheckReport performHealthCheck() throws InterruptedException, KeyManagementException,
- NoSuchAlgorithmException {
+ private HealthCheckReport performHealthCheck()
+ throws InterruptedException, KeyManagementException, NoSuchAlgorithmException {
HealthCheckReport response = null;
- TrustManager[] noopTrustManager = new TrustManager[]{
- new X509TrustManager() {
+ TrustManager[] noopTrustManager = new TrustManager[] { new X509TrustManager() {
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return new X509Certificate[0];
- }
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
- @Override
- public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
- }
+ @Override
+ public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+ }
- @Override
- public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
- }
+ @Override
+ public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
}
- };
+ } };
SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, noopTrustManager, new SecureRandom());
- final ClientBuilder clientBuilder =
- ClientBuilder.newBuilder().sslContext(sc).hostnameVerifier((host, session) -> true);
+ final ClientBuilder clientBuilder = ClientBuilder.newBuilder().sslContext(sc)
+ .hostnameVerifier((host, session) -> true);
final Client client = clientBuilder.build();
final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
client.register(feature);
@@ -132,7 +126,7 @@ public class TestHttpsDistributionRestServer {
}
private void validateReport(final String name, final String url, final boolean healthy, final int code,
- final String message, final String reportString, final HealthCheckReport report) {
+ final String message, final String reportString, final HealthCheckReport report) {
assertEquals(name, report.getName());
assertEquals(url, report.getUrl());
assertEquals(healthy, report.isHealthy());
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsStatisticDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsStatisticDistributionRestServer.java
index f1beb0af..4d5aa7a8 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsStatisticDistributionRestServer.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsStatisticDistributionRestServer.java
@@ -21,7 +21,6 @@
package org.onap.policy.distribution.main.rest;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
@@ -44,8 +43,6 @@ import org.junit.Test;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.distribution.main.PolicyDistributionException;
-import org.onap.policy.distribution.main.parameters.CommonTestData;
-import org.onap.policy.distribution.main.parameters.RestServerParameters;
import org.onap.policy.distribution.main.startstop.Main;
/**
@@ -59,11 +56,10 @@ public class TestHttpsStatisticDistributionRestServer {
private static String KEYSTORE = System.getProperty("user.dir") + "/src/test/resources/ssl/policy-keystore";
@Test
- public void testHealthCheckSuccess() throws PolicyDistributionException, InterruptedException,
- KeyManagementException, NoSuchAlgorithmException {
+ public void testHealthCheckSuccess()
+ throws PolicyDistributionException, InterruptedException, KeyManagementException, NoSuchAlgorithmException {
final String reportString = "StatisticsReport [code=200, totalDistributionCount=0, distributionSuccessCount=0, "
- + "distributionFailureCount=0, totalDownloadCount=0, "
- + "downloadSuccessCount=0, downloadFailureCount=0]";
+ + "distributionFailureCount=0, totalDownloadCount=0, " + "downloadSuccessCount=0, downloadFailureCount=0]";
final Main main = startDistributionService();
final StatisticsReport report = performStatisticCheck();
validateReport(200, 0, 0, 0, 0, 0, 0, reportString, report);
@@ -84,32 +80,30 @@ public class TestHttpsStatisticDistributionRestServer {
main.shutdown();
}
- private StatisticsReport performStatisticCheck() throws InterruptedException, KeyManagementException,
- NoSuchAlgorithmException {
+ private StatisticsReport performStatisticCheck()
+ throws InterruptedException, KeyManagementException, NoSuchAlgorithmException {
StatisticsReport response = null;
- TrustManager[] noopTrustManager = new TrustManager[]{
- new X509TrustManager() {
+ TrustManager[] noopTrustManager = new TrustManager[] { new X509TrustManager() {
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return new X509Certificate[0];
- }
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
- @Override
- public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
- }
+ @Override
+ public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+ }
- @Override
- public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
- }
+ @Override
+ public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
}
- };
+ } };
SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, noopTrustManager, new SecureRandom());
- final ClientBuilder clientBuilder =
- ClientBuilder.newBuilder().sslContext(sc).hostnameVerifier((host, session) -> true);
+ final ClientBuilder clientBuilder = ClientBuilder.newBuilder().sslContext(sc)
+ .hostnameVerifier((host, session) -> true);
final Client client = clientBuilder.build();
final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
client.register(feature);
@@ -129,8 +123,8 @@ public class TestHttpsStatisticDistributionRestServer {
}
private void validateReport(final int code, final int total, final int successCount, final int failureCount,
- final int download, final int downloadSuccess, final int downloadFailure, final String reportString,
- final StatisticsReport report) {
+ final int download, final int downloadSuccess, final int downloadFailure, final String reportString,
+ final StatisticsReport report) {
assertEquals(code, report.getCode());
assertEquals(total, report.getTotalDistributionCount());
assertEquals(successCount, report.getDistributionSuccessCount());
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java
index a021870a..23409ea0 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java
@@ -20,7 +20,6 @@
package org.onap.policy.distribution.reception.handling.sdc.exceptions;
-
/**
* Exception during download from Pssd.
*/
@@ -38,17 +37,17 @@ public class ArtifactDownloadException extends Exception {
*/
public ArtifactDownloadException(final String message) {
super(message);
-
+
}
-
+
/**
* Constructor for creating PssdDownloadException using message and exception.
*
* @param message The message to dump
- * @param e the exception that caused this exception to be thrown
+ * @param ex the exception that caused this exception to be thrown
*/
public ArtifactDownloadException(final String message, final Exception ex) {
super(message, ex);
-
+
}
}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java
index bc60813e..19e711b4 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java
@@ -20,7 +20,6 @@
package org.onap.policy.distribution.reception.handling.sdc.exceptions;
-
/**
* Exception during artifact installation.
*/
@@ -38,17 +37,17 @@ public class ArtifactInstallerException extends Exception {
*/
public ArtifactInstallerException(final String message) {
super(message);
-
+
}
-
+
/**
* Constructor for creating ArtifactInstallerException using message and exception.
*
* @param message The message to dump
- * @param e the exception that caused this exception to be thrown
+ * @param ex the exception that caused this exception to be thrown
*/
public ArtifactInstallerException(final String message, final Exception ex) {
super(message, ex);
-
+
}
}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java
index a2117c63..0dd16d78 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java
@@ -20,7 +20,6 @@
package org.onap.policy.distribution.reception.handling.sdc.exceptions;
-
/**
* Exception of the Pssd controller.
*/
@@ -38,17 +37,17 @@ public class PssdControllerException extends Exception {
*/
public PssdControllerException(final String message) {
super(message);
-
+
}
-
+
/**
* Constructor for creating PssdControllerException using message and exception.
*
* @param message The message to dump
- * @param e the exception that caused this exception to be thrown
+ * @param ex the exception that caused this exception to be thrown
*/
public PssdControllerException(final String message, final Exception ex) {
super(message, ex);
-
+
}
}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java
index 26504c95..e1cdf70e 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java
@@ -20,7 +20,6 @@
package org.onap.policy.distribution.reception.handling.sdc.exceptions;
-
/**
* Exception of the Pssd controller.
*/
@@ -38,17 +37,17 @@ public class PssdParametersException extends Exception {
*/
public PssdParametersException(final String message) {
super(message);
-
+
}
-
+
/**
* Constructor for creating PssdParametersException using message and exception.
*
* @param message The message to dump
- * @param e the exception that caused this exception to be thrown
+ * @param ex the exception that caused this exception to be thrown
*/
public PssdParametersException(final String message, final Exception ex) {
super(message, ex);
-
+
}
}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/decoding/PluginTerminationExceptionTest.java b/reception/src/test/java/org/onap/policy/distribution/reception/decoding/PluginTerminationExceptionTest.java
index b450e32b..c2fc6a94 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/decoding/PluginTerminationExceptionTest.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/decoding/PluginTerminationExceptionTest.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
/**
- * Class to perform unit test of {@link PluginTerminationException}
+ * Class to perform unit test of {@link PluginTerminationException}.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
@@ -40,8 +40,8 @@ public class PluginTerminationExceptionTest {
@Test
public void testPluginTerminationExceptionStringThrowable() {
final Exception cause = new IllegalArgumentException();
- final PluginTerminationException pluginTerminationException =
- new PluginTerminationException("error message", cause);
+ final PluginTerminationException pluginTerminationException = new PluginTerminationException("error message",
+ cause);
assertEquals("error message", pluginTerminationException.getMessage());
assertEquals(cause, pluginTerminationException.getCause());
}