integrate PSSDConfiguration to distribution
* Integrate the PSSDConfiguration to distribution config parameter.
* Moved related PSSDConfigurationParameterGroup classes from "handling"
to "parameters" to avoid specified sdc dependency.
* Modify all the test case since the distribution config parameter
has been changed, update CommonTestData to wrap it.
* Add neccessnary SDC handling exceptions which to be used for
SDC handler integration.
* update the PSSDCOnfiguraitonParameterGroup to add UUID to the setName
function to generate unique name for each instance.
* use builder to create PSSDConfigurationParametersGroup instead of using
many parameters
Change-Id: I3c78bc2a51ebc84761bc9458096d6ffa18070b47
Issue-ID: POLICY-956
Signed-off-by: liboNet <libo.zhu@intel.com>
diff --git a/main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java b/main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java
index d360b5d..4f65071 100644
--- a/main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java
+++ b/main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java
@@ -118,8 +118,10 @@
for (final ReceptionHandlerParameters params : distributionParameterGroup.getReceptionHandlerParameters()
.values()) {
params.setName(distributionParameterGroup.getName());
+ params.getPSSDConfigurationParametersGroup().setName(distributionParameterGroup.getName());
params.getPluginHandlerParameters().setName(distributionParameterGroup.getName());
ParameterService.register(params);
+ ParameterService.register(params.getPSSDConfigurationParametersGroup());
ParameterService.register(params.getPluginHandlerParameters());
}
}
@@ -136,6 +138,7 @@
params.setName(distributionParameterGroup.getName());
params.getPluginHandlerParameters().setName(distributionParameterGroup.getName());
ParameterService.deregister((params.getName()));
+ ParameterService.deregister((params.getPSSDConfigurationParametersGroup().getName()));
ParameterService.deregister((params.getPluginHandlerParameters().getName()));
}
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
index 54716fc..0903b07 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
@@ -20,10 +20,13 @@
package org.onap.policy.distribution.main.parameters;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
+import org.onap.policy.distribution.reception.parameters.PSSDConfigurationParametersGroup;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters;
@@ -61,15 +64,43 @@
if (!isEmpty) {
final Map<String, PolicyDecoderParameters> policyDecoders = getPolicyDecoders(isEmpty);
final Map<String, PolicyForwarderParameters> policyForwarders = getPolicyForwarders(isEmpty);
+ final PSSDConfigurationParametersGroup pssdConfiguration = getPSSDConfigurationParametersGroup(isEmpty);;
final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
final ReceptionHandlerParameters rhParameters =
- new ReceptionHandlerParameters(RECEPTION_HANDLER_TYPE, RECEPTION_HANDLER_CLASS_NAME, pHParameters);
+ new ReceptionHandlerParameters(RECEPTION_HANDLER_TYPE, RECEPTION_HANDLER_CLASS_NAME,
+ pssdConfiguration, pHParameters);
receptionHandlerParameters.put(SDC_RECEPTION_HANDLER_KEY, rhParameters);
}
return receptionHandlerParameters;
}
/**
+ * Returns an instance of PSSDConfigurationParametersGroup for test cases.
+ *
+ * @param isEmpty boolean value to represent that object created should be empty or not
+ * @return the PSSDConfigurationParametersGroup object
+ */
+ public PSSDConfigurationParametersGroup getPSSDConfigurationParametersGroup(final boolean isEmpty) {
+ final PSSDConfigurationParametersGroup pssdConfiguration;
+ if (!isEmpty) {
+ final List<String> messageBusAddress = new ArrayList<>();
+ messageBusAddress.add("localhost");
+ final List<String> artifactTypes = new ArrayList<>();
+ artifactTypes.add("TOSCA_CSAR");
+ pssdConfiguration = new PSSDConfigurationParametersGroup.PSSDConfigurationBuilder()
+ .setAsdcAddress("localhost").setMessageBusAddress(messageBusAddress)
+ .setUser("policy").setPassword("policy").setPollingInterval(20)
+ .setPollingTimeout(30).setConsumerId("policy-id").setArtifactTypes(artifactTypes)
+ .setConsumerGroup("policy-group").setEnvironmentName("TEST").setKeystorePath("")
+ .setKeystorePassword("").setActiveserverTlsAuth(false)
+ .setIsFilterinEmptyResources(true).setIsUseHttpsWithDmaap(false).build();
+ } else {
+ pssdConfiguration = new PSSDConfigurationParametersGroup.PSSDConfigurationBuilder().build();
+ }
+ return pssdConfiguration;
+ }
+
+ /**
* Returns an instance of PluginHandlerParameters for test cases.
*
* @param isEmpty boolean value to represent that object created should be empty or not
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
index 35acdf2..c2ab38d 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java
@@ -84,7 +84,8 @@
@Test
public void testPolicyDecoderParameters_NullDecoderType() {
- final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(null, CommonTestData.DECODER_CLASS_NAME);
+ final PolicyDecoderParameters pDParameters =
+ new PolicyDecoderParameters(null, CommonTestData.DECODER_CLASS_NAME);
final GroupValidationResult validationResult = pDParameters.validate();
assertEquals(null, pDParameters.getDecoderType());
assertEquals(CommonTestData.DECODER_CLASS_NAME, pDParameters.getDecoderClassName());
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
index 10faed8..c902c9b 100644
--- 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
@@ -27,6 +27,7 @@
import org.junit.Test;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.distribution.reception.parameters.PSSDConfigurationParametersGroup;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters;
@@ -41,11 +42,15 @@
@Test
public void testReceptionHandlerParameters() {
final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
- CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME, pHParameters);
+ final PSSDConfigurationParametersGroup pssdConfiguration =
+ commonTestData.getPSSDConfigurationParametersGroup(false);
+ final ReceptionHandlerParameters rHParameters =
+ new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE,
+ CommonTestData.RECEPTION_HANDLER_CLASS_NAME, pssdConfiguration, pHParameters);
final GroupValidationResult validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
+ assertEquals(pssdConfiguration, rHParameters.getPSSDConfigurationParametersGroup());
assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
assertTrue(validationResult.isValid());
}
@@ -53,11 +58,15 @@
@Test
public void testReceptionHandlerParameters_NullReceptionHandlerType() {
final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final PSSDConfigurationParametersGroup pssdConfiguration =
+ commonTestData.getPSSDConfigurationParametersGroup(false);
final ReceptionHandlerParameters rHParameters =
- new ReceptionHandlerParameters(null, CommonTestData.RECEPTION_HANDLER_CLASS_NAME, pHParameters);
+ new ReceptionHandlerParameters(null, CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
+ pssdConfiguration, pHParameters);
final GroupValidationResult validationResult = rHParameters.validate();
assertEquals(null, rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
+ assertEquals(pssdConfiguration, rHParameters.getPSSDConfigurationParametersGroup());
assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -68,11 +77,15 @@
@Test
public void testReceptionHandlerParameters_NullReceptionHandlerClassName() {
final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final PSSDConfigurationParametersGroup pssdConfiguration =
+ commonTestData.getPSSDConfigurationParametersGroup(false);
final ReceptionHandlerParameters rHParameters =
- new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, null, pHParameters);
+ new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, null,
+ pssdConfiguration, pHParameters);
final GroupValidationResult validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals(null, rHParameters.getReceptionHandlerClassName());
+ assertEquals(pssdConfiguration, rHParameters.getPSSDConfigurationParametersGroup());
assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -83,9 +96,11 @@
@Test
public void testReceptionHandlerParameters_EmptyReceptionHandlerType() {
final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
-
+ final PSSDConfigurationParametersGroup pssdConfiguration =
+ commonTestData.getPSSDConfigurationParametersGroup(false);
final ReceptionHandlerParameters rHParameters =
- new ReceptionHandlerParameters("", CommonTestData.RECEPTION_HANDLER_CLASS_NAME, pHParameters);
+ new ReceptionHandlerParameters("", CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
+ pssdConfiguration, pHParameters);
final GroupValidationResult validationResult = rHParameters.validate();
assertEquals("", rHParameters.getReceptionHandlerType());
assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName());
@@ -99,11 +114,14 @@
@Test
public void testReceptionHandlerParameters_EmptyReceptionHandlerClassName() {
final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
- final ReceptionHandlerParameters rHParameters =
- new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, "", pHParameters);
+ final PSSDConfigurationParametersGroup pssdConfiguration =
+ commonTestData.getPSSDConfigurationParametersGroup(false);
+ final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
+ CommonTestData.RECEPTION_HANDLER_TYPE, "", pssdConfiguration, pHParameters);
final GroupValidationResult validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
assertEquals("", rHParameters.getReceptionHandlerClassName());
+ assertEquals(pssdConfiguration, rHParameters.getPSSDConfigurationParametersGroup());
assertEquals(pHParameters, rHParameters.getPluginHandlerParameters());
assertFalse(validationResult.isValid());
assertTrue(validationResult.getResult()
@@ -115,8 +133,11 @@
public void testReceptionHandlerParameters_EmptyPluginHandler() {
try {
final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(true);
+ final PSSDConfigurationParametersGroup pssdConfiguration =
+ commonTestData.getPSSDConfigurationParametersGroup(false);
final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters(
- CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME, pHParameters);
+ CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME,
+ pssdConfiguration, pHParameters);
rHParameters.validate();
fail("test should throw an exception here");
} catch (final Exception e) {
@@ -127,12 +148,16 @@
@Test
public void testReceptionHandlerParameters_InvalidReceptionHandlerClass() {
final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false);
+ final PSSDConfigurationParametersGroup pssdConfiguration =
+ commonTestData.getPSSDConfigurationParametersGroup(false);
final ReceptionHandlerParameters rHParameters =
new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE,
- CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid", pHParameters);
+ CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid", pssdConfiguration, pHParameters);
final GroupValidationResult validationResult = rHParameters.validate();
assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType());
- assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid", rHParameters.getReceptionHandlerClassName());
+ assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid",
+ rHParameters.getReceptionHandlerClassName());
+ assertEquals(pssdConfiguration, rHParameters.getPSSDConfigurationParametersGroup());
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
index 546e523..bcf8b26 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -20,4 +44,4 @@
}
}
}
-}
\ 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
index 7a0d14a..a53dc05 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
},
@@ -16,4 +40,4 @@
}
}
}
-}
\ 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
index b328df3..b88fda2 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -16,4 +40,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
index c84a678..aae53f5 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -20,4 +44,4 @@
}
}
}
-}
\ 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
index eeafc25..c1ad0a9 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -28,4 +52,4 @@
}
}
}
-}
\ 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
index 21ff4ad..26f470e 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -20,4 +44,4 @@
}
}
}
-}
\ 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
index 6cf54d8..a194e95 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -24,4 +48,4 @@
}
}
}
-}
\ 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
index ea44b8a..895e7d5 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -20,4 +44,4 @@
}
}
}
-}
\ 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
index 7be2a1a..a368a5b 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.InvalidSdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -20,4 +44,4 @@
}
}
}
-}
\ 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
index 791236c..bf0db3e 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":" ",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -20,4 +44,4 @@
}
}
}
-}
\ 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
index 3ba3575..06d1867 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyForwarders":{
"PAPEngineForwarder":{
@@ -14,4 +38,4 @@
}
}
}
-}
\ 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
index 660cac9..d8343b1 100644
--- a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
+++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -14,4 +38,4 @@
}
}
}
-}
\ 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 1b42cc4..18cd529 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -4,6 +4,30 @@
"SDCReceptionHandler":{
"receptionHandlerType":"SDC",
"receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+ "pssdConfiguration":{
+ "asdcAddress": "localhost",
+ "messageBusAddress": [
+ "a.com",
+ "b.com",
+ "c.com"
+ ],
+ "user": "tbdsdc-1480",
+ "password": "tbdsdc-1480",
+ "pollingInterval":20,
+ "pollingTimeout":30,
+ "consumerId": "policy-id",
+ "artifactTypes": [
+ "TOSCA_CSAR",
+ "HEAT"
+ ],
+ "consumerGroup": "policy-group",
+ "environmentName": "environmentName",
+ "keystorePath": "null",
+ "keystorePassword": "null",
+ "activeserverTlsAuth": false,
+ "isFilterinEmptyResources": true,
+ "isUseHttpsWithDmaap": false
+ },
"pluginHandlerParameters":{
"policyDecoders":{
"TOSCADecoder":{
@@ -20,4 +44,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java
index 86d2a55..baba4d4 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java
@@ -23,6 +23,7 @@
import java.util.List;
import org.onap.sdc.api.consumer.IConfiguration;
+import org.onap.policy.distribution.reception.parameters.PSSDConfigurationParametersGroup;
/**
* Properties for the handling Sdc
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java
deleted file mode 100644
index 7fa8114..0000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. 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.reception.handling.sdc;
-
-import java.util.List;
-
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
-import org.onap.policy.common.parameters.ValidationStatus;
-
-/**
- * This class handles reading, parsing and validating of the Policy SDC Service Distribution parameters from Json
- * format, which strictly adheres to the interface:IConfiguration, defined by SDC SDK.
- */
-public class PSSDConfigurationParametersGroup implements ParameterGroup {
- // Policy SDC Service Distribution specified field.
- private String name;
-
- // Interface of IConfiguration item
- private String asdcAddress;
- private List<String> messageBusAddress;
- private String user;
- private String password;
- private int pollingInterval;
- private int pollingTimeout;
- private String consumerId;
- private List<String> artifactTypes;
- private String consumerGroup;
- private String environmentName;
- private String keystorePath;
- private String keystorePassword;
- private boolean activeserverTlsAuth;
- private boolean isFilterinEmptyResources;
- private Boolean isUseHttpsWithDmaap;
-
- public String getAsdcAddress() {
- return asdcAddress;
- }
-
- public List<String> getMsgBusAddress() {
- return messageBusAddress;
- }
-
- public String getUser() {
- return user;
- }
-
- public String getPassword() {
- return password;
- }
-
- public int getPollingInterval() {
- return pollingInterval;
- }
-
- public int getPollingTimeout() {
- return pollingTimeout;
- }
-
- public String getConsumerID() {
- return consumerId;
- }
-
- public List<String> getArtifactTypes() {
- return artifactTypes;
- }
-
- public String getConsumerGroup() {
- return consumerGroup;
- }
-
- public String getEnvironmentName() {
- return environmentName;
- }
-
- public String getKeyStorePassword() {
- return keystorePassword;
- }
-
- public String getKeyStorePath() {
- return keystorePath;
- }
-
- public boolean activateServerTLSAuth() {
- return activeserverTlsAuth;
- }
-
- public boolean isFilterInEmptyResources() {
- return isFilterinEmptyResources;
- }
-
- public Boolean isUseHttpsWithDmaap() {
- return isUseHttpsWithDmaap;
- }
-
- @Override
- public String toString() {
- return "name =" + name + ",TestParameters:[asdcAddress = " + asdcAddress + ", messageBusAddress = "
- + messageBusAddress + ", user = " + user + "]";
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public GroupValidationResult validate() {
- final GroupValidationResult validationResult = new GroupValidationResult(this);
-
- if (name == null || name.trim().length() == 0) {
- validationResult.setResult("name", ValidationStatus.INVALID, "name must be a non-blank string");
- }
-
- if (asdcAddress == null || asdcAddress.trim().length() == 0) {
- validationResult.setResult("asdcAddress", ValidationStatus.INVALID,
- "asdcAddress must be a non-blank string");
- }
-
- if (user == null || user.trim().length() == 0) {
- validationResult.setResult("user", ValidationStatus.INVALID, "user must be a non-blank string");
- }
-
- if (consumerId == null || consumerId.trim().length() == 0) {
- validationResult.setResult("consumerId", ValidationStatus.INVALID, "consumerId must be a non-blank string");
- }
-
- if (consumerGroup == null || consumerGroup.trim().length() == 0) {
- validationResult.setResult("consumerGroup", ValidationStatus.INVALID,
- "consumerGroup must be a non-blank string");
- }
-
- if (keystorePath == null || keystorePath.trim().length() == 0) {
- validationResult.setResult("keystorePath", ValidationStatus.INVALID,
- "keystorePath must be a non-blank string");
- }
-
- if (keystorePassword == null || keystorePassword.trim().length() == 0) {
- validationResult.setResult("keystorePassword", ValidationStatus.INVALID,
- "keystorePassword must be a non-blank string");
- }
-
- if (messageBusAddress == null) {
- validationResult.setResult("messageBusAddress", ValidationStatus.INVALID,
- "messageBusAddress must be a list of non-blank string");
- } else {
- for (final String temp : messageBusAddress) {
- if (temp.trim().length() == 0) {
- validationResult.setResult("messageBusAddress", ValidationStatus.INVALID,
- "the string of messageBusAddress must be a non-blank string");
- }
- }
- }
-
- if (artifactTypes == null) {
- validationResult.setResult("artifactTypes", ValidationStatus.INVALID,
- "artifactTypes must be a list of non-blank string");
- } else {
- for (final String temp : artifactTypes) {
- if (temp.trim().length() == 0) {
- validationResult.setResult("artifactTypes", ValidationStatus.INVALID,
- "the string of artifactTypes must be a non-blank string");
- }
- }
- }
-
- if (pollingInterval <= 0) {
- validationResult.setResult("pollingInterval", ValidationStatus.INVALID,
- "pollingInterval must be a positive integer");
- }
-
- if (pollingTimeout <= 0) {
- validationResult.setResult("pollingTimeout", ValidationStatus.INVALID,
- "pollingTimeout must be a positive integer");
- }
-
- return validationResult;
- }
-
-}
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java
new file mode 100644
index 0000000..043b0a4
--- /dev/null
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.handling.sdc.exceptions;
+
+
+/**
+ * Exception during artifact installation.
+ */
+public class ArtifactInstallerException extends Exception {
+
+ /**
+ * serialization id.
+ */
+ private static final long serialVersionUID = -8507246953751956974L;
+
+ /**
+ * Constructor for creating ArtifactInstallerException using message.
+ *
+ * @param message The message to dump
+ */
+ public ArtifactInstallerException (final String message) {
+ super (message);
+
+ }
+
+ /**
+ * Constructor for creating ArtifactInstallerException using message and exception.
+ *
+ * @param message The message to dump
+ * @param e the exception that caused this exception to be thrown
+ */
+ public ArtifactInstallerException (final String message, final Exception e) {
+ super (message, e);
+
+ }
+}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerException.java
new file mode 100644
index 0000000..ff9acfd
--- /dev/null
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerException.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.handling.sdc.exceptions;
+
+
+/**
+ * Exception of the PSSD controller.
+ */
+public class PSSDControllerException extends Exception {
+
+ /**
+ * serialization id.
+ */
+ private static final long serialVersionUID = -8507246953751956974L;
+
+ /**
+ * Constructor for creating PSSDControllerException using message.
+ *
+ * @param message The message to dump
+ */
+ public PSSDControllerException (final String message) {
+ super (message);
+
+ }
+
+ /**
+ * Constructor for creating PSSDControllerException using message and exception.
+ *
+ * @param message The message to dump
+ * @param e the exception that caused this exception to be thrown
+ */
+ public PSSDControllerException (final String message, final Exception e) {
+ super (message, e);
+
+ }
+}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadException.java
new file mode 100644
index 0000000..f95179c
--- /dev/null
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadException.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.handling.sdc.exceptions;
+
+
+/**
+ * Exception during download from PSSD.
+ */
+public class PSSDDownloadException extends Exception {
+
+ /**
+ * serialization id.
+ */
+ private static final long serialVersionUID = -8507246953751956974L;
+
+ /**
+ * Constructor for creating PSSDDownloadException using message.
+ *
+ * @param message The message to dump
+ */
+ public PSSDDownloadException (final String message) {
+ super (message);
+
+ }
+
+ /**
+ * Constructor for creating PSSDDownloadException using message and exception.
+ *
+ * @param message The message to dump
+ * @param e the exception that caused this exception to be thrown
+ */
+ public PSSDDownloadException (final String message, final Exception e) {
+ super (message, e);
+
+ }
+}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersException.java
new file mode 100644
index 0000000..91922d7
--- /dev/null
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersException.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.handling.sdc.exceptions;
+
+
+/**
+ * Exception of the PSSD controller.
+ */
+public class PSSDParametersException extends Exception {
+
+ /**
+ * serialization id.
+ */
+ private static final long serialVersionUID = -8507246953751956974L;
+
+ /**
+ * Constructor for creating PSSDParametersException using message.
+ *
+ * @param message The message to dump
+ */
+ public PSSDParametersException (final String message) {
+ super (message);
+
+ }
+
+ /**
+ * Constructor for creating PSSDParametersException using message and exception.
+ *
+ * @param message The message to dump
+ * @param e the exception that caused this exception to be thrown
+ */
+ public PSSDParametersException (final String message, final Exception e) {
+ super (message, e);
+
+ }
+}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java
index bcb7ac8..435b757 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java
@@ -33,6 +33,7 @@
import java.io.IOException;
import org.junit.Test;
import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.distribution.reception.parameters.PSSDConfigurationParametersGroup;
/*-
* Tests for PSSDConfiguration class
@@ -53,8 +54,6 @@
}
final GroupValidationResult validationResult = configParameters.validate();
assertTrue(validationResult.isValid());
- assertEquals("parameterConfig1", configParameters.getName());
-
PSSDConfiguration config = new PSSDConfiguration(configParameters);
assertEquals(20, config.getPollingInterval());
assertEquals(30,config.getPollingTimeout());
@@ -73,7 +72,6 @@
}
final GroupValidationResult validationResult = configParameters.validate();
assertFalse(validationResult.isValid());
- assertEquals("parameterConfig1", configParameters.getName());
}
}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerExceptionTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerExceptionTest.java
new file mode 100644
index 0000000..6c524ff
--- /dev/null
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerExceptionTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.handling.sdc.exceptions;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+public class ArtifactInstallerExceptionTest {
+
+ @Test
+ public void test() {
+ assertNotNull(new ArtifactInstallerException("Message"));
+ assertNotNull(new ArtifactInstallerException("Message", new IOException()));
+ }
+}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java
new file mode 100644
index 0000000..b467cba
--- /dev/null
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.handling.sdc.exceptions;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+public class PSSDControllerExceptionTest {
+
+ @Test
+ public void test() {
+ assertNotNull(new PSSDControllerException("Message"));
+ assertNotNull(new PSSDControllerException("Message", new IOException()));
+ }
+}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java
new file mode 100644
index 0000000..0ca4330
--- /dev/null
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.handling.sdc.exceptions;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+public class PSSDDownloadExceptionTest {
+
+ @Test
+ public void test() {
+ assertNotNull(new PSSDDownloadException("Message"));
+ assertNotNull(new PSSDDownloadException("Message", new IOException()));
+ }
+}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java
new file mode 100644
index 0000000..040895e
--- /dev/null
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.handling.sdc.exceptions;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+public class PSSDParametersExceptionTest {
+
+ @Test
+ public void test() {
+ assertNotNull(new PSSDParametersException("Message"));
+ assertNotNull(new PSSDParametersException("Message", new IOException()));
+ }
+}
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PSSDConfigurationParametersGroup.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PSSDConfigurationParametersGroup.java
new file mode 100644
index 0000000..52e0988
--- /dev/null
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PSSDConfigurationParametersGroup.java
@@ -0,0 +1,293 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.reception.parameters;
+
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ValidationStatus;
+
+/**
+ * This class handles reading, parsing and validating of the Policy SDC Service Distribution parameters from Json
+ * format, which strictly adheres to the interface:IConfiguration, defined by SDC SDK.
+ */
+public class PSSDConfigurationParametersGroup implements ParameterGroup {
+
+ // Policy SDC Service Distribution specified field.
+ private String name;
+
+ // Interface of IConfiguration item
+ private String asdcAddress;
+ private List<String> messageBusAddress;
+ private String user;
+ private String password;
+ private int pollingInterval;
+ private int pollingTimeout;
+ private String consumerId;
+ private List<String> artifactTypes;
+ private String consumerGroup;
+ private String environmentName;
+ private String keystorePath;
+ private String keystorePassword;
+ private boolean activeserverTlsAuth;
+ private boolean isFilterinEmptyResources;
+ private Boolean isUseHttpsWithDmaap;
+
+ /**
+ *Inner static class is to used as a Builder
+ *
+ */
+ public static class PSSDConfigurationBuilder {
+ private String asdcAddress;
+ private List<String> messageBusAddress;
+ private String user;
+ private String password;
+ private int pollingInterval;
+ private int pollingTimeout;
+ private String consumerId;
+ private List<String> artifactTypes;
+ private String consumerGroup;
+ private String environmentName;
+ private String keystorePath;
+ private String keystorePassword;
+ private boolean activeserverTlsAuth;
+ private boolean isFilterinEmptyResources;
+ private Boolean isUseHttpsWithDmaap;
+
+ public PSSDConfigurationBuilder setAsdcAddress(String val)
+ { asdcAddress = val; return this; }
+ public PSSDConfigurationBuilder setMessageBusAddress(List<String> val)
+ { messageBusAddress = val; return this; }
+ public PSSDConfigurationBuilder setUser(String val)
+ { user = val; return this; }
+ public PSSDConfigurationBuilder setPassword(String val)
+ { password = val; return this; }
+ public PSSDConfigurationBuilder setPollingInterval(int val)
+ { pollingInterval = val; return this; }
+ public PSSDConfigurationBuilder setPollingTimeout(int val)
+ { pollingTimeout = val; return this; }
+ public PSSDConfigurationBuilder setConsumerId(String val)
+ { consumerId = val; return this; }
+ public PSSDConfigurationBuilder setArtifactTypes(List<String> val)
+ { artifactTypes = val; return this; }
+ public PSSDConfigurationBuilder setConsumerGroup(String val)
+ { consumerGroup = val; return this; }
+ public PSSDConfigurationBuilder setEnvironmentName(String val)
+ { environmentName = val; return this; }
+ public PSSDConfigurationBuilder setKeystorePath(String val)
+ { keystorePath = val; return this; }
+ public PSSDConfigurationBuilder setKeystorePassword(String val)
+ { keystorePassword = val; return this; }
+ public PSSDConfigurationBuilder setActiveserverTlsAuth(boolean val)
+ { activeserverTlsAuth = val; return this; }
+ public PSSDConfigurationBuilder setIsFilterinEmptyResources(boolean val)
+ { isFilterinEmptyResources = val; return this; }
+ public PSSDConfigurationBuilder setIsUseHttpsWithDmaap(Boolean val)
+ { isUseHttpsWithDmaap = val; return this; }
+
+
+ /**
+ * it is to create a new PSSDConfigurationParametersGroup instance.
+ */
+ public PSSDConfigurationParametersGroup build() {
+ return new PSSDConfigurationParametersGroup(this);
+ }
+ }
+
+ /**
+ * The constructor for instantiating PSSDConfigurationParametersGroup it is a private
+ * so that it could ONLY be instantiated by PSSDConfigurationBuilder
+ *
+ * @param builder stores all the values used by PSSDConfigurationParametersGroup
+ */
+ private PSSDConfigurationParametersGroup(PSSDConfigurationBuilder builder) {
+ asdcAddress = builder.asdcAddress;
+ messageBusAddress = builder.messageBusAddress;
+ user = builder.user;
+ password = builder.password;
+ pollingInterval = builder.pollingInterval;
+ pollingTimeout = builder.pollingTimeout;
+ consumerId = builder.consumerId;
+ artifactTypes = builder.artifactTypes;
+ consumerGroup = builder.consumerGroup;
+ environmentName = builder.environmentName;
+ keystorePath = builder.keystorePath;
+ keystorePassword = builder.keystorePassword;
+ activeserverTlsAuth = builder.activeserverTlsAuth;
+ isFilterinEmptyResources = builder.isFilterinEmptyResources;
+ isUseHttpsWithDmaap = builder.isUseHttpsWithDmaap;
+
+ }
+
+ public String getAsdcAddress() {
+ return asdcAddress;
+ }
+
+ public List<String> getMsgBusAddress() {
+ return messageBusAddress;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public int getPollingInterval() {
+ return pollingInterval;
+ }
+
+ public int getPollingTimeout() {
+ return pollingTimeout;
+ }
+
+ public String getConsumerID() {
+ return consumerId;
+ }
+
+ public List<String> getArtifactTypes() {
+ return artifactTypes;
+ }
+
+ public String getConsumerGroup() {
+ return consumerGroup;
+ }
+
+ public String getEnvironmentName() {
+ return environmentName;
+ }
+
+ public String getKeyStorePassword() {
+ return keystorePassword;
+ }
+
+ public String getKeyStorePath() {
+ return keystorePath;
+ }
+
+ public boolean activateServerTLSAuth() {
+ return activeserverTlsAuth;
+ }
+
+ public boolean isFilterInEmptyResources() {
+ return isFilterinEmptyResources;
+ }
+
+ public Boolean isUseHttpsWithDmaap() {
+ return isUseHttpsWithDmaap;
+ }
+
+ @Override
+ public String toString() {
+ return "name =" + name + ",TestParameters:[asdcAddress = " + asdcAddress + ", messageBusAddress = "
+ + messageBusAddress + ", user = " + user + "]";
+ }
+
+ @Override
+ public String getName() {
+ return name ;
+ }
+
+ @Override
+ public GroupValidationResult validate() {
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
+
+ if (asdcAddress == null || asdcAddress.trim().length() == 0) {
+ validationResult.setResult("asdcAddress", ValidationStatus.INVALID,
+ "asdcAddress must be a non-blank string");
+ }
+
+ if (user == null || user.trim().length() == 0) {
+ validationResult.setResult("user", ValidationStatus.INVALID, "user must be a non-blank string");
+ }
+
+ if (consumerId == null || consumerId.trim().length() == 0) {
+ validationResult.setResult("consumerId", ValidationStatus.INVALID, "consumerId must be a non-blank string");
+ }
+
+ if (consumerGroup == null || consumerGroup.trim().length() == 0) {
+ validationResult.setResult("consumerGroup", ValidationStatus.INVALID,
+ "consumerGroup must be a non-blank string");
+ }
+
+ if (keystorePath == null || keystorePath.trim().length() == 0) {
+ validationResult.setResult("keystorePath", ValidationStatus.INVALID,
+ "keystorePath must be a non-blank string");
+ }
+
+ if (keystorePassword == null || keystorePassword.trim().length() == 0) {
+ validationResult.setResult("keystorePassword", ValidationStatus.INVALID,
+ "keystorePassword must be a non-blank string");
+ }
+
+ if (messageBusAddress == null) {
+ validationResult.setResult("messageBusAddress", ValidationStatus.INVALID,
+ "messageBusAddress must be a list of non-blank string");
+ } else {
+ for (final String temp : messageBusAddress) {
+ if (temp.trim().length() == 0) {
+ validationResult.setResult("messageBusAddress", ValidationStatus.INVALID,
+ "the string of messageBusAddress must be a non-blank string");
+ }
+ }
+ }
+
+ if (artifactTypes == null) {
+ validationResult.setResult("artifactTypes", ValidationStatus.INVALID,
+ "artifactTypes must be a list of non-blank string");
+ } else {
+ for (final String temp : artifactTypes) {
+ if (temp.trim().length() == 0) {
+ validationResult.setResult("artifactTypes", ValidationStatus.INVALID,
+ "the string of artifactTypes must be a non-blank string");
+ }
+ }
+ }
+
+ if (pollingInterval <= 0) {
+ validationResult.setResult("pollingInterval", ValidationStatus.INVALID,
+ "pollingInterval must be a positive integer");
+ }
+
+ if (pollingTimeout <= 0) {
+ validationResult.setResult("pollingTimeout", ValidationStatus.INVALID,
+ "pollingTimeout must be a positive integer");
+ }
+
+ return validationResult;
+ }
+
+ /**
+ * Set the name of this group.
+ *
+ * @param name the name to set.
+ */
+ public void setName(final String name) {
+ this.name = name + "_" + UUID.randomUUID().toString();
+ }
+}
+
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java
index 974436a..93a02b3 100644
--- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java
@@ -38,6 +38,7 @@
private String name;
private String receptionHandlerType;
private String receptionHandlerClassName;
+ private PSSDConfigurationParametersGroup pssdConfiguration;
private PluginHandlerParameters pluginHandlerParameters;
/**
@@ -47,10 +48,12 @@
* @param receptionHandlerClassName the reception handler class name
* @param pluginHandlerParameters the plugin handler parameters
*/
- public ReceptionHandlerParameters(final String receptionHandlerType, final String receptionHandlerClassName,
- final PluginHandlerParameters pluginHandlerParameters) {
+ public ReceptionHandlerParameters(final String receptionHandlerType, final String receptionHandlerClassName,
+ final PSSDConfigurationParametersGroup pssdConfiguration,
+ final PluginHandlerParameters pluginHandlerParameters) {
this.receptionHandlerType = receptionHandlerType;
this.receptionHandlerClassName = receptionHandlerClassName;
+ this.pssdConfiguration = pssdConfiguration;
this.pluginHandlerParameters = pluginHandlerParameters;
}
@@ -73,6 +76,15 @@
}
/**
+ * Return the PSSDConfigurationParametersGroup of this ReceptionHandlerParameters instance.
+ *
+ * @return the PSSDConfigurationParametersGroup
+ */
+ public PSSDConfigurationParametersGroup getPSSDConfigurationParametersGroup() {
+ return pssdConfiguration;
+ }
+
+ /**
* Return the pluginHandlerParameters of this ReceptionHandlerParameters instance.
*
* @return the pluginHandlerParameters