aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-08-22 14:48:53 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-22 14:48:53 +0000
commit55e6bdc93d05f1c9673a4ecbe133207722216eb0 (patch)
tree84d68bf3d309929ae7cbcc855f7dca6f3889fa3d /main/src/test
parent9a3dcafd4b22f2e11e2bcb256eb387745c606fa3 (diff)
parent7de549e5589d5e98a798e65752396627f6990fe1 (diff)
Merge "Adding health check endpoint to distribution"
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java37
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java40
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java68
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java116
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java2
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerHost.json53
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPassword.json53
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPort.json53
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerUser.json53
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json6
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json8
-rw-r--r--main/src/test/resources/parameters/MinimumParameters.json6
-rw-r--r--main/src/test/resources/parameters/NoParameters.json6
25 files changed, 555 insertions, 18 deletions
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
index 0903b070..59f551cf 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
@@ -38,6 +38,10 @@ import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParamet
*/
public class CommonTestData {
+ private static final String REST_SERVER_PASSWORD = "zb!XztG34";
+ private static final String REST_SERVER_USER = "healthcheck";
+ private static final int REST_SERVER_PORT = 6969;
+ private static final String REST_SERVER_HOST = "0.0.0.0";
public static final String DISTRIBUTION_GROUP_NAME = "SDCDistributionGroup";
public static final String DECODER_TYPE = "TOSCA";
public static final String DECODER_CLASS_NAME =
@@ -56,6 +60,23 @@ public class CommonTestData {
* Returns an instance of ReceptionHandlerParameters for test cases.
*
* @param isEmpty boolean value to represent that object created should be empty or not
+ * @return the restServerParameters object
+ */
+ public RestServerParameters getRestServerParameters(final boolean isEmpty) {
+ final RestServerParameters restServerParameters;
+ if (!isEmpty) {
+ restServerParameters = new RestServerParameters(REST_SERVER_HOST, REST_SERVER_PORT, REST_SERVER_USER,
+ REST_SERVER_PASSWORD);
+ } else {
+ restServerParameters = new RestServerParameters(null, 0, null, null);
+ }
+ return restServerParameters;
+ }
+
+ /**
+ * Returns an instance of ReceptionHandlerParameters for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
* @return the receptionHandlerParameters object
*/
public Map<String, ReceptionHandlerParameters> getReceptionHandlerParameters(final boolean isEmpty) {
@@ -66,9 +87,8 @@ public class CommonTestData {
final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders(isEmpty);
final PSSDConfigurationParametersGroup pssdConfiguration = getPSSDConfigurationParametersGroup(isEmpty);;
final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
- final ReceptionHandlerParameters rhParameters =
- new ReceptionHandlerParameters(RECEPTION_HANDLER_TYPE, RECEPTION_HANDLER_CLASS_NAME,
- pssdConfiguration, pHParameters);
+ final ReceptionHandlerParameters rhParameters = new ReceptionHandlerParameters(RECEPTION_HANDLER_TYPE,
+ RECEPTION_HANDLER_CLASS_NAME, pssdConfiguration, pHParameters);
receptionHandlerParameters.put(SDC_RECEPTION_HANDLER_KEY, rhParameters);
}
return receptionHandlerParameters;
@@ -88,12 +108,11 @@ public class CommonTestData {
final List<String> artifactTypes = new ArrayList<>();
artifactTypes.add("TOSCA_CSAR");
pssdConfiguration = new PSSDConfigurationParametersGroup.PSSDConfigurationBuilder()
- .setAsdcAddress("localhost").setMessageBusAddress(messageBusAddress)
- .setUser("policy").setPassword("policy").setPollingInterval(20)
- .setPollingTimeout(30).setConsumerId("policy-id").setArtifactTypes(artifactTypes)
- .setConsumerGroup("policy-group").setEnvironmentName("TEST").setKeystorePath("")
- .setKeystorePassword("").setActiveserverTlsAuth(false)
- .setIsFilterinEmptyResources(true).setIsUseHttpsWithDmaap(false).build();
+ .setAsdcAddress("localhost").setMessageBusAddress(messageBusAddress).setUser("policy")
+ .setPassword("policy").setPollingInterval(20).setPollingTimeout(30).setConsumerId("policy-id")
+ .setArtifactTypes(artifactTypes).setConsumerGroup("policy-group").setEnvironmentName("TEST")
+ .setKeystorePath("").setKeystorePassword("").setActiveserverTlsAuth(false)
+ .setIsFilterinEmptyResources(true).setIsUseHttpsWithDmaap(false).build();
} else {
pssdConfiguration = new PSSDConfigurationParametersGroup.PSSDConfigurationBuilder().build();
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
index 70317971..f6ed0f98 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
@@ -41,13 +41,20 @@ public class TestDistributionParameterGroup {
@Test
public void testDistributionParameterGroup() {
+ final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
- final DistributionParameterGroup distributionParameters =
- new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, receptionHandlerParameters);
+ final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(
+ CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, receptionHandlerParameters);
final GroupValidationResult validationResult = distributionParameters.validate();
assertTrue(validationResult.isValid());
+ assertEquals(restServerParameters.getHost(), distributionParameters.getRestServerParameters().getHost());
+ assertEquals(restServerParameters.getPort(), distributionParameters.getRestServerParameters().getPort());
+ assertEquals(restServerParameters.getUserName(),
+ distributionParameters.getRestServerParameters().getUserName());
+ assertEquals(restServerParameters.getPassword(),
+ distributionParameters.getRestServerParameters().getPassword());
assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, distributionParameters.getName());
assertEquals(receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
@@ -64,11 +71,12 @@ public class TestDistributionParameterGroup {
@Test
public void testDistributionParameterGroup_NullName() {
+ final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
final DistributionParameterGroup distributionParameters =
- new DistributionParameterGroup(null, receptionHandlerParameters);
+ new DistributionParameterGroup(null, restServerParameters, receptionHandlerParameters);
final GroupValidationResult validationResult = distributionParameters.validate();
assertFalse(validationResult.isValid());
assertEquals(null, distributionParameters.getName());
@@ -89,11 +97,12 @@ public class TestDistributionParameterGroup {
@Test
public void testDistributionParameterGroup_EmptyName() {
+ final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(false);
final DistributionParameterGroup distributionParameters =
- new DistributionParameterGroup("", receptionHandlerParameters);
+ new DistributionParameterGroup("", restServerParameters, receptionHandlerParameters);
final GroupValidationResult validationResult = distributionParameters.validate();
assertFalse(validationResult.isValid());
assertEquals("", distributionParameters.getName());
@@ -114,9 +123,10 @@ public class TestDistributionParameterGroup {
@Test
public void testDistributionParameterGroup_NullReceptionHandlerParameters() {
+ final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
try {
final DistributionParameterGroup distributionParameters =
- new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, null);
+ new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, null);
distributionParameters.validate();
fail("test should throw an exception here");
} catch (final Exception e) {
@@ -127,11 +137,12 @@ public class TestDistributionParameterGroup {
@Test
public void testDistributionParameterGroup_EmptyReceptionHandlerParameters() {
+ final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false);
final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
commonTestData.getReceptionHandlerParameters(true);
try {
- final DistributionParameterGroup distributionParameters =
- new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, receptionHandlerParameters);
+ final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(
+ CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, receptionHandlerParameters);
distributionParameters.validate();
fail("test should throw an exception here");
} catch (final Exception e) {
@@ -139,4 +150,19 @@ public class TestDistributionParameterGroup {
}
}
+
+ @Test
+ public void testDistributionParameterGroup_EmptyRestServerParameters() {
+ final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(true);
+ final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
+ commonTestData.getReceptionHandlerParameters(false);
+
+ final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(
+ CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, receptionHandlerParameters);
+ final GroupValidationResult validationResult = distributionParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("\"org.onap.policy.distribution.main.parameters.RestServerParameters\" INVALID, "
+ + "parameter group has status INVALID"));
+ }
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
index 79b12243..69ff0f14 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
@@ -357,4 +357,72 @@ public class TestDistributionParameterHandler {
assertTrue(e.getMessage().contains("policy forwarder class not found in classpath"));
}
}
+
+ @Test
+ public void testDistributionParameterGroup_InvalidRestServerHost() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidRestServerHost.json" };
+
+ final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ arguments.parse(distributionConfigParameters);
+
+ try {
+ new DistributionParameterHandler().getParameters(arguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains(
+ "must be a non-blank string containing hostname/ipaddress of the distribution rest server"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidRestServerPort() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidRestServerPort.json" };
+
+ final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ arguments.parse(distributionConfigParameters);
+
+ try {
+ new DistributionParameterHandler().getParameters(arguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage()
+ .contains("must be a positive integer containing port of the distribution rest server"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidRestServerUser() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidRestServerUser.json" };
+
+ final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ arguments.parse(distributionConfigParameters);
+
+ try {
+ new DistributionParameterHandler().getParameters(arguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains(
+ "must be a non-blank string containing userName for distribution rest server credentials"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidRestServerPassword() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidRestServerPassword.json" };
+
+ final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ arguments.parse(distributionConfigParameters);
+
+ try {
+ new DistributionParameterHandler().getParameters(arguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains(
+ "must be a non-blank string containing password for distribution rest server credentials"));
+ }
+ }
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
new file mode 100644
index 00000000..df585574
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.main.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.junit.Test;
+import org.onap.policy.common.endpoints.report.HealthCheckReport;
+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;
+
+/**
+ * Class to perform unit test of HealthCheckMonitor.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class TestDistributionRestServer {
+
+ 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";
+
+ @Test
+ public void testHealthCheckSuccess() throws PolicyDistributionException, InterruptedException {
+ final String reportString = "Report [name=Policy SSD, url=self, healthy=true, code=200, message=alive]";
+ final Main main = startDistributionService();
+ final HealthCheckReport report = performHealthCheck();
+ validateReport(NAME, SELF, true, 200, ALIVE, reportString, report);
+ stopDistributionService(main);
+ }
+
+ @Test
+ public void testHealthCheckFailure() throws InterruptedException {
+ final String reportString = "Report [name=Policy SSD, url=self, healthy=false, code=500, message=not alive]";
+ final RestServerParameters restServerParams = new CommonTestData().getRestServerParameters(false);
+ restServerParams.setName(CommonTestData.DISTRIBUTION_GROUP_NAME);
+ final DistributionRestServer restServer = new DistributionRestServer(restServerParams);
+ restServer.start();
+ final HealthCheckReport report = performHealthCheck();
+ validateReport(NAME, SELF, false, 500, NOT_ALIVE, reportString, report);
+ assertTrue(restServer.isAlive());
+ assertTrue(restServer.toString().startsWith("DistributionRestServer [servers="));
+ restServer.shutdown();
+ }
+
+ private Main startDistributionService() {
+ final String[] distributionConfigParameters = { "-c", "parameters/DistributionConfigParameters.json" };
+ return new Main(distributionConfigParameters);
+ }
+
+ private void stopDistributionService(final Main main) throws PolicyDistributionException {
+ main.shutdown();
+ }
+
+ private HealthCheckReport performHealthCheck() throws InterruptedException {
+ HealthCheckReport response;
+ final ClientConfig clientConfig = new ClientConfig();
+
+ final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
+ clientConfig.register(feature);
+
+ final Client client = ClientBuilder.newClient(clientConfig);
+ final WebTarget webTarget = client.target("http://localhost:6969/healthcheck");
+
+ final Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+ try {
+ response = invocationBuilder.get(HealthCheckReport.class);
+ } catch (final Exception exp) {
+ // may be the server is not started yet. Wait for couple of seconds and retry.
+ Thread.sleep(2000);
+ response = invocationBuilder.get(HealthCheckReport.class);
+ }
+
+ return response;
+ }
+
+ private void validateReport(final String name, final String url, final boolean healthy, final int code,
+ final String message, final String reportString, final HealthCheckReport report) {
+ assertEquals(name, report.getName());
+ assertEquals(url, report.getUrl());
+ assertEquals(healthy, report.isHealthy());
+ assertEquals(code, report.getCode());
+ assertEquals(message, report.getMessage());
+ assertEquals(reportString, report.toString());
+ }
+}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
index 6d1f83bf..25133cfe 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
@@ -60,6 +60,6 @@ public class TestDistributionActivator {
activator.getParameterGroup().getReceptionHandlerParameters()
.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getPluginHandlerParameters()
.getPolicyForwarders().get(CommonTestData.PAP_ENGINE_FORWARDER_KEY).getForwarderType());
- activator.deregisterToParameterService(parGroup);
+ activator.terminate();
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters.json
index bcf8b263..7ebab314 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
index a53dc05f..940f9018 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
index b88fda2a..b596f064 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json
index 45368be1..74733007 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
}
} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
index aae53f50..f31a396b 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
@@ -1,5 +1,11 @@
{
"name":" ",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json
index c1ad0a9e..cc43e378 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json
index 26f470ea..c4c73eea 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json
index a194e958..899fccab 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json
index 895e7d55..5e262c05 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
index a368a5b6..4ff308c2 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json
index bf0db3e6..a6be01ee 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":" ",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerHost.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerHost.json
new file mode 100644
index 00000000..b59074d2
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerHost.json
@@ -0,0 +1,53 @@
+{
+ "name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":"TOSCA",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ }
+ },
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":"PAPEngine",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPassword.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPassword.json
new file mode 100644
index 00000000..7161dee3
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPassword.json
@@ -0,0 +1,53 @@
+{
+ "name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":""
+ },
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":"TOSCA",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ }
+ },
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":"PAPEngine",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPort.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPort.json
new file mode 100644
index 00000000..aa480745
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPort.json
@@ -0,0 +1,53 @@
+{
+ "name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":-1,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":"TOSCA",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ }
+ },
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":"PAPEngine",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerUser.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerUser.json
new file mode 100644
index 00000000..d58c035b
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerUser.json
@@ -0,0 +1,53 @@
+{
+ "name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"",
+ "password":"zb!XztG34"
+ },
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":"TOSCA",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ }
+ },
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":"PAPEngine",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
index 06d18674..530a86d8 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
index d8343b19..6b6d6771 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json
index 8b0997ca..b91e95d8 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json
@@ -1,3 +1,9 @@
{
- "name":"SDCDistributionGroup"
+ "name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ }
} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json
index 18cd529c..95359b88 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -1,5 +1,11 @@
{
"name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
"receptionHandlerParameters":{
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
diff --git a/main/src/test/resources/parameters/NoParameters.json b/main/src/test/resources/parameters/NoParameters.json
index 7a73a41b..6b0805d3 100644
--- a/main/src/test/resources/parameters/NoParameters.json
+++ b/main/src/test/resources/parameters/NoParameters.json
@@ -1,2 +1,8 @@
{
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ }
} \ No newline at end of file