aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java43
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java9
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java36
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java33
-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.java90
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java42
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyDecoder.java3
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java64
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json9
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json9
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandlerClass.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json18
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderConfigurationClassName.json64
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json9
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json12
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_UnknownDecoderConfigurationClassName.json64
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json37
-rw-r--r--main/src/test/resources/parameters/MinimumParameters.json12
26 files changed, 577 insertions, 113 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 1f3e48e6..4bcd1a32 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
@@ -23,10 +23,12 @@ package org.onap.policy.distribution.main.parameters;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
+
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters;
@@ -43,6 +45,9 @@ public class DistributionParameterGroup implements ParameterGroup {
new LinkedHashMap<>();
private Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters =
new LinkedHashMap<>();
+ private Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters =
+ new LinkedHashMap<>();
+
/**
@@ -53,12 +58,14 @@ public class DistributionParameterGroup implements ParameterGroup {
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, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters,
+ final Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters) {
this.name = name;
this.restServerParameters = restServerParameters;
this.receptionHandlerParameters = receptionHandlerParameters;
this.receptionHandlerConfigurationParameters = receptionHandlerConfigurationParameters;
this.policyForwarderConfigurationParameters = policyForwarderConfigurationParameters;
+ this.policyDecoderConfigurationParameters = policyDecoderConfigurationParameters;
}
/**
@@ -130,7 +137,7 @@ public class DistributionParameterGroup implements ParameterGroup {
/**
* Sets the policy forwarder configuration parameter map.
*
- * @param eventInputParameters the policy forwarder configuration parameters
+ * @param policyForwarderConfigurationParameters the policy forwarder configuration parameters
*/
public void setPolicyForwarderConfigurationParameters(
final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters) {
@@ -138,6 +145,25 @@ public class DistributionParameterGroup implements ParameterGroup {
}
/**
+ * Returns the policy decoder configuration parameter map.
+ *
+ * @return the policyDecoderConfigurationParameters
+ */
+ public Map<String, PolicyDecoderConfigurationParameterGroup> getPolicyDecoderConfigurationParameters() {
+ return policyDecoderConfigurationParameters;
+ }
+
+ /**
+ * Set the policy decoder configuration parameter map.
+ *
+ * @param policyDecoderConfigurationParameters the policyDecoderConfigurationParameters to set
+ */
+ public void setPolicyDecoderConfigurationParameters(
+ final Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters) {
+ this.policyDecoderConfigurationParameters = policyDecoderConfigurationParameters;
+ }
+
+ /**
* Validate the parameter group.
*
* @return the result of the validation
@@ -156,13 +182,10 @@ public class DistributionParameterGroup implements ParameterGroup {
}
validateReceptionHandlers(validationResult);
validateForwarderConfigurations(validationResult);
+ validateDecoderConfigurations(validationResult);
return validationResult;
}
- /**
- * Validate the reception handlers.
- *
- */
private void validateReceptionHandlers(final GroupValidationResult validationResult) {
if (receptionHandlerParameters == null || receptionHandlerParameters.size() == 0) {
validationResult.setResult("receptionHandlerParameters", ValidationStatus.INVALID,
@@ -183,4 +206,12 @@ public class DistributionParameterGroup implements ParameterGroup {
configurationParameters.getValue().validate());
}
}
+
+ private void validateDecoderConfigurations(final GroupValidationResult validationResult) {
+ for (final Entry<String, PolicyDecoderConfigurationParameterGroup> configurationParameters : policyDecoderConfigurationParameters
+ .entrySet()) {
+ validationResult.setResult("policyDecoderConfigurationParameters", configurationParameters.getKey(),
+ configurationParameters.getValue().validate());
+ }
+ }
}
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java
index c1c64f7e..603c9869 100644
--- a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java
+++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java
@@ -22,18 +22,21 @@ package org.onap.policy.distribution.main.parameters;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+
import java.io.FileReader;
+
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.distribution.main.PolicyDistributionException;
import org.onap.policy.distribution.main.startstop.DistributionCommandLineArguments;
+import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
+import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParametersJsonAdapter;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParametersJsonAdapter;
/**
- * This class handles reading, parsing and validating of policy distribution parameters from JSON
- * files.
+ * This class handles reading, parsing and validating of policy distribution parameters from JSON files.
*/
public class DistributionParameterHandler {
private static final Logger LOGGER = FlexLogger.getLogger(DistributionParameterHandler.class);
@@ -57,6 +60,8 @@ public class DistributionParameterHandler {
new PolicyForwarderConfigurationParametersJsonAdapter())
.registerTypeAdapter(ReceptionHandlerConfigurationParameterGroup.class,
new ReceptionHandlerConfigurationParametersJsonAdapter())
+ .registerTypeAdapter(PolicyDecoderConfigurationParameterGroup.class,
+ new PolicyDecoderConfigurationParametersJsonAdapter())
.create();
distributionParameterGroup = gson.fromJson(new FileReader(arguments.getFullConfigurationFilePath()),
DistributionParameterGroup.class);
diff --git a/main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java b/main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java
index 91052580..1395b283 100644
--- a/main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java
+++ b/main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java
@@ -23,6 +23,7 @@ package org.onap.policy.distribution.main.startstop;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.common.parameters.ParameterService;
@@ -32,12 +33,13 @@ import org.onap.policy.distribution.main.parameters.PolicyForwarderConfiguration
import org.onap.policy.distribution.main.rest.DistributionRestServer;
import org.onap.policy.distribution.reception.decoding.PluginInitializationException;
import org.onap.policy.distribution.reception.handling.AbstractReceptionHandler;
+import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters;
/**
- * This class wraps a distributor so that it can be activated as a complete service together with
- * all its distribution and forwarding handlers.
+ * This class wraps a distributor so that it can be activated as a complete service together with all its distribution
+ * and forwarding handlers.
*/
public class DistributionActivator {
// The logger for this class
@@ -148,16 +150,23 @@ public class DistributionActivator {
ParameterService.register(params);
ParameterService.register(params.getPluginHandlerParameters());
}
- for (final Entry<String, PolicyForwarderConfigurationParameterGroup> forwarderConfiguration : distributionParameterGroup
- .getPolicyForwarderConfigurationParameters().entrySet()) {
+ //@formatter:off
+ for (final Entry<String, PolicyForwarderConfigurationParameterGroup> forwarderConfiguration
+ : distributionParameterGroup.getPolicyForwarderConfigurationParameters().entrySet()) {
forwarderConfiguration.getValue().setName(forwarderConfiguration.getKey());
ParameterService.register(forwarderConfiguration.getValue());
}
- for (final Entry<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfiguration : distributionParameterGroup
- .getReceptionHandlerConfigurationParameters().entrySet()) {
+ for (final Entry<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfiguration
+ : distributionParameterGroup.getReceptionHandlerConfigurationParameters().entrySet()) {
receptionHandlerConfiguration.getValue().setName(receptionHandlerConfiguration.getKey());
ParameterService.register(receptionHandlerConfiguration.getValue());
}
+ for (final Entry<String, PolicyDecoderConfigurationParameterGroup> decoderConfiguration
+ : distributionParameterGroup.getPolicyDecoderConfigurationParameters().entrySet()) {
+ decoderConfiguration.getValue().setName(decoderConfiguration.getKey());
+ ParameterService.register(decoderConfiguration.getValue());
+ }
+ //@formatter:on
}
/**
@@ -172,16 +181,23 @@ public class DistributionActivator {
ParameterService.deregister((params.getName()));
ParameterService.deregister((params.getPluginHandlerParameters().getName()));
}
- for (final Entry<String, PolicyForwarderConfigurationParameterGroup> forwarderConfiguration : distributionParameterGroup
- .getPolicyForwarderConfigurationParameters().entrySet()) {
+ //@formatter:off
+ for (final Entry<String, PolicyForwarderConfigurationParameterGroup> forwarderConfiguration
+ : distributionParameterGroup.getPolicyForwarderConfigurationParameters().entrySet()) {
forwarderConfiguration.getValue().setName(forwarderConfiguration.getKey());
ParameterService.deregister(forwarderConfiguration.getKey());
}
- for (final Entry<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfiguration : distributionParameterGroup
- .getReceptionHandlerConfigurationParameters().entrySet()) {
+ for (final Entry<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfiguration
+ : distributionParameterGroup.getReceptionHandlerConfigurationParameters().entrySet()) {
receptionHandlerConfiguration.getValue().setName(receptionHandlerConfiguration.getKey());
ParameterService.deregister(receptionHandlerConfiguration.getKey());
}
+ for (final Entry<String, PolicyDecoderConfigurationParameterGroup> decoderConfiguration
+ : distributionParameterGroup.getPolicyDecoderConfigurationParameters().entrySet()) {
+ decoderConfiguration.getValue().setName(decoderConfiguration.getKey());
+ ParameterService.deregister(decoderConfiguration.getKey());
+ }
+ //@formatter:on
}
/**
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 b1903152..96ec9f93 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
@@ -24,12 +24,15 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
+import org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup.DummyPolicyForwarderParameterGroupBuilder;
import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup;
import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup.DummyReceptionHandlerParameterGroupBuilder;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
+import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters;
@@ -65,6 +68,10 @@ public class CommonTestData {
public static final String DUMMY_ENGINE_FORWARDER_KEY = "DummyForwarder";
public static final String DUMMY_DECODER_KEY = "DummyDecoder";
+ public static final String POLICY_TYPE = "DUMMY";
+ public static final String POLICY_NAME = "SamplePolicy";
+ public static final String DECODER_CONFIGURATION_PARAMETERS = "dummyDecoderConfiguration";
+
/**
* Returns an instance of ReceptionHandlerParameters for test cases.
*
@@ -117,7 +124,7 @@ public class CommonTestData {
messageBusAddress.add("localhost");
final List<String> artifactTypes = new ArrayList<>();
artifactTypes.add("TOSCA_CSAR");
- DummyReceptionHandlerParameterGroup dummyReceptionHandlerParameterGroup =
+ final DummyReceptionHandlerParameterGroup dummyReceptionHandlerParameterGroup =
new DummyReceptionHandlerParameterGroupBuilder().setMyStringParameter(MY_STRING_PARAMETER_VALUE)
.setMyIntegerParameter(MY_INTEGER_PARAMETER_VALUE)
.setMyBooleanParameter(MY_BOOLEAN_PARAMETER_VALUE).build();
@@ -167,7 +174,8 @@ public class CommonTestData {
public Map<String, PolicyDecoderParameters> getPolicyDecoders(final boolean isEmpty) {
final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<String, PolicyDecoderParameters>();
if (!isEmpty) {
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME);
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
policyDecoders.put(DUMMY_DECODER_KEY, pDParameters);
}
return policyDecoders;
@@ -184,7 +192,7 @@ public class CommonTestData {
final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters =
new HashMap<String, PolicyForwarderConfigurationParameterGroup>();
if (!isEmpty) {
- DummyPolicyForwarderParameterGroup dummyPolicyForwarderParameterGroup =
+ final DummyPolicyForwarderParameterGroup dummyPolicyForwarderParameterGroup =
new DummyPolicyForwarderParameterGroupBuilder().setUseHttps(true).setHostname(FORWARDER_HOST)
.setPort(1234).setUserName("myUser").setPassword("myPassword").setIsManaged(true).build();
policyForwarderConfigurationParameters.put(FORWARDER_CONFIGURATION_PARAMETERS,
@@ -192,4 +200,23 @@ public class CommonTestData {
}
return policyForwarderConfigurationParameters;
}
+
+ /**
+ * Returns PolicyDecoderConfigurationParameterGroups for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return the PolicyDecoderConfigurationParameterGroups
+ */
+ public Map<String, PolicyDecoderConfigurationParameterGroup> getPolicyDecoderConfigurationParameters(
+ final boolean isEmpty) {
+ final Map<String, PolicyDecoderConfigurationParameterGroup> policyDecoderConfigurationParameters =
+ new HashMap<String, PolicyDecoderConfigurationParameterGroup>();
+ if (!isEmpty) {
+ final DummyPolicyDecoderParameterGroup dummyPolicyForwarderParameterGroup =
+ new DummyPolicyDecoderParameterGroup(POLICY_NAME, POLICY_TYPE);
+ policyDecoderConfigurationParameters.put(DECODER_CONFIGURATION_PARAMETERS,
+ dummyPolicyForwarderParameterGroup);
+ }
+ return policyDecoderConfigurationParameters;
+ }
}
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 6f6ddd81..8a33ac2c 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
@@ -26,10 +26,12 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Map;
+
import org.junit.Test;
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup;
import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup;
+import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters;
@@ -50,10 +52,12 @@ public class TestDistributionParameterGroup {
commonTestData.getReceptionHandlerConfigurationParameters(false);
final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations =
commonTestData.getPolicyForwarderConfigurationParameters(false);
+ final Map<String, PolicyDecoderConfigurationParameterGroup> decoderConfigurations =
+ commonTestData.getPolicyDecoderConfigurationParameters(false);
- final DistributionParameterGroup distributionParameters =
- new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters,
- receptionHandlerParameters, receptionHandlerConfigurations, forwarderConfigurations);
+ final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(
+ CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, receptionHandlerParameters,
+ receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
final GroupValidationResult validationResult = distributionParameters.validate();
assertTrue(validationResult.isValid());
assertEquals(restServerParameters.getHost(), distributionParameters.getRestServerParameters().getHost());
@@ -102,10 +106,12 @@ public class TestDistributionParameterGroup {
commonTestData.getReceptionHandlerConfigurationParameters(false);
final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations =
commonTestData.getPolicyForwarderConfigurationParameters(false);
+ final Map<String, PolicyDecoderConfigurationParameterGroup> decoderConfigurations =
+ commonTestData.getPolicyDecoderConfigurationParameters(false);
final DistributionParameterGroup distributionParameters =
new DistributionParameterGroup(null, restServerParameters, receptionHandlerParameters,
- receptionHandlerConfigurations, forwarderConfigurations);
+ receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
final GroupValidationResult validationResult = distributionParameters.validate();
assertFalse(validationResult.isValid());
assertEquals(null, distributionParameters.getName());
@@ -135,10 +141,12 @@ public class TestDistributionParameterGroup {
commonTestData.getReceptionHandlerConfigurationParameters(false);
final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations =
commonTestData.getPolicyForwarderConfigurationParameters(false);
+ final Map<String, PolicyDecoderConfigurationParameterGroup> decoderConfigurations =
+ commonTestData.getPolicyDecoderConfigurationParameters(false);
final DistributionParameterGroup distributionParameters =
new DistributionParameterGroup("", restServerParameters, receptionHandlerParameters,
- receptionHandlerConfigurations, forwarderConfigurations);
+ receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
final GroupValidationResult validationResult = distributionParameters.validate();
assertFalse(validationResult.isValid());
assertEquals("", distributionParameters.getName());
@@ -166,10 +174,12 @@ public class TestDistributionParameterGroup {
commonTestData.getReceptionHandlerConfigurationParameters(false);
final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations =
commonTestData.getPolicyForwarderConfigurationParameters(false);
+ final Map<String, PolicyDecoderConfigurationParameterGroup> decoderConfigurations =
+ commonTestData.getPolicyDecoderConfigurationParameters(false);
try {
final DistributionParameterGroup distributionParameters =
new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, null,
- receptionHandlerConfigurations, forwarderConfigurations);
+ receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
distributionParameters.validate();
fail("test should throw an exception here");
} catch (final Exception e) {
@@ -187,11 +197,13 @@ public class TestDistributionParameterGroup {
commonTestData.getReceptionHandlerConfigurationParameters(false);
final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations =
commonTestData.getPolicyForwarderConfigurationParameters(false);
- final DistributionParameterGroup distributionParameters =
- new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters,
- receptionHandlerParameters, receptionHandlerConfigurations, forwarderConfigurations);
+ final Map<String, PolicyDecoderConfigurationParameterGroup> decoderConfigurations =
+ commonTestData.getPolicyDecoderConfigurationParameters(false);
+ final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(
+ CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, receptionHandlerParameters,
+ receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
distributionParameters.validate();
- GroupValidationResult result = distributionParameters.validate();
+ final GroupValidationResult result = distributionParameters.validate();
assertFalse(result.isValid());
assertTrue(result.getResult().endsWith("must have at least one reception handler\n"));
}
@@ -205,10 +217,12 @@ public class TestDistributionParameterGroup {
commonTestData.getReceptionHandlerConfigurationParameters(false);
final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations =
commonTestData.getPolicyForwarderConfigurationParameters(false);
+ final Map<String, PolicyDecoderConfigurationParameterGroup> decoderConfigurations =
+ commonTestData.getPolicyDecoderConfigurationParameters(false);
- final DistributionParameterGroup distributionParameters =
- new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters,
- receptionHandlerParameters, receptionHandlerConfigurations, forwarderConfigurations);
+ final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(
+ CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, receptionHandlerParameters,
+ receptionHandlerConfigurations, forwarderConfigurations, decoderConfigurations);
final GroupValidationResult validationResult = distributionParameters.validate();
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
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 a5eab8b1..b66da8e6 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
@@ -31,6 +31,7 @@ import java.nio.file.Paths;
import org.junit.Test;
import org.onap.policy.distribution.main.PolicyDistributionException;
import org.onap.policy.distribution.main.startstop.DistributionCommandLineArguments;
+import org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup;
/**
@@ -42,7 +43,7 @@ public class TestDistributionParameterHandler {
@Test
public void testParameterHandlerNoParameterFile() throws PolicyDistributionException {
final String[] noArgumentString =
- { "-c", "parameters/NoParameterFile.json" };
+ { "-c", "parameters/NoParameterFile.json" };
final DistributionCommandLineArguments noArguments = new DistributionCommandLineArguments();
noArguments.parse(noArgumentString);
@@ -58,7 +59,7 @@ public class TestDistributionParameterHandler {
@Test
public void testParameterHandlerEmptyParameters() throws PolicyDistributionException {
final String[] emptyArgumentString =
- { "-c", "parameters/EmptyParameters.json" };
+ { "-c", "parameters/EmptyParameters.json" };
final DistributionCommandLineArguments emptyArguments = new DistributionCommandLineArguments();
emptyArguments.parse(emptyArgumentString);
@@ -74,7 +75,7 @@ public class TestDistributionParameterHandler {
@Test
public void testParameterHandlerBadParameters() throws PolicyDistributionException {
final String[] badArgumentString =
- { "-c", "parameters/BadParameters.json" };
+ { "-c", "parameters/BadParameters.json" };
final DistributionCommandLineArguments badArguments = new DistributionCommandLineArguments();
badArguments.parse(badArgumentString);
@@ -92,7 +93,7 @@ public class TestDistributionParameterHandler {
@Test
public void testParameterHandlerInvalidParameters() throws PolicyDistributionException {
final String[] invalidArgumentString =
- { "-c", "parameters/InvalidParameters.json" };
+ { "-c", "parameters/InvalidParameters.json" };
final DistributionCommandLineArguments invalidArguments = new DistributionCommandLineArguments();
invalidArguments.parse(invalidArgumentString);
@@ -110,7 +111,7 @@ public class TestDistributionParameterHandler {
@Test
public void testParameterHandlerNoParameters() throws PolicyDistributionException {
final String[] noArgumentString =
- { "-c", "parameters/NoParameters.json" };
+ { "-c", "parameters/NoParameters.json" };
final DistributionCommandLineArguments noArguments = new DistributionCommandLineArguments();
noArguments.parse(noArgumentString);
@@ -126,7 +127,7 @@ public class TestDistributionParameterHandler {
@Test
public void testParameterHandlerMinumumParameters() throws PolicyDistributionException {
final String[] minArgumentString =
- { "-c", "parameters/MinimumParameters.json" };
+ { "-c", "parameters/MinimumParameters.json" };
final DistributionCommandLineArguments minArguments = new DistributionCommandLineArguments();
minArguments.parse(minArgumentString);
@@ -138,7 +139,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters.json" };
+ { "-c", "parameters/DistributionConfigParameters.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -159,13 +160,19 @@ public class TestDistributionParameterHandler {
assertEquals(CommonTestData.FORWARDER_HOST,
((DummyPolicyForwarderParameterGroup) parGroup.getPolicyForwarderConfigurationParameters()
.get(CommonTestData.FORWARDER_CONFIGURATION_PARAMETERS)).getHostname());
+ assertEquals(CommonTestData.POLICY_TYPE,
+ ((DummyPolicyDecoderParameterGroup) parGroup.getPolicyDecoderConfigurationParameters()
+ .get(CommonTestData.DECODER_CONFIGURATION_PARAMETERS)).getPolicyType());
+ assertEquals(CommonTestData.POLICY_NAME,
+ ((DummyPolicyDecoderParameterGroup) parGroup.getPolicyDecoderConfigurationParameters()
+ .get(CommonTestData.DECODER_CONFIGURATION_PARAMETERS)).getPolicyName());
}
@Test
public void testDistributionParameterGroup_InvalidForwarderConfigurationClassName()
throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json" };
+ { "-c", "parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -182,7 +189,7 @@ public class TestDistributionParameterHandler {
public void testDistributionParameterGroup_UnknownForwarderConfigurationClassName()
throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json" };
+ { "-c", "parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -199,7 +206,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_InvalidName() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_InvalidName.json" };
+ { "-c", "parameters/DistributionConfigParameters_InvalidName.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -216,7 +223,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_NoReceptionHandler() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_NoReceptionHandler.json" };
+ { "-c", "parameters/DistributionConfigParameters_NoReceptionHandler.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -232,7 +239,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_EmptyReceptionHandler() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_EmptyReceptionHandler.json" };
+ { "-c", "parameters/DistributionConfigParameters_EmptyReceptionHandler.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -248,7 +255,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_NoPolicyDecoder() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_NoPolicyDecoder.json" };
+ { "-c", "parameters/DistributionConfigParameters_NoPolicyDecoder.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -264,7 +271,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_NoPolicyForwarder() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_NoPolicyForwarder.json" };
+ { "-c", "parameters/DistributionConfigParameters_NoPolicyForwarder.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -280,7 +287,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_EmptyPolicyDecoder() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_EmptyPolicyDecoder.json" };
+ { "-c", "parameters/DistributionConfigParameters_EmptyPolicyDecoder.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -296,7 +303,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_EmptyPolicyForwarder() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_EmptyPolicyForwarder.json" };
+ { "-c", "parameters/DistributionConfigParameters_EmptyPolicyForwarder.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -313,7 +320,7 @@ public class TestDistributionParameterHandler {
public void testDistributionParameterGroup_InvalidReceptionHandlerParameters()
throws PolicyDistributionException, IOException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json" };
+ { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -333,7 +340,7 @@ public class TestDistributionParameterHandler {
public void testDistributionParameterGroup_InvalidDecoderAndForwarderParameters()
throws PolicyDistributionException, IOException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json" };
+ { "-c", "parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -353,7 +360,7 @@ public class TestDistributionParameterHandler {
public void testDistributionParameterGroup_InvalidRestServerParameters()
throws PolicyDistributionException, IOException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_InvalidRestServerParameters.json" };
+ { "-c", "parameters/DistributionConfigParameters_InvalidRestServerParameters.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -372,7 +379,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionVersion() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-v" };
+ { "-v" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
final String version = arguments.parse(distributionConfigParameters);
assertTrue(version.startsWith("ONAP Policy Framework Distribution Service"));
@@ -381,7 +388,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionHelp() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-h" };
+ { "-h" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
final String help = arguments.parse(distributionConfigParameters);
assertTrue(help.startsWith("usage:"));
@@ -390,7 +397,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionInvalidOption() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-d" };
+ { "-d" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
try {
arguments.parse(distributionConfigParameters);
@@ -402,7 +409,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_InvalidReceptionHandlerClass() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json" };
+ { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -417,7 +424,7 @@ public class TestDistributionParameterHandler {
@Test
public void testDistributionParameterGroup_EmptyReceptionHandlerClass() throws PolicyDistributionException {
final String[] distributionConfigParameters =
- { "-c", "parameters/DistributionConfigParameters_EmptyReceptionHandlerClass.json" };
+ { "-c", "parameters/DistributionConfigParameters_EmptyReceptionHandlerClass.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
arguments.parse(distributionConfigParameters);
@@ -428,4 +435,39 @@ public class TestDistributionParameterHandler {
assertTrue(e.getMessage().contains("invalid in JSON file"));
}
}
+
+ @Test
+ public void testDistributionParameterGroup_InvalidDecoderConfigurationClassName()
+ throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidDecoderConfigurationClassName.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("parameter \"parameterClassName\" value \"\" invalid in JSON file"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_UnknownDecoderConfigurationClassName()
+ throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_UnknownDecoderConfigurationClassName.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(
+ "parameter \"parameterClassName\" value \"org.onap.policy.Unknown\", could not find class"));
+ }
+ }
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
index c2ab38d8..7b9e6095 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
@@ -23,6 +23,9 @@ package org.onap.policy.distribution.main.parameters;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_CLASS_NAME;
+import static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_CONFIGURATION_PARAMETERS;
+import static org.onap.policy.distribution.main.parameters.CommonTestData.DECODER_TYPE;
import org.junit.Test;
import org.onap.policy.common.parameters.GroupValidationResult;
@@ -38,19 +41,21 @@ public class TestPolicyDecoderParameters {
@Test
public void testPolicyDecoderParameters() {
final PolicyDecoderParameters pDParameters =
- new PolicyDecoderParameters(CommonTestData.DECODER_TYPE, CommonTestData.DECODER_CLASS_NAME);
+ new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
final GroupValidationResult validationResult = pDParameters.validate();
- assertEquals(CommonTestData.DECODER_TYPE, pDParameters.getDecoderType());
- assertEquals(CommonTestData.DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
+ assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
+ assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
+ assertEquals(DECODER_CONFIGURATION_PARAMETERS, pDParameters.getDecoderConfigurationName());
assertTrue(validationResult.isValid());
}
@Test
public void testPolicyDecoderParameters_InvalidDecoderType() {
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters("", CommonTestData.DECODER_CLASS_NAME);
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters("", DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
final GroupValidationResult validationResult = pDParameters.validate();
assertEquals("", pDParameters.getDecoderType());
- assertEquals(CommonTestData.DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
+ assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult().contains(
"field \"decoderType\" type \"java.lang.String\" value \"\" INVALID, must be a non-blank string"));
@@ -58,9 +63,10 @@ public class TestPolicyDecoderParameters {
@Test
public void testPolicyDecoderParameters_InvalidDecoderClassName() {
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(CommonTestData.DECODER_TYPE, "");
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters(DECODER_TYPE, "", DECODER_CONFIGURATION_PARAMETERS);
final GroupValidationResult validationResult = pDParameters.validate();
- assertEquals(CommonTestData.DECODER_TYPE, pDParameters.getDecoderType());
+ assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
assertEquals("", pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -70,7 +76,8 @@ public class TestPolicyDecoderParameters {
@Test
public void testPolicyDecoderParameters_InvalidDecoderTypeAndClassName() {
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters("", "");
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters("", "", DECODER_CONFIGURATION_PARAMETERS);
final GroupValidationResult validationResult = pDParameters.validate();
assertEquals("", pDParameters.getDecoderType());
assertEquals("", pDParameters.getDecoderClassName());
@@ -84,11 +91,11 @@ public class TestPolicyDecoderParameters {
@Test
public void testPolicyDecoderParameters_NullDecoderType() {
- final PolicyDecoderParameters pDParameters =
- new PolicyDecoderParameters(null, CommonTestData.DECODER_CLASS_NAME);
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters(null, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS);
final GroupValidationResult validationResult = pDParameters.validate();
assertEquals(null, pDParameters.getDecoderType());
- assertEquals(CommonTestData.DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
+ assertEquals(DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult().contains(
"field \"decoderType\" type \"java.lang.String\" value \"null\" INVALID, must be a non-blank string"));
@@ -96,9 +103,10 @@ public class TestPolicyDecoderParameters {
@Test
public void testPolicyDecoderParameters_NullDecoderClassName() {
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(CommonTestData.DECODER_TYPE, null);
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters(DECODER_TYPE, null, DECODER_CONFIGURATION_PARAMETERS);
final GroupValidationResult validationResult = pDParameters.validate();
- assertEquals(CommonTestData.DECODER_TYPE, pDParameters.getDecoderType());
+ assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
assertEquals(null, pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -108,11 +116,11 @@ public class TestPolicyDecoderParameters {
@Test
public void testPolicyDecoderParameters_InvalidDecoderClass() {
- final PolicyDecoderParameters pDParameters =
- new PolicyDecoderParameters(CommonTestData.DECODER_TYPE, CommonTestData.DECODER_CLASS_NAME + "Invalid");
+ final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(DECODER_TYPE,
+ DECODER_CLASS_NAME + "Invalid", DECODER_CONFIGURATION_PARAMETERS);
final GroupValidationResult validationResult = pDParameters.validate();
- assertEquals(CommonTestData.DECODER_TYPE, pDParameters.getDecoderType());
- assertEquals(CommonTestData.DECODER_CLASS_NAME + "Invalid", pDParameters.getDecoderClassName());
+ assertEquals(DECODER_TYPE, pDParameters.getDecoderType());
+ assertEquals(DECODER_CLASS_NAME + "Invalid", pDParameters.getDecoderClassName());
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult().contains("policy decoder class not found in classpath"));
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyDecoder.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyDecoder.java
index 19e30933..d210d970 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyDecoder.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyDecoder.java
@@ -56,4 +56,7 @@ public class DummyDecoder implements PolicyDecoder<PolicyInput, Policy> {
public Collection<Policy> decode(final PolicyInput input) throws PolicyDecodingException {
return policesToReturn;
}
+
+ @Override
+ public void configure(final String parameterGroupName) {}
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java
new file mode 100644
index 00000000..5d1738c5
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java
@@ -0,0 +1,64 @@
+/*-
+ * ============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.testclasses;
+
+import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
+
+/**
+ * Dummy policy decoder parameter group.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class DummyPolicyDecoderParameterGroup extends PolicyDecoderConfigurationParameterGroup {
+
+ private String policyName;
+ private String policyType;
+
+ /**
+ * Constructor for instantiating the {@link DummyPolicyDecoderParameterGroup} class.
+ *
+ * @param policyName the policy name
+ * @param policyType the policy type
+ */
+ public DummyPolicyDecoderParameterGroup(final String policyName, final String policyType) {
+ super();
+ this.policyName = policyName;
+ this.policyType = policyType;
+ }
+
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+
+ public String getPolicyType() {
+ return policyType;
+ }
+
+ @Override
+ public GroupValidationResult validate() {
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
+ return validationResult;
+ }
+
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters.json
index acf56764..71ca92e3 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -50,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
index e22af281..9e83ac19 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
@@ -46,5 +46,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
index 4d271308..2a7174e0 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -45,5 +46,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json
index c25b2e35..3560dbca 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json
@@ -30,5 +30,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandlerClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandlerClass.json
index ef129fd6..65ba903f 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandlerClass.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandlerClass.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -50,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json
index bd52e186..28f2195e 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json
@@ -15,15 +15,18 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
},
"APEXDecoder":{
"decoderType":"",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.PolicyDecoderApexPdpa"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.PolicyDecoderApexPdpa",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
},
"DROOLSDecoder":{
"decoderType":"DROOLS",
- "decoderClassName":""
+ "decoderClassName":"",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -69,5 +72,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderConfigurationClassName.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderConfigurationClassName.json
new file mode 100644
index 00000000..cba76644
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderConfigurationClassName.json
@@ -0,0 +1,64 @@
+{
+ "name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
+ "receptionHandlerParameters":{
+ "DummyReceptionHandler":{
+ "receptionHandlerType":"DummyReceptionHandler",
+ "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
+ "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration",
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "DummyDecoder":{
+ "decoderType":"DummyDecoder",
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
+ }
+ },
+ "policyForwarders":{
+ "DummyForwarder":{
+ "forwarderType":"DummyForwarder",
+ "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder",
+ "forwarderConfigurationParameters": "dummyConfiguration"
+ }
+ }
+ }
+ }
+ },
+ "receptionHandlerConfigurationParameters":{
+ "dummyReceptionHandlerConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup",
+ "parameters":{
+ "myStringParameter": "stringValue",
+ "myIntegerParameter":20,
+ "myBooleanParameter": true
+ }
+ }
+ },
+ "policyForwarderConfigurationParameters":{
+ "dummyConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup",
+ "parameters":{
+ "useHttps": false,
+ "hostname": "192.168.99.100",
+ "port": 8081,
+ "userName": "user",
+ "password": "pw123",
+ "isManaged": true
+ }
+ }
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
+ }
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json
index 60c28e08..13265c8a 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -50,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
index 46207204..9a0b309f 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -50,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
index d033a730..350ace9e 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -50,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json
index 123ff203..6776c370 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -50,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json
index 47528ce0..b5fd9a7a 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -50,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
index f78bb65f..a007c30b 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
@@ -44,5 +44,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
index 3ac54f73..72608b3b 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
}
}
@@ -30,5 +31,14 @@
"myBooleanParameter": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_UnknownDecoderConfigurationClassName.json b/main/src/test/resources/parameters/DistributionConfigParameters_UnknownDecoderConfigurationClassName.json
new file mode 100644
index 00000000..2ce665f9
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_UnknownDecoderConfigurationClassName.json
@@ -0,0 +1,64 @@
+{
+ "name":"SDCDistributionGroup",
+ "restServerParameters":{
+ "host":"0.0.0.0",
+ "port":6969,
+ "userName":"healthcheck",
+ "password":"zb!XztG34"
+ },
+ "receptionHandlerParameters":{
+ "DummyReceptionHandler":{
+ "receptionHandlerType":"DummyReceptionHandler",
+ "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
+ "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration",
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "DummyDecoder":{
+ "decoderType":"DummyDecoder",
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
+ }
+ },
+ "policyForwarders":{
+ "DummyForwarder":{
+ "forwarderType":"DummyForwarder",
+ "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder",
+ "forwarderConfigurationParameters": "dummyConfiguration"
+ }
+ }
+ }
+ }
+ },
+ "receptionHandlerConfigurationParameters":{
+ "dummyReceptionHandlerConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup",
+ "parameters":{
+ "myStringParameter": "stringValue",
+ "myIntegerParameter":20,
+ "myBooleanParameter": true
+ }
+ }
+ },
+ "policyForwarderConfigurationParameters":{
+ "dummyConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup",
+ "parameters":{
+ "useHttps": false,
+ "hostname": "192.168.99.100",
+ "port": 8081,
+ "userName": "user",
+ "password": "pw123",
+ "isManaged": true
+ }
+ }
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.Unknown",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
+ }
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json b/main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json
index 3118631b..1883b221 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json
@@ -10,35 +10,13 @@
"DummyReceptionHandler":{
"receptionHandlerType":"DummyReceptionHandler",
"receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
- "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
- },
+ "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration",
"pluginHandlerParameters":{
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationParameters": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -73,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}
diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json
index fc6b16aa..5401d924 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -15,7 +15,8 @@
"policyDecoders":{
"DummyDecoder":{
"decoderType":"DummyDecoder",
- "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
+ "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder",
+ "decoderConfigurationName": "dummyDecoderConfiguration"
}
},
"policyForwarders":{
@@ -50,5 +51,14 @@
"isManaged": true
}
}
+ },
+ "policyDecoderConfigurationParameters":{
+ "dummyDecoderConfiguration":{
+ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup",
+ "parameters":{
+ "policyName": "SamplePolicy",
+ "policyType": "DUMMY"
+ }
+ }
}
}