aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliboNet <libo.zhu@intel.com>2018-08-18 03:15:59 +0800
committerliboNet <libo.zhu@intel.com>2018-08-22 09:57:45 +0800
commit742c4b2ed82860e2a74f3db3b2048173fbc530d8 (patch)
treec663025f715682863056730c7dbccd8fd522ded7
parent612196451afe9b16b8914858dd58f3bb0dae8579 (diff)
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>
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/startstop/DistributionActivator.java3
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java33
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestPolicyDecoderParameters.java3
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java47
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json26
-rw-r--r--main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json26
-rw-r--r--main/src/test/resources/parameters/MinimumParameters.json26
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java1
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java54
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerException.java54
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadException.java54
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersException.java54
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java4
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerExceptionTest.java36
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java36
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java36
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java36
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/parameters/PSSDConfigurationParametersGroup.java (renamed from plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java)108
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java16
29 files changed, 875 insertions, 38 deletions
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 d360b5dd..4f650719 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 @@ public class DistributionActivator {
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 @@ public class DistributionActivator {
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 54716fc8..0903b070 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 @@ public class CommonTestData {
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 35acdf2e..c2ab38d8 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 @@ public class TestPolicyDecoderParameters {
@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 10faed8c..c902c9b5 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 static org.junit.Assert.fail;
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 @@ public class TestReceptionHandlerParameters {
@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 @@ public class TestReceptionHandlerParameters {
@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 @@ public class TestReceptionHandlerParameters {
@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 @@ public class TestReceptionHandlerParameters {
@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 @@ public class TestReceptionHandlerParameters {
@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 class TestReceptionHandlerParameters {
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 @@ public class TestReceptionHandlerParameters {
@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 546e5231..bcf8b263 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 7a0d14a7..a53dc05f 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 b328df3d..b88fda2a 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 c84a6784..aae53f50 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 eeafc25a..c1ad0a9e 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 21ff4ad6..26f470ea 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 6cf54d80..a194e958 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 ea44b8aa..895e7d55 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 7be2a1a6..a368a5b6 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 791236cb..bf0db3e6 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 3ba35753..06d18674 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 660cac92..d8343b19 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 1b42cc4d..18cd529c 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 86d2a550..baba4d42 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 @@ package org.onap.policy.distribution.reception.handling.sdc;
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/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 00000000..043b0a41
--- /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 00000000..ff9acfd0
--- /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 00000000..f95179c1
--- /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 00000000..91922d7d
--- /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 bcb7ac80..435b7577 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.FileReader;
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 @@ public class PSSDConfigurationTest {
}
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 @@ public class PSSDConfigurationTest {
}
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 00000000..6c524ffe
--- /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 00000000..b467cbad
--- /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 00000000..0ca4330d
--- /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 00000000..040895e6
--- /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/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PSSDConfigurationParametersGroup.java
index 7fa81149..52e0988a 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PSSDConfigurationParametersGroup.java
@@ -17,10 +17,13 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
+package org.onap.policy.distribution.reception.parameters;
-package org.onap.policy.distribution.reception.handling.sdc;
-
+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;
@@ -31,6 +34,7 @@ import org.onap.policy.common.parameters.ValidationStatus;
* 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;
@@ -51,6 +55,92 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup {
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;
}
@@ -119,17 +209,13 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup {
@Override
public String getName() {
- return name;
+ 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");
@@ -195,5 +281,13 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup {
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 974436aa..93a02b3b 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 @@ public class ReceptionHandlerParameters implements ParameterGroup {
private String name;
private String receptionHandlerType;
private String receptionHandlerClassName;
+ private PSSDConfigurationParametersGroup pssdConfiguration;
private PluginHandlerParameters pluginHandlerParameters;
/**
@@ -47,10 +48,12 @@ public class ReceptionHandlerParameters implements ParameterGroup {
* @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 @@ public class ReceptionHandlerParameters implements ParameterGroup {
}
/**
+ * 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