aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/pom.xml10
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java63
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/PluginHandlerParameters.java102
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyDecoderParameters.java97
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderParameters.java97
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/ReceptionHandlerParameters.java116
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java114
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java137
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java356
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestParameterGroup.java46
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestParameterHandler.java127
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java101
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java117
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java121
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java138
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters.json23
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json19
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json19
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json5
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json23
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json31
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json23
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json27
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json23
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json23
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json23
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json17
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json17
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json3
-rw-r--r--main/src/test/resources/parameters/MinimumParameters.json24
30 files changed, 1854 insertions, 188 deletions
diff --git a/main/pom.xml b/main/pom.xml
index 1084f937..468f3fea 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -33,6 +33,16 @@
<dependencies>
<dependency>
+ <groupId>org.onap.policy.distribution</groupId>
+ <artifactId>reception-plugins</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.distribution</groupId>
+ <artifactId>forwarding-plugins</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>utils</artifactId>
<version>1.3.0-SNAPSHOT</version>
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 f4180e01..d84d4c4b 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
@@ -5,40 +5,51 @@
* 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.parameters;
-import org.onap.policy.common.parameters.ParameterGroup;
+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;
+/**
+ * Class to hold all parameters needed for Distribution component.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
public class DistributionParameterGroup implements ParameterGroup {
private String name;
+ private Map<String, ReceptionHandlerParameters> receptionHandlerParameters;
/**
* Create the distribution parameter group.
- *
+ *
* @param name the parameter group name
*/
- public DistributionParameterGroup(final String name) {
+ public DistributionParameterGroup(final String name,
+ final Map<String, ReceptionHandlerParameters> receptionHandlerParameters) {
this.name = name;
+ this.receptionHandlerParameters = receptionHandlerParameters;
}
/**
- * Return the name of this parameter group instance
- *
+ * Return the name of this parameter group instance.
+ *
* @return name the parameter group name
*/
@Override
@@ -47,18 +58,44 @@ public class DistributionParameterGroup implements ParameterGroup {
}
/**
- * Validate the parameter group
- *
+ * Return the receptionHandlerParameters of this parameter group instance.
+ *
+ * @return the receptionHandlerParameters
+ */
+ public Map<String, ReceptionHandlerParameters> getReceptionHandlerParameters() {
+ return receptionHandlerParameters;
+ }
+
+ /**
+ * Validate the parameter group.
+ *
* @return the result of the validation
*/
@Override
public GroupValidationResult validate() {
- GroupValidationResult validationResult = new GroupValidationResult(this);
-
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
if (name == null || name.trim().length() == 0) {
validationResult.setResult("name", ValidationStatus.INVALID, "must be a non-blank string");
+ } else {
+ validateReceptionHandlers(validationResult);
}
-
return validationResult;
}
+
+ /**
+ * Validate the reception handlers.
+ *
+ */
+ private void validateReceptionHandlers(final GroupValidationResult validationResult) {
+ if (receptionHandlerParameters == null || receptionHandlerParameters.size() == 0) {
+ validationResult.setResult("receptionHandlerParameters", ValidationStatus.INVALID,
+ "must have at least one reception handler");
+ } else {
+ for (final Entry<String, ReceptionHandlerParameters> nestedGroupEntry : receptionHandlerParameters
+ .entrySet()) {
+ validationResult.setResult("receptionHandlerParameters", nestedGroupEntry.getKey(),
+ nestedGroupEntry.getValue().validate());
+ }
+ }
+ }
}
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/PluginHandlerParameters.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/PluginHandlerParameters.java
new file mode 100644
index 00000000..39479131
--- /dev/null
+++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/PluginHandlerParameters.java
@@ -0,0 +1,102 @@
+/*-
+ * ============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.parameters;
+
+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;
+
+/**
+ * Class to hold all the plugin handler parameters.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class PluginHandlerParameters implements ParameterGroup {
+
+ private Map<String, PolicyDecoderParameters> policyDecoders;
+ private Map<String, PolicyForwarderParameters> policyForwarders;
+
+ /**
+ * Constructor for instantiating PluginHandlerParameters.
+ *
+ * @param policyDecoders the map of policy decoders
+ * @param policyForwarders the map of policy forwarders
+ */
+ public PluginHandlerParameters(final Map<String, PolicyDecoderParameters> policyDecoders,
+ final Map<String, PolicyForwarderParameters> policyForwarders) {
+ this.policyDecoders = policyDecoders;
+ this.policyForwarders = policyForwarders;
+ }
+
+ /**
+ * Return the policyDecoders of this PluginHandlerParameters instance.
+ *
+ * @return the policyDecoders
+ */
+ public Map<String, PolicyDecoderParameters> getPolicyDecoders() {
+ return policyDecoders;
+ }
+
+ /**
+ * Return the policyForwarders of this PluginHandlerParameters instance.
+ *
+ * @return the policyForwarders
+ */
+ public Map<String, PolicyForwarderParameters> getPolicyForwarders() {
+ return policyForwarders;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ /**
+ * Validate the plugin handler parameters.
+ *
+ */
+ @Override
+ public GroupValidationResult validate() {
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
+ if (policyDecoders == null || policyDecoders.size() == 0) {
+ validationResult.setResult("policyDecoders", ValidationStatus.INVALID,
+ "must have at least one policy decoder");
+ } else {
+ for (final Entry<String, PolicyDecoderParameters> nestedGroupEntry : policyDecoders.entrySet()) {
+ validationResult.setResult("policyDecoders", nestedGroupEntry.getKey(),
+ nestedGroupEntry.getValue().validate());
+ }
+ }
+ if (policyForwarders == null || policyForwarders.size() == 0) {
+ validationResult.setResult("policyForwarders", ValidationStatus.INVALID,
+ "must have at least one policy forwarder");
+ } else {
+ for (final Entry<String, PolicyForwarderParameters> nestedGroupEntry : policyForwarders.entrySet()) {
+ validationResult.setResult("policyForwarders", nestedGroupEntry.getKey(),
+ nestedGroupEntry.getValue().validate());
+ }
+ }
+ return validationResult;
+ }
+}
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyDecoderParameters.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyDecoderParameters.java
new file mode 100644
index 00000000..c8020479
--- /dev/null
+++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyDecoderParameters.java
@@ -0,0 +1,97 @@
+/*-
+ * ============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.parameters;
+
+import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ValidationStatus;
+
+/**
+ * Class to hold all the policy decoder parameters.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class PolicyDecoderParameters implements ParameterGroup {
+ private String decoderType;
+ private String decoderClassName;
+
+ /**
+ * Constructor for instantiating PolicyDecoderParameters.
+ *
+ * @param decoderType the policy decoder type
+ * @param decoderClassName the policy decoder class name
+ */
+ public PolicyDecoderParameters(final String decoderType, final String decoderClassName) {
+ this.decoderType = decoderType;
+ this.decoderClassName = decoderClassName;
+ }
+
+ /**
+ * Return the decoderType of this PolicyDecoderParameters instance.
+ *
+ * @return the decoderType
+ */
+ public String getDecoderType() {
+ return decoderType;
+ }
+
+ /**
+ * Return the decoderClassName of this PolicyDecoderParameters instance.
+ *
+ * @return the decoderClassName
+ */
+ public String getDecoderClassName() {
+ return decoderClassName;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ /**
+ * Validate the policy decoder parameters.
+ *
+ */
+ @Override
+ public GroupValidationResult validate() {
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
+ if (decoderType == null || decoderType.trim().length() == 0) {
+ validationResult.setResult("decoderType", ValidationStatus.INVALID, "must be a non-blank string");
+ }
+ if (decoderClassName == null || decoderClassName.trim().length() == 0) {
+ validationResult.setResult("decoderClassName", ValidationStatus.INVALID,
+ "must be a non-blank string containing full class name of the decoder");
+ } else {
+ validatePolicyDecoderClass(validationResult);
+ }
+ return validationResult;
+ }
+
+ private void validatePolicyDecoderClass(final GroupValidationResult validationResult) {
+ try {
+ Class.forName(decoderClassName);
+ } catch (final ClassNotFoundException e) {
+ validationResult.setResult("decoderClassName", ValidationStatus.INVALID,
+ "policy decoder class not found in classpath");
+ }
+ }
+}
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderParameters.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderParameters.java
new file mode 100644
index 00000000..49ad1c8e
--- /dev/null
+++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderParameters.java
@@ -0,0 +1,97 @@
+/*-
+ * ============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.parameters;
+
+import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ValidationStatus;
+
+/**
+ * Class to hold all the policy forwarder parameters.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class PolicyForwarderParameters implements ParameterGroup {
+ private String forwarderType;
+ private String forwarderClassName;
+
+ /**
+ * Constructor for instantiating PolicyForwarderParameters.
+ *
+ * @param forwarderType the policy forwarder type
+ * @param forwarderClassName the policy forwarder class name
+ */
+ public PolicyForwarderParameters(final String forwarderType, final String forwarderClassName) {
+ this.forwarderType = forwarderType;
+ this.forwarderClassName = forwarderClassName;
+ }
+
+ /**
+ * Return the forwarderType of this PolicyForwarderParameters instance.
+ *
+ * @return the forwarderType
+ */
+ public String getForwarderType() {
+ return forwarderType;
+ }
+
+ /**
+ * Return the forwarderClassName of this PolicyForwarderParameters instance.
+ *
+ * @return the forwarderClassName
+ */
+ public String getForwarderClassName() {
+ return forwarderClassName;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ /**
+ * Validate the policy forwarder parameters.
+ *
+ */
+ @Override
+ public GroupValidationResult validate() {
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
+ if (forwarderType == null || forwarderType.trim().length() == 0) {
+ validationResult.setResult("forwarderType", ValidationStatus.INVALID, "must be a non-blank string");
+ }
+ if (forwarderClassName == null || forwarderClassName.trim().length() == 0) {
+ validationResult.setResult("forwarderClassName", ValidationStatus.INVALID,
+ "must be a non-blank string containing full class name of the forwarder");
+ } else {
+ validatePolicyForwarderClass(validationResult);
+ }
+ return validationResult;
+ }
+
+ private void validatePolicyForwarderClass(final GroupValidationResult validationResult) {
+ try {
+ Class.forName(forwarderClassName);
+ } catch (final ClassNotFoundException e) {
+ validationResult.setResult("forwarderClassName", ValidationStatus.INVALID,
+ "policy forwarder class not found in classpath");
+ }
+ }
+}
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/ReceptionHandlerParameters.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/ReceptionHandlerParameters.java
new file mode 100644
index 00000000..a3c2c16c
--- /dev/null
+++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/ReceptionHandlerParameters.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.parameters;
+
+import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ValidationStatus;
+
+/**
+ * Class to hold all the reception handler parameters.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class ReceptionHandlerParameters implements ParameterGroup {
+ private String receptionHandlerType;
+ private String receptionHandlerClassName;
+ private PluginHandlerParameters pluginHandlerParameters;
+
+ /**
+ * Constructor for instantiating ReceptionHandlerParameters.
+ *
+ * @param receptionHandlerType the reception handler type
+ * @param receptionHandlerClassName the reception handler class name
+ * @param pluginHandlerParameters the plugin handler parameters
+ */
+ public ReceptionHandlerParameters(final String receptionHandlerType, final String receptionHandlerClassName,
+ final PluginHandlerParameters pluginHandlerParameters) {
+ this.receptionHandlerType = receptionHandlerType;
+ this.receptionHandlerClassName = receptionHandlerClassName;
+ this.pluginHandlerParameters = pluginHandlerParameters;
+ }
+
+ /**
+ * Return the receptionHandlerType of this ReceptionHandlerParameters instance.
+ *
+ * @return the receptionHandlerType
+ */
+ public String getReceptionHandlerType() {
+ return receptionHandlerType;
+ }
+
+ /**
+ * Return the receptionHandlerClassName of this ReceptionHandlerParameters instance.
+ *
+ * @return the receptionHandlerClassName
+ */
+ public String getReceptionHandlerClassName() {
+ return receptionHandlerClassName;
+ }
+
+ /**
+ * Return the pluginHandlerParameters of this ReceptionHandlerParameters instance.
+ *
+ * @return the pluginHandlerParameters
+ */
+ public PluginHandlerParameters getPluginHandlerParameters() {
+ return pluginHandlerParameters;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ /**
+ * Validate the reception handler parameters.
+ *
+ */
+ @Override
+ public GroupValidationResult validate() {
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
+ if (receptionHandlerType == null || receptionHandlerType.trim().length() == 0) {
+ validationResult.setResult("receptionHandlerType", ValidationStatus.INVALID, "must be a non-blank string");
+ }
+ if (receptionHandlerClassName == null || receptionHandlerClassName.trim().length() == 0) {
+ validationResult.setResult("receptionHandlerClassName", ValidationStatus.INVALID,
+ "must be a non-blank string containing full class name of the reception handler");
+ } else {
+ validateReceptionHandlerClass(validationResult);
+ }
+ if (pluginHandlerParameters == null) {
+ validationResult.setResult("pluginHandlerParameters", ValidationStatus.INVALID,
+ "must have a plugin handler");
+ } else {
+ validationResult.setResult("pluginHandlerParameters", pluginHandlerParameters.validate());
+ }
+ return validationResult;
+ }
+
+ private void validateReceptionHandlerClass(final GroupValidationResult validationResult) {
+ try {
+ Class.forName(receptionHandlerClassName);
+ } catch (final ClassNotFoundException e) {
+ validationResult.setResult("receptionHandlerClassName", ValidationStatus.INVALID,
+ "reception handler class not found in classpath");
+ }
+ }
+}
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
new file mode 100644
index 00000000..953fa7b0
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
@@ -0,0 +1,114 @@
+/*-
+ * ============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.parameters;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Class to hold/create all parameters for test cases.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class CommonTestData {
+
+ public static final String decoderType = "TOSCA";
+ public static final String decoderClassName =
+ "org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx";
+ public static final String forwarderType = "PAPEngine";
+ public static final String forwarderClassName =
+ "org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder";
+ public static final String receptionHandlerType = "SDCReceptionHandler";
+ public static final String receptionHandlerClassName =
+ "org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler";
+
+ /**
+ * 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) {
+ final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
+ new HashMap<String, ReceptionHandlerParameters>();
+ if (!isEmpty) {
+ final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders(isEmpty);
+ final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders(isEmpty);
+ final String receptionHandlerType = "SDC";
+ final String receptionHandlerClassName =
+ "org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler";
+ final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ final ReceptionHandlerParameters rhParameters =
+ new ReceptionHandlerParameters(receptionHandlerType, receptionHandlerClassName, pHParameters);
+ receptionHandlerParameters.put("SDCReceptionHandler", rhParameters);
+ }
+ return receptionHandlerParameters;
+ }
+
+ /**
+ * Returns an instance of PluginHandlerParameters for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return the pluginHandlerParameters object
+ */
+ public PluginHandlerParameters getPluginHandlerParameters(final boolean isEmpty) {
+ final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders(isEmpty);
+ final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders(isEmpty);
+ final PluginHandlerParameters pluginHandlerParameters =
+ new PluginHandlerParameters(policyDecoders, policyForwarders);
+ return pluginHandlerParameters;
+ }
+
+ /**
+ * Returns an instance of PolicyForwarderParameters for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return the policyForwarders object
+ */
+ public Map<String, PolicyForwarderParameters> getPolicyForwarders(final boolean isEmpty) {
+ final Map<String, PolicyForwarderParameters> policyForwarders =
+ new HashMap<String, PolicyForwarderParameters>();
+ if (!isEmpty) {
+ final String forwarderType = "PAPEngine";
+ final String forwarderClassName =
+ "org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder";
+ final PolicyForwarderParameters pFParameters =
+ new PolicyForwarderParameters(forwarderType, forwarderClassName);
+ policyForwarders.put("PAPEngineForwarder", pFParameters);
+ }
+ return policyForwarders;
+ }
+
+ /**
+ * Returns an instance of PolicyDecoderParameters for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return the policyDecoders object
+ */
+ public Map<String, PolicyDecoderParameters> getPolicyDecoders(final boolean isEmpty) {
+ final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<String, PolicyDecoderParameters>();
+ if (!isEmpty) {
+ final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(decoderType, decoderClassName);
+ policyDecoders.put("TOSCADecoder", pDParameters);
+ }
+ return policyDecoders;
+ }
+}
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
new file mode 100644
index 00000000..cce432dc
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
@@ -0,0 +1,137 @@
+/*-
+ * ============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.parameters;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.policy.common.parameters.GroupValidationResult;
+
+/**
+ * Class to perform unit test of DistributionParameterGroup.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class TestDistributionParameterGroup {
+ CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ public void testDistributionParameterGroup() {
+ final String name = "SDCDistributionGroup";
+ final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
+ commonTestData.getReceptionHandlerParameters(false);
+
+ final DistributionParameterGroup distributionParameters =
+ new DistributionParameterGroup(name, receptionHandlerParameters);
+ final GroupValidationResult validationResult = distributionParameters.validate();
+ assertTrue(validationResult.isValid());
+ assertEquals(name, distributionParameters.getName());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getReceptionHandlerType(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getReceptionHandlerType());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getReceptionHandlerClassName(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getReceptionHandlerClassName());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getPluginHandlerParameters(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getPluginHandlerParameters());
+ }
+
+ @Test
+ public void testDistributionParameterGroup_NullName() {
+ final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
+ commonTestData.getReceptionHandlerParameters(false);
+
+ final DistributionParameterGroup distributionParameters =
+ new DistributionParameterGroup(null, receptionHandlerParameters);
+ final GroupValidationResult validationResult = distributionParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertEquals(null, distributionParameters.getName());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getReceptionHandlerType(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getReceptionHandlerType());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getReceptionHandlerClassName(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getReceptionHandlerClassName());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getPluginHandlerParameters(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getPluginHandlerParameters());
+ assertTrue(validationResult.getResult().contains(
+ "field \"name\" type \"java.lang.String\" value \"null\" INVALID, " + "must be a non-blank string"));
+ }
+
+ @Test
+ public void testDistributionParameterGroup_EmptyName() {
+ final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
+ commonTestData.getReceptionHandlerParameters(false);
+
+ final DistributionParameterGroup distributionParameters =
+ new DistributionParameterGroup("", receptionHandlerParameters);
+ final GroupValidationResult validationResult = distributionParameters.validate();
+ assertFalse(validationResult.isValid());
+ assertEquals("", distributionParameters.getName());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getReceptionHandlerType(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getReceptionHandlerType());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getReceptionHandlerClassName(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getReceptionHandlerClassName());
+ assertEquals(receptionHandlerParameters.get("SDCReceptionHandler").getPluginHandlerParameters(),
+ distributionParameters.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getPluginHandlerParameters());
+ assertTrue(validationResult.getResult().contains(
+ "field \"name\" type \"java.lang.String\" value \"\" INVALID, " + "must be a non-blank string"));
+ }
+
+ @Test
+ public void testDistributionParameterGroup_NullReceptionHandlerParameters() {
+ final String name = "SDCDistributionGroup";
+ try {
+ final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(name, null);
+ distributionParameters.validate();
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains("map parameter \"receptionHandlerParameters\" is null"));
+ }
+
+ }
+
+ @Test
+ public void testDistributionParameterGroup_EmptyReceptionHandlerParameters() {
+ final String name = "SDCDistributionGroup";
+ final Map<String, ReceptionHandlerParameters> receptionHandlerParameters =
+ commonTestData.getReceptionHandlerParameters(true);
+ try {
+ final DistributionParameterGroup distributionParameters =
+ new DistributionParameterGroup(name, receptionHandlerParameters);
+ distributionParameters.validate();
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains("parameter not a regular parameter: receptionHandlerParameters"));
+ }
+
+ }
+}
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
new file mode 100644
index 00000000..57610b23
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
@@ -0,0 +1,356 @@
+/*-
+ * ============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.parameters;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.onap.policy.distribution.main.PolicyDistributionException;
+import org.onap.policy.distribution.main.startstop.DistributionCommandLineArguments;
+
+/**
+ * Class to perform unit test of DistributionParameterHandler.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class TestDistributionParameterHandler {
+ @Test
+ public void testParameterHandlerNoParameterFile() throws PolicyDistributionException {
+ final String[] noArgumentString = { "-c", "parameters/NoParameterFile.json" };
+
+ final DistributionCommandLineArguments noArguments = new DistributionCommandLineArguments();
+ noArguments.parse(noArgumentString);
+
+ try {
+ new DistributionParameterHandler().getParameters(noArguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains("FileNotFoundException"));
+ }
+ }
+
+ @Test
+ public void testParameterHandlerEmptyParameters() throws PolicyDistributionException {
+ final String[] emptyArgumentString = { "-c", "parameters/EmptyParameters.json" };
+
+ final DistributionCommandLineArguments emptyArguments = new DistributionCommandLineArguments();
+ emptyArguments.parse(emptyArgumentString);
+
+ try {
+ new DistributionParameterHandler().getParameters(emptyArguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertEquals("no parameters found in \"parameters/EmptyParameters.json\"", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testParameterHandlerBadParameters() throws PolicyDistributionException {
+ final String[] badArgumentString = { "-c", "parameters/BadParameters.json" };
+
+ final DistributionCommandLineArguments badArguments = new DistributionCommandLineArguments();
+ badArguments.parse(badArgumentString);
+
+ try {
+ new DistributionParameterHandler().getParameters(badArguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertEquals("error reading parameters from \"parameters/BadParameters.json\"\n"
+ + "(JsonSyntaxException):java.lang.IllegalStateException: "
+ + "Expected a string but was BEGIN_ARRAY at line 2 column 15 path $.name", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testParameterHandlerInvalidParameters() throws PolicyDistributionException {
+ final String[] invalidArgumentString = { "-c", "parameters/InvalidParameters.json" };
+
+ final DistributionCommandLineArguments invalidArguments = new DistributionCommandLineArguments();
+ invalidArguments.parse(invalidArgumentString);
+
+ try {
+ new DistributionParameterHandler().getParameters(invalidArguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertEquals("error reading parameters from \"parameters/InvalidParameters.json\"\n"
+ + "(JsonSyntaxException):java.lang.IllegalStateException: "
+ + "Expected a string but was BEGIN_ARRAY at line 2 column 15 path $.name", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testParameterHandlerNoParameters() throws PolicyDistributionException {
+ final String[] noArgumentString = { "-c", "parameters/NoParameters.json" };
+
+ final DistributionCommandLineArguments noArguments = new DistributionCommandLineArguments();
+ noArguments.parse(noArgumentString);
+
+ try {
+ new DistributionParameterHandler().getParameters(noArguments);
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertEquals("map parameter \"receptionHandlerParameters\" is null", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testParameterHandlerMinumumParameters() throws PolicyDistributionException {
+ final String[] minArgumentString = { "-c", "parameters/MinimumParameters.json" };
+
+ final DistributionCommandLineArguments minArguments = new DistributionCommandLineArguments();
+ minArguments.parse(minArgumentString);
+
+ final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(minArguments);
+ assertEquals("SDCDistributionGroup", parGroup.getName());
+ }
+
+ @Test
+ public void testDistributionParameterGroup() throws PolicyDistributionException {
+ final String[] distributionConfigParameters = { "-c", "parameters/DistributionConfigParameters.json" };
+
+ final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ arguments.parse(distributionConfigParameters);
+
+ final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(arguments);
+ assertEquals("SDCDistributionGroup", parGroup.getName());
+ assertEquals("SDC",
+ parGroup.getReceptionHandlerParameters().get("SDCReceptionHandler").getReceptionHandlerType());
+ assertEquals("TOSCA", parGroup.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getPluginHandlerParameters().getPolicyDecoders().get("TOSCADecoder").getDecoderType());
+ assertEquals("PAPEngine", parGroup.getReceptionHandlerParameters().get("SDCReceptionHandler")
+ .getPluginHandlerParameters().getPolicyForwarders().get("PAPEngineForwarder").getForwarderType());
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidName() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidName.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(
+ "field \"name\" type \"java.lang.String\" value \" \" INVALID, must be a non-blank string"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidReceptionHandlerType() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerType.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("field \"receptionHandlerType\" type \"java.lang.String\" value \" \" INVALID, "
+ + "must be a non-blank string"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidPolicyDecoderType() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidPolicyDecoderType.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(
+ "field \"decoderType\" type \"java.lang.String\" value \" \" INVALID, must be a non-blank string"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidPolicyForwarderType() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidPolicyForwarderType.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("field \"forwarderType\" type \"java.lang.String\" value \" \" INVALID, "
+ + "must be a non-blank string"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_NoReceptionHandler() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_NoReceptionHandler.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("map parameter \"receptionHandlerParameters\" is null"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_EmptyReceptionHandler() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_EmptyReceptionHandler.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 not a regular parameter: receptionHandlerParameters"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_NoPolicyDecoder() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_NoPolicyDecoder.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("map parameter \"policyDecoders\" is null"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_NoPolicyForwarder() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_NoPolicyForwarder.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("map parameter \"policyForwarders\" is null"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_EmptyPolicyDecoder() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_EmptyPolicyDecoder.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 not a regular parameter: policyDecoders"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_EmptyPolicyForwarder() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_EmptyPolicyForwarder.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 not a regular parameter: policyForwarders"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidReceptionHandlerClass() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.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("reception handler class not found in classpath"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidPolicyDecoderClass() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.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("policy decoder class not found in classpath"));
+ }
+ }
+
+ @Test
+ public void testDistributionParameterGroup_InvalidPolicyForwarderClass() throws PolicyDistributionException {
+ final String[] distributionConfigParameters =
+ { "-c", "parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.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("policy forwarder class not found in classpath"));
+ }
+ }
+}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestParameterGroup.java
deleted file mode 100644
index bf553918..00000000
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestParameterGroup.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============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.parameters;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class TestParameterGroup {
-
- @Test
- public void testParameterGroup() {
- DistributionParameterGroup parameterGroup = new DistributionParameterGroup("groupName");
- assertEquals("groupName", parameterGroup.getName());
- assertTrue(parameterGroup.isValid());
-
- parameterGroup = new DistributionParameterGroup(null);
- assertNull(parameterGroup.getName());
- assertFalse(parameterGroup.isValid());
-
- parameterGroup = new DistributionParameterGroup("");
- assertEquals("", parameterGroup.getName());
- assertFalse(parameterGroup.isValid());
- }
-}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestParameterHandler.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestParameterHandler.java
deleted file mode 100644
index 5b938988..00000000
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestParameterHandler.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * ============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.parameters;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.junit.Test;
-import org.onap.policy.distribution.main.PolicyDistributionException;
-import org.onap.policy.distribution.main.startstop.DistributionCommandLineArguments;
-
-public class TestParameterHandler {
- @Test
- public void testParameterHandlerNoParameterFile() throws PolicyDistributionException {
- String[] noArgumentString = { "-c", "parameters/NoParameterFile.json" };
-
- DistributionCommandLineArguments noArguments = new DistributionCommandLineArguments();
- noArguments.parse(noArgumentString);
-
- try {
- new DistributionParameterHandler().getParameters(noArguments);
- fail("test should throw an exception here");
- } catch (Exception e) {
- assertEquals("error reading parameters from \"parameters/NoParameterFile.json\"\n"
- + "(FileNotFoundException):parameters/NoParameterFile.json (No such file or directory)",
- e.getMessage());
- }
- }
-
- @Test
- public void testParameterHandlerEmptyParameters() throws PolicyDistributionException {
- String[] emptyArgumentString = { "-c", "parameters/EmptyParameters.json" };
-
- DistributionCommandLineArguments emptyArguments = new DistributionCommandLineArguments();
- emptyArguments.parse(emptyArgumentString);
-
- try {
- new DistributionParameterHandler().getParameters(emptyArguments);
- fail("test should throw an exception here");
- } catch (Exception e) {
- assertEquals("no parameters found in \"parameters/EmptyParameters.json\"", e.getMessage());
- }
- }
-
- @Test
- public void testParameterHandlerBadParameters() throws PolicyDistributionException {
- String[] badArgumentString = { "-c", "parameters/BadParameters.json" };
-
- DistributionCommandLineArguments badArguments = new DistributionCommandLineArguments();
- badArguments.parse(badArgumentString);
-
- try {
- new DistributionParameterHandler().getParameters(badArguments);
- fail("test should throw an exception here");
- } catch (Exception e) {
- assertEquals("error reading parameters from \"parameters/BadParameters.json\"\n"
- + "(JsonSyntaxException):java.lang.IllegalStateException: "
- + "Expected a string but was BEGIN_ARRAY at line 2 column 15 path $.name", e.getMessage());
- }
- }
-
- @Test
- public void testParameterHandlerInvalidParameters() throws PolicyDistributionException {
- String[] invalidArgumentString = { "-c", "parameters/InvalidParameters.json" };
-
- DistributionCommandLineArguments invalidArguments = new DistributionCommandLineArguments();
- invalidArguments.parse(invalidArgumentString);
-
- try {
- new DistributionParameterHandler().getParameters(invalidArguments);
- fail("test should throw an exception here");
- } catch (Exception e) {
- assertEquals("error reading parameters from \"parameters/InvalidParameters.json\"\n"
- + "(JsonSyntaxException):java.lang.IllegalStateException: "
- + "Expected a string but was BEGIN_ARRAY at line 2 column 15 path $.name", e.getMessage());
- }
- }
-
- @Test
- public void testParameterHandlerNoParameters() throws PolicyDistributionException {
- String[] noArgumentString = { "-c", "parameters/NoParameters.json" };
-
- DistributionCommandLineArguments noArguments = new DistributionCommandLineArguments();
- noArguments.parse(noArgumentString);
-
- try {
- new DistributionParameterHandler().getParameters(noArguments);
- fail("test should throw an exception here");
- } catch (Exception e) {
- assertEquals("validation error(s) on parameters from \"parameters/NoParameters.json\"\n"
- + "parameter group \"null\" type "
- + "\"org.onap.policy.distribution.main.parameters.DistributionParameterGroup\""
- + " INVALID, parameter group has status INVALID\n"
- + " field \"name\" type \"java.lang.String\" value \"null\" INVALID, must be a non-blank string\n",
- e.getMessage());
- }
- }
-
- @Test
- public void testParameterHandlerMinumumParameters() throws PolicyDistributionException {
- String[] minArgumentString = { "-c", "parameters/MinimumParameters.json" };
-
- DistributionCommandLineArguments minArguments = new DistributionCommandLineArguments();
- minArguments.parse(minArgumentString);
-
- DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(minArguments);
- assertEquals("nameFromFile", parGroup.getName());
- }
-}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
new file mode 100644
index 00000000..b2d732e9
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
@@ -0,0 +1,101 @@
+/*-
+ * ============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.parameters;
+
+import static org.junit.Assert.assertEquals;
+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;
+
+/**
+ * Class to perform unit test of PluginHandlerParameters.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class TestPluginHandlerParameters {
+ CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ public void testPluginHandlerParameters() {
+ final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
+ final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
+ final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ final GroupValidationResult validationResult = pHParameters.validate();
+ assertEquals(policyDecoders.get("TOSCADecoder"), pHParameters.getPolicyDecoders().get("TOSCADecoder"));
+ assertEquals(policyForwarders.get("PAPEngineForwarder"),
+ pHParameters.getPolicyForwarders().get("PAPEngineForwarder"));
+ assertTrue(validationResult.isValid());
+ }
+
+ @Test
+ public void testPluginHandlerParameters_NullPolicyDecoders() {
+ try {
+ final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
+ final PluginHandlerParameters pHParameters = new PluginHandlerParameters(null, policyForwarders);
+ pHParameters.validate();
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains("map parameter \"policyDecoders\" is null"));
+ }
+ }
+
+ @Test
+ public void testPluginHandlerParameters_NullPolicyForwarders() {
+ try {
+ final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
+ final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, null);
+ pHParameters.validate();
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains("map parameter \"policyForwarders\" is null"));
+ }
+ }
+
+ @Test
+ public void testPluginHandlerParameters_EmptyPolicyDecoders() {
+ try {
+ final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(true);
+ final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
+ final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ pHParameters.validate();
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains("parameter not a regular parameter: policyDecoders"));
+ }
+ }
+
+ @Test
+ public void testPluginHandlerParameters_EmptyPolicyForwarders() {
+ try {
+ final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(true);
+ final Map<String, PolicyDecoderParameters> policyDecoders = commonTestData.getPolicyDecoders(false);
+ final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
+ pHParameters.validate();
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains("parameter not a regular parameter: policyForwarders"));
+ }
+ }
+}
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
new file mode 100644
index 00000000..bcae6df6
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
@@ -0,0 +1,117 @@
+/*-
+ * ============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.parameters;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.policy.common.parameters.GroupValidationResult;
+
+/**
+ * Class to perform unit test of PolicyDecoderParameters.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class TestPolicyDecoderParameters {
+
+ @Test
+ public void testPolicyDecoderParameters() {
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters(CommonTestData.decoderType, CommonTestData.decoderClassName);
+ final GroupValidationResult validationResult = pDParameters.validate();
+ assertEquals(CommonTestData.decoderType, pDParameters.getDecoderType());
+ assertEquals(CommonTestData.decoderClassName, pDParameters.getDecoderClassName());
+ assertTrue(validationResult.isValid());
+ }
+
+ @Test
+ public void testPolicyDecoderParameters_InvalidDecoderType() {
+ final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters("", CommonTestData.decoderClassName);
+ final GroupValidationResult validationResult = pDParameters.validate();
+ assertEquals("", pDParameters.getDecoderType());
+ assertEquals(CommonTestData.decoderClassName, pDParameters.getDecoderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult().contains(
+ "field \"decoderType\" type \"java.lang.String\" value \"\" INVALID, must be a non-blank string"));
+ }
+
+ @Test
+ public void testPolicyDecoderParameters_InvalidDecoderClassName() {
+ final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(CommonTestData.decoderType, "");
+ final GroupValidationResult validationResult = pDParameters.validate();
+ assertEquals(CommonTestData.decoderType, pDParameters.getDecoderType());
+ assertEquals("", pDParameters.getDecoderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"decoderClassName\" type \"java.lang.String\" value \"\" INVALID, "
+ + "must be a non-blank string containing full class name of the decoder"));
+ }
+
+ @Test
+ public void testPolicyDecoderParameters_InvalidDecoderTypeAndClassName() {
+ final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters("", "");
+ final GroupValidationResult validationResult = pDParameters.validate();
+ assertEquals("", pDParameters.getDecoderType());
+ assertEquals("", pDParameters.getDecoderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult().contains(
+ "field \"decoderType\" type \"java.lang.String\" value \"\" INVALID, must be a non-blank string"));
+ assertTrue(validationResult.getResult()
+ .contains("field \"decoderClassName\" type \"java.lang.String\" value \"\" INVALID, "
+ + "must be a non-blank string containing full class name of the decoder"));
+ }
+
+ @Test
+ public void testPolicyDecoderParameters_NullDecoderType() {
+ final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(null, CommonTestData.decoderClassName);
+ final GroupValidationResult validationResult = pDParameters.validate();
+ assertEquals(null, pDParameters.getDecoderType());
+ assertEquals(CommonTestData.decoderClassName, pDParameters.getDecoderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult().contains(
+ "field \"decoderType\" type \"java.lang.String\" value \"null\" INVALID, must be a non-blank string"));
+ }
+
+ @Test
+ public void testPolicyDecoderParameters_NullDecoderClassName() {
+ final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(CommonTestData.decoderType, null);
+ final GroupValidationResult validationResult = pDParameters.validate();
+ assertEquals(CommonTestData.decoderType, pDParameters.getDecoderType());
+ assertEquals(null, pDParameters.getDecoderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"decoderClassName\" type \"java.lang.String\" value \"null\" INVALID, "
+ + "must be a non-blank string containing full class name of the decoder"));
+ }
+
+ @Test
+ public void testPolicyDecoderParameters_InvalidDecoderClass() {
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters(CommonTestData.decoderType, CommonTestData.decoderClassName + "Invalid");
+ final GroupValidationResult validationResult = pDParameters.validate();
+ assertEquals(CommonTestData.decoderType, pDParameters.getDecoderType());
+ assertEquals(CommonTestData.decoderClassName + "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/parameters/TestPolicyForwarderParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java
new file mode 100644
index 00000000..bbcbc370
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyForwarderParameters.java
@@ -0,0 +1,121 @@
+/*-
+ * ============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.parameters;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.policy.common.parameters.GroupValidationResult;
+
+/**
+ * Class to perform unit test of PolicyForwarderParameters.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class TestPolicyForwarderParameters {
+
+ @Test
+ public void testPolicyForwarderParameters() {
+ final PolicyForwarderParameters pFParameters =
+ new PolicyForwarderParameters(CommonTestData.forwarderType, CommonTestData.forwarderClassName);
+ final GroupValidationResult validationResult = pFParameters.validate();
+ assertEquals(CommonTestData.forwarderType, pFParameters.getForwarderType());
+ assertEquals(CommonTestData.forwarderClassName, pFParameters.getForwarderClassName());
+ assertTrue(validationResult.isValid());
+ }
+
+ @Test
+ public void testPolicyForwarderParameters_InvalidForwarderType() {
+ final PolicyForwarderParameters pFParameters =
+ new PolicyForwarderParameters("", CommonTestData.forwarderClassName);
+ final GroupValidationResult validationResult = pFParameters.validate();
+ assertEquals("", pFParameters.getForwarderType());
+ assertEquals(CommonTestData.forwarderClassName, pFParameters.getForwarderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult().contains(
+ "field \"forwarderType\" type \"java.lang.String\" value \"\" INVALID, must be a non-blank string"));
+ }
+
+ @Test
+ public void testPolicyForwarderParameters_InvalidForwarderClassName() {
+ final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters(CommonTestData.forwarderType, "");
+ final GroupValidationResult validationResult = pFParameters.validate();
+ assertEquals(CommonTestData.forwarderType, pFParameters.getForwarderType());
+ assertEquals("", pFParameters.getForwarderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"forwarderClassName\" type \"java.lang.String\" value \"\" INVALID, "
+ + "must be a non-blank string containing full class name of the forwarder"));
+ }
+
+ @Test
+ public void testPolicyForwarderParameters_InvalidForwarderTypeAndClassName() {
+ final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters("", "");
+ final GroupValidationResult validationResult = pFParameters.validate();
+ assertEquals("", pFParameters.getForwarderType());
+ assertEquals("", pFParameters.getForwarderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult().contains(
+ "field \"forwarderType\" type \"java.lang.String\" value \"\" INVALID, must be a non-blank string"));
+ assertTrue(validationResult.getResult()
+ .contains("field \"forwarderClassName\" type \"java.lang.String\" value \"\" INVALID, "
+ + "must be a non-blank string containing full class name of the forwarder"));
+ }
+
+ @Test
+ public void testPolicyForwarderParameters_NullForwarderType() {
+ final PolicyForwarderParameters pFParameters =
+ new PolicyForwarderParameters(null, CommonTestData.forwarderClassName);
+ final GroupValidationResult validationResult = pFParameters.validate();
+ assertEquals(null, pFParameters.getForwarderType());
+ assertEquals(CommonTestData.forwarderClassName, pFParameters.getForwarderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"forwarderType\" type \"java.lang.String\" value \"null\" INVALID, "
+ + "must be a non-blank string"));
+ }
+
+ @Test
+ public void testPolicyForwarderParameters_NullForwarderClassName() {
+ final PolicyForwarderParameters pFParameters =
+ new PolicyForwarderParameters(CommonTestData.forwarderType, null);
+ final GroupValidationResult validationResult = pFParameters.validate();
+ assertEquals(CommonTestData.forwarderType, pFParameters.getForwarderType());
+ assertEquals(null, pFParameters.getForwarderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"forwarderClassName\" type \"java.lang.String\" value \"null\" INVALID, "
+ + "must be a non-blank string containing full class name of the forwarder"));
+ }
+
+ @Test
+ public void testPolicyForwarderParameters_InvalidForwarderClass() {
+ final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters(CommonTestData.forwarderType,
+ CommonTestData.forwarderClassName + "Invalid");
+ final GroupValidationResult validationResult = pFParameters.validate();
+ assertEquals(CommonTestData.forwarderType, pFParameters.getForwarderType());
+ assertEquals(CommonTestData.forwarderClassName + "Invalid", pFParameters.getForwarderClassName());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult().contains("policy forwarder class not found in classpath"));
+ }
+}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java
new file mode 100644
index 00000000..5eb113de
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java
@@ -0,0 +1,138 @@
+/*-
+ * ============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.parameters;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.onap.policy.common.parameters.GroupValidationResult;
+
+/**
+ * Class to perform unit test of ReceptionHandlerParameters.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class TestReceptionHandlerParameters {
+ CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ public void testReceptionHandlerParameters() {
+ final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ CommonTestData.receptionHandlerType, CommonTestData.receptionHandlerClassName, pHParameters);
+ final GroupValidationResult validationResult = rHParameters.validate();
+ assertEquals(CommonTestData.receptionHandlerType, rHParameters.getReceptionHandlerType());
+ assertEquals(CommonTestData.receptionHandlerClassName, rHParameters.getReceptionHandlerClassName());
+ assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
+ assertTrue(validationResult.isValid());
+ }
+
+ @Test
+ public void testReceptionHandlerParameters_NullReceptionHandlerType() {
+ final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final ReceptionHandlerParameters rHParameters =
+ new ReceptionHandlerParameters(null, CommonTestData.receptionHandlerClassName, pHParameters);
+ final GroupValidationResult validationResult = rHParameters.validate();
+ assertEquals(null, rHParameters.getReceptionHandlerType());
+ assertEquals(CommonTestData.receptionHandlerClassName, rHParameters.getReceptionHandlerClassName());
+ assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"receptionHandlerType\" type \"java.lang.String\" value \"null\" INVALID, "
+ + "must be a non-blank string"));
+ }
+
+ @Test
+ public void testReceptionHandlerParameters_NullReceptionHandlerClassName() {
+ final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final ReceptionHandlerParameters rHParameters =
+ new ReceptionHandlerParameters(CommonTestData.receptionHandlerType, null, pHParameters);
+ final GroupValidationResult validationResult = rHParameters.validate();
+ assertEquals(CommonTestData.receptionHandlerType, rHParameters.getReceptionHandlerType());
+ assertEquals(null, rHParameters.getReceptionHandlerClassName());
+ assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"receptionHandlerClassName\" type \"java.lang.String\" value \"null\" INVALID, "
+ + "must be a non-blank string containing full class name of the reception handler"));
+ }
+
+ @Test
+ public void testReceptionHandlerParameters_EmptyReceptionHandlerType() {
+ final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+
+ final ReceptionHandlerParameters rHParameters =
+ new ReceptionHandlerParameters("", CommonTestData.receptionHandlerClassName, pHParameters);
+ final GroupValidationResult validationResult = rHParameters.validate();
+ assertEquals("", rHParameters.getReceptionHandlerType());
+ assertEquals(CommonTestData.receptionHandlerClassName, rHParameters.getReceptionHandlerClassName());
+ assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"receptionHandlerType\" type \"java.lang.String\" value \"\" INVALID, "
+ + "must be a non-blank string"));
+ }
+
+ @Test
+ public void testReceptionHandlerParameters_EmptyReceptionHandlerClassName() {
+ final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final ReceptionHandlerParameters rHParameters =
+ new ReceptionHandlerParameters(CommonTestData.receptionHandlerType, "", pHParameters);
+ final GroupValidationResult validationResult = rHParameters.validate();
+ assertEquals(CommonTestData.receptionHandlerType, rHParameters.getReceptionHandlerType());
+ assertEquals("", rHParameters.getReceptionHandlerClassName());
+ assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult()
+ .contains("field \"receptionHandlerClassName\" type \"java.lang.String\" value \"\" INVALID, "
+ + "must be a non-blank string containing full class name of the reception handler"));
+ }
+
+ @Test
+ public void testReceptionHandlerParameters_EmptyPluginHandler() {
+ try {
+ final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(true);
+ final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ CommonTestData.receptionHandlerType, CommonTestData.receptionHandlerClassName, pHParameters);
+ rHParameters.validate();
+ fail("test should throw an exception here");
+ } catch (final Exception e) {
+ assertTrue(e.getMessage().contains("parameter not a regular parameter: policyDecoders"));
+ }
+ }
+
+ @Test
+ public void testReceptionHandlerParameters_InvalidReceptionHandlerClass() {
+ final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final ReceptionHandlerParameters rHParameters =
+ new ReceptionHandlerParameters(CommonTestData.receptionHandlerType,
+ CommonTestData.receptionHandlerClassName + "Invalid", pHParameters);
+ final GroupValidationResult validationResult = rHParameters.validate();
+ assertEquals(CommonTestData.receptionHandlerType, rHParameters.getReceptionHandlerType());
+ assertEquals(CommonTestData.receptionHandlerClassName + "Invalid", rHParameters.getReceptionHandlerClassName());
+ assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
+ assertFalse(validationResult.isValid());
+ assertTrue(validationResult.getResult().contains("reception handler class not found in classpath"));
+ }
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters.json
new file mode 100644
index 00000000..546e5231
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters.json
@@ -0,0 +1,23 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "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"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
new file mode 100644
index 00000000..7a0d14a7
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
@@ -0,0 +1,19 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ },
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":"PAPEngine",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
new file mode 100644
index 00000000..b328df3d
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
@@ -0,0 +1,19 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":"TOSCA",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ }
+ },
+ "policyForwarders":{
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json
new file mode 100644
index 00000000..45368be1
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json
@@ -0,0 +1,5 @@
+{
+ "name":"SDCDistributionGroup",
+ "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
new file mode 100644
index 00000000..c84a6784
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
@@ -0,0 +1,23 @@
+{
+ "name":" ",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "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"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json
new file mode 100644
index 00000000..eeafc25a
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json
@@ -0,0 +1,31 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":"TOSCA",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ },
+ "APEXDecoder":{
+ "decoderType":"APEX",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderApexPdpa"
+ },
+ "DROOLSDecoder":{
+ "decoderType":"DROOLS",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderDroolsPdpd"
+ }
+ },
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":"PAPEngine",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json
new file mode 100644
index 00000000..21ff4ad6
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json
@@ -0,0 +1,23 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":" ",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ }
+ },
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":"PAPEngine",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json
new file mode 100644
index 00000000..6cf54d80
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json
@@ -0,0 +1,27 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "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"
+ },
+ "PAPStandaloneForwarder":{
+ "forwarderType":"PAPStandalone",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.PapStandalonePolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json
new file mode 100644
index 00000000..ea44b8aa
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json
@@ -0,0 +1,23 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":"TOSCA",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ }
+ },
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":" ",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
new file mode 100644
index 00000000..7be2a1a6
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
@@ -0,0 +1,23 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.InvalidSdcReceptionHandler",
+ "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"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json
new file mode 100644
index 00000000..791236cb
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json
@@ -0,0 +1,23 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":" ",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "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"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
new file mode 100644
index 00000000..3ba35753
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
@@ -0,0 +1,17 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pluginHandlerParameters":{
+ "policyForwarders":{
+ "PAPEngineForwarder":{
+ "forwarderType":"PAPEngine",
+ "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
new file mode 100644
index 00000000..660cac92
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
@@ -0,0 +1,17 @@
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pluginHandlerParameters":{
+ "policyDecoders":{
+ "TOSCADecoder":{
+ "decoderType":"TOSCA",
+ "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json
new file mode 100644
index 00000000..8b0997ca
--- /dev/null
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json
@@ -0,0 +1,3 @@
+{
+ "name":"SDCDistributionGroup"
+} \ 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 02b2afad..1b42cc4d 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -1,3 +1,23 @@
-{
- "name": "nameFromFile"
+{
+ "name":"SDCDistributionGroup",
+ "receptionHandlerParameters":{
+ "SDCReceptionHandler":{
+ "receptionHandlerType":"SDC",
+ "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "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"
+ }
+ }
+ }
+ }
+ }
} \ No newline at end of file