diff options
Diffstat (limited to 'main/src')
21 files changed, 444 insertions, 395 deletions
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java index 27291255..1f3e48e6 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java +++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterGroup.java @@ -27,6 +27,7 @@ import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.ValidationStatus; import org.onap.policy.common.utils.validation.ParameterValidationUtils; +import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup; import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters; /** @@ -38,6 +39,8 @@ public class DistributionParameterGroup implements ParameterGroup { private String name; private RestServerParameters restServerParameters; private Map<String, ReceptionHandlerParameters> receptionHandlerParameters; + private Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters = + new LinkedHashMap<>(); private Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters = new LinkedHashMap<>(); @@ -49,10 +52,12 @@ public class DistributionParameterGroup implements ParameterGroup { */ public DistributionParameterGroup(final String name, final RestServerParameters restServerParameters, final Map<String, ReceptionHandlerParameters> receptionHandlerParameters, + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters, final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters) { this.name = name; this.restServerParameters = restServerParameters; this.receptionHandlerParameters = receptionHandlerParameters; + this.receptionHandlerConfigurationParameters = receptionHandlerConfigurationParameters; this.policyForwarderConfigurationParameters = policyForwarderConfigurationParameters; } @@ -94,6 +99,24 @@ public class DistributionParameterGroup implements ParameterGroup { return restServerParameters; } + /** + * Gets the reception handler configuration parameter map. + * + * @return the reception handler configuration parameter map + */ + public Map<String, ReceptionHandlerConfigurationParameterGroup> getReceptionHandlerConfigurationParameters() { + return receptionHandlerConfigurationParameters; + } + + /** + * Sets the reception handler configuration parameter map. + * + * @param eventInputParameters the reception handler configuration parameters + */ + public void setReceptionHandlerConfigurationParameters( + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters) { + this.receptionHandlerConfigurationParameters = receptionHandlerConfigurationParameters; + } /** * Gets the policy forwarder configuration parameter map. diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java index 5cc507e6..c1c64f7e 100644 --- a/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java +++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/DistributionParameterHandler.java @@ -28,6 +28,8 @@ import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.distribution.main.PolicyDistributionException; import org.onap.policy.distribution.main.startstop.DistributionCommandLineArguments; +import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup; +import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParametersJsonAdapter; /** * This class handles reading, parsing and validating of policy distribution parameters from JSON @@ -50,8 +52,12 @@ public class DistributionParameterHandler { // Read the parameters try { // Read the parameters from JSON using Gson - final Gson gson = new GsonBuilder().registerTypeAdapter(PolicyForwarderConfigurationParameterGroup.class, - new PolicyForwarderConfigurationParametersJsonAdapter()).create(); + final Gson gson = new GsonBuilder() + .registerTypeAdapter(PolicyForwarderConfigurationParameterGroup.class, + new PolicyForwarderConfigurationParametersJsonAdapter()) + .registerTypeAdapter(ReceptionHandlerConfigurationParameterGroup.class, + new ReceptionHandlerConfigurationParametersJsonAdapter()) + .create(); distributionParameterGroup = gson.fromJson(new FileReader(arguments.getFullConfigurationFilePath()), DistributionParameterGroup.class); } catch (final Exception e) { 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 d4b7fb79..91052580 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 @@ -32,6 +32,7 @@ import org.onap.policy.distribution.main.parameters.PolicyForwarderConfiguration import org.onap.policy.distribution.main.rest.DistributionRestServer; import org.onap.policy.distribution.reception.decoding.PluginInitializationException; import org.onap.policy.distribution.reception.handling.AbstractReceptionHandler; +import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup; import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters; /** @@ -143,10 +144,8 @@ 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()); } for (final Entry<String, PolicyForwarderConfigurationParameterGroup> forwarderConfiguration : distributionParameterGroup @@ -154,6 +153,11 @@ public class DistributionActivator { forwarderConfiguration.getValue().setName(forwarderConfiguration.getKey()); ParameterService.register(forwarderConfiguration.getValue()); } + for (final Entry<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfiguration : distributionParameterGroup + .getReceptionHandlerConfigurationParameters().entrySet()) { + receptionHandlerConfiguration.getValue().setName(receptionHandlerConfiguration.getKey()); + ParameterService.register(receptionHandlerConfiguration.getValue()); + } } /** @@ -166,7 +170,6 @@ public class DistributionActivator { for (final ReceptionHandlerParameters params : distributionParameterGroup.getReceptionHandlerParameters() .values()) { ParameterService.deregister((params.getName())); - ParameterService.deregister((params.getPssdConfigurationParametersGroup().getName())); ParameterService.deregister((params.getPluginHandlerParameters().getName())); } for (final Entry<String, PolicyForwarderConfigurationParameterGroup> forwarderConfiguration : distributionParameterGroup @@ -174,6 +177,11 @@ public class DistributionActivator { forwarderConfiguration.getValue().setName(forwarderConfiguration.getKey()); ParameterService.deregister(forwarderConfiguration.getKey()); } + for (final Entry<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfiguration : distributionParameterGroup + .getReceptionHandlerConfigurationParameters().entrySet()) { + receptionHandlerConfiguration.getValue().setName(receptionHandlerConfiguration.getKey()); + ParameterService.deregister(receptionHandlerConfiguration.getKey()); + } } /** 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 186aa821..b1903152 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 @@ -27,9 +27,11 @@ import java.util.Map; import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters; import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup; import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup.DummyPolicyForwarderParameterGroupBuilder; +import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup; +import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup.DummyReceptionHandlerParameterGroupBuilder; import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters; import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters; -import org.onap.policy.distribution.reception.parameters.PssdConfigurationParametersGroup; +import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup; import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters; /** @@ -54,6 +56,11 @@ public class CommonTestData { public static final String RECEPTION_HANDLER_TYPE = "DummyReceptionHandler"; public static final String RECEPTION_HANDLER_CLASS_NAME = "org.onap.policy.distribution.main.testclasses.DummyReceptionHandler"; + public static final String RECEPTION_CONFIGURATION_PARAMETERS = "dummyReceptionHandlerConfiguration"; + public static final String MY_STRING_PARAMETER_VALUE = "aStringValue"; + public static final Boolean MY_BOOLEAN_PARAMETER_VALUE = true; + public static final int MY_INTEGER_PARAMETER_VALUE = 1234; + public static final String DUMMY_RECEPTION_HANDLER_KEY = "DummyReceptionHandler"; public static final String DUMMY_ENGINE_FORWARDER_KEY = "DummyForwarder"; public static final String DUMMY_DECODER_KEY = "DummyDecoder"; @@ -87,38 +94,37 @@ 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, pssdConfiguration, pHParameters); + RECEPTION_HANDLER_CLASS_NAME, RECEPTION_CONFIGURATION_PARAMETERS, pHParameters); receptionHandlerParameters.put(DUMMY_RECEPTION_HANDLER_KEY, rhParameters); } return receptionHandlerParameters; } /** - * Returns an instance of PssdConfigurationParametersGroup for test cases. + * Returns ReceptionHandlerConfigurationParameterGroups for test cases. * * @param isEmpty boolean value to represent that object created should be empty or not - * @return the PssdConfigurationParametersGroup object + * @return the ReceptionHandlerConfigurationParameterGroups */ - public PssdConfigurationParametersGroup getPssdConfigurationParametersGroup(final boolean isEmpty) { - final PssdConfigurationParametersGroup pssdConfiguration; + public Map<String, ReceptionHandlerConfigurationParameterGroup> getReceptionHandlerConfigurationParameters( + final boolean isEmpty) { + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters = + new HashMap<String, ReceptionHandlerConfigurationParameterGroup>(); 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(); + DummyReceptionHandlerParameterGroup dummyReceptionHandlerParameterGroup = + new DummyReceptionHandlerParameterGroupBuilder().setMyStringParameter(MY_STRING_PARAMETER_VALUE) + .setMyIntegerParameter(MY_INTEGER_PARAMETER_VALUE) + .setMyBooleanParameter(MY_BOOLEAN_PARAMETER_VALUE).build(); + receptionHandlerConfigurationParameters.put(RECEPTION_CONFIGURATION_PARAMETERS, + dummyReceptionHandlerParameterGroup); } - return pssdConfiguration; + return receptionHandlerConfigurationParameters; } /** diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java index 0c8c80d6..2df1cd47 100644 --- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java +++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java @@ -29,6 +29,8 @@ import java.util.Map; import org.junit.Test; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup; +import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup; +import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup; import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters; /** @@ -42,36 +44,50 @@ public class TestDistributionParameterGroup { @Test public void testDistributionParameterGroup() { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false); - final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = commonTestData - .getReceptionHandlerParameters(false); + final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = + commonTestData.getReceptionHandlerParameters(false); + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations = + commonTestData.getReceptionHandlerConfigurationParameters(false); final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations = commonTestData.getPolicyForwarderConfigurationParameters(false); final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, - receptionHandlerParameters, forwarderConfigurations); + receptionHandlerParameters, receptionHandlerConfigurations, forwarderConfigurations); final GroupValidationResult validationResult = distributionParameters.validate(); assertTrue(validationResult.isValid()); assertEquals(restServerParameters.getHost(), distributionParameters.getRestServerParameters().getHost()); assertEquals(restServerParameters.getPort(), distributionParameters.getRestServerParameters().getPort()); assertEquals(restServerParameters.getUserName(), - distributionParameters.getRestServerParameters().getUserName()); + distributionParameters.getRestServerParameters().getUserName()); assertEquals(restServerParameters.getPassword(), - distributionParameters.getRestServerParameters().getPassword()); + distributionParameters.getRestServerParameters().getPassword()); assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, distributionParameters.getName()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getReceptionHandlerType(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType(), + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getReceptionHandlerType()); + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) .getReceptionHandlerClassName(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getReceptionHandlerClassName()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getPluginHandlerParameters(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters()); + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getReceptionHandlerClassName()); + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(), + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getPluginHandlerParameters()); + assertEquals(CommonTestData.MY_STRING_PARAMETER_VALUE, + ((DummyReceptionHandlerParameterGroup) distributionParameters + .getReceptionHandlerConfigurationParameters() + .get(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS)).getMyStringParameter()); + assertEquals(CommonTestData.MY_INTEGER_PARAMETER_VALUE, + ((DummyReceptionHandlerParameterGroup) distributionParameters + .getReceptionHandlerConfigurationParameters() + .get(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS)).getMyIntegerParameter()); + assertEquals(CommonTestData.MY_BOOLEAN_PARAMETER_VALUE, + ((DummyReceptionHandlerParameterGroup) distributionParameters + .getReceptionHandlerConfigurationParameters() + .get(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS)).getMyBooleanParameter()); assertEquals(CommonTestData.FORWARDER_HOST, ((DummyPolicyForwarderParameterGroup) distributionParameters.getPolicyForwarderConfigurationParameters() .get(CommonTestData.FORWARDER_CONFIGURATION_PARAMETERS)).getHostname()); @@ -80,72 +96,80 @@ public class TestDistributionParameterGroup { @Test public void testDistributionParameterGroup_NullName() { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false); - final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = commonTestData - .getReceptionHandlerParameters(false); + final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = + commonTestData.getReceptionHandlerParameters(false); + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations = + commonTestData.getReceptionHandlerConfigurationParameters(false); final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations = commonTestData.getPolicyForwarderConfigurationParameters(false); - final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(null, - restServerParameters, receptionHandlerParameters, forwarderConfigurations); + final DistributionParameterGroup distributionParameters = + new DistributionParameterGroup(null, restServerParameters, receptionHandlerParameters, + receptionHandlerConfigurations, forwarderConfigurations); final GroupValidationResult validationResult = distributionParameters.validate(); assertFalse(validationResult.isValid()); assertEquals(null, distributionParameters.getName()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getReceptionHandlerType(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType(), + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getReceptionHandlerType()); + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) .getReceptionHandlerClassName(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getReceptionHandlerClassName()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getPluginHandlerParameters(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters()); - assertTrue(validationResult.getResult() - .contains("field \"name\" type \"java.lang.String\" value \"null\" INVALID, " - + "must be a non-blank string")); + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getReceptionHandlerClassName()); + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(), + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getPluginHandlerParameters()); + assertTrue(validationResult.getResult().contains( + "field \"name\" type \"java.lang.String\" value \"null\" INVALID, " + "must be a non-blank string")); } @Test public void testDistributionParameterGroup_EmptyName() { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false); - final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = commonTestData - .getReceptionHandlerParameters(false); + final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = + commonTestData.getReceptionHandlerParameters(false); + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations = + commonTestData.getReceptionHandlerConfigurationParameters(false); final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations = commonTestData.getPolicyForwarderConfigurationParameters(false); - final DistributionParameterGroup distributionParameters = new DistributionParameterGroup("", - restServerParameters, receptionHandlerParameters, forwarderConfigurations); + final DistributionParameterGroup distributionParameters = + new DistributionParameterGroup("", restServerParameters, receptionHandlerParameters, + receptionHandlerConfigurations, forwarderConfigurations); final GroupValidationResult validationResult = distributionParameters.validate(); assertFalse(validationResult.isValid()); assertEquals("", distributionParameters.getName()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getReceptionHandlerType(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType(), + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getReceptionHandlerType()); + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) .getReceptionHandlerClassName(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getReceptionHandlerClassName()); - assertEquals(receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) - .getPluginHandlerParameters(), - distributionParameters.getReceptionHandlerParameters() - .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters()); - assertTrue(validationResult.getResult().contains("field \"name\" type \"java.lang.String\" value \"\" INVALID, " - + "must be a non-blank string")); + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getReceptionHandlerClassName()); + assertEquals( + receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(), + distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY) + .getPluginHandlerParameters()); + assertTrue(validationResult.getResult().contains( + "field \"name\" type \"java.lang.String\" value \"\" INVALID, " + "must be a non-blank string")); } @Test public void testDistributionParameterGroup_NullReceptionHandlerParameters() { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false); + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations = + commonTestData.getReceptionHandlerConfigurationParameters(false); final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations = commonTestData.getPolicyForwarderConfigurationParameters(false); try { - final DistributionParameterGroup distributionParameters = new DistributionParameterGroup( - CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, null, forwarderConfigurations); + final DistributionParameterGroup distributionParameters = + new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, null, + receptionHandlerConfigurations, forwarderConfigurations); distributionParameters.validate(); fail("test should throw an exception here"); } catch (final Exception e) { @@ -157,13 +181,15 @@ public class TestDistributionParameterGroup { @Test public void testDistributionParameterGroup_EmptyReceptionHandlerParameters() { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false); - final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = commonTestData - .getReceptionHandlerParameters(true); + final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = + commonTestData.getReceptionHandlerParameters(true); + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations = + commonTestData.getReceptionHandlerConfigurationParameters(false); final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations = commonTestData.getPolicyForwarderConfigurationParameters(false); final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, - receptionHandlerParameters, forwarderConfigurations); + receptionHandlerParameters, receptionHandlerConfigurations, forwarderConfigurations); distributionParameters.validate(); GroupValidationResult result = distributionParameters.validate(); assertFalse(result.isValid()); @@ -173,18 +199,20 @@ public class TestDistributionParameterGroup { @Test public void testDistributionParameterGroup_EmptyRestServerParameters() { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(true); - final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = commonTestData - .getReceptionHandlerParameters(false); + final Map<String, ReceptionHandlerParameters> receptionHandlerParameters = + commonTestData.getReceptionHandlerParameters(false); + final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurations = + commonTestData.getReceptionHandlerConfigurationParameters(false); final Map<String, PolicyForwarderConfigurationParameterGroup> forwarderConfigurations = commonTestData.getPolicyForwarderConfigurationParameters(false); final DistributionParameterGroup distributionParameters = new DistributionParameterGroup(CommonTestData.DISTRIBUTION_GROUP_NAME, restServerParameters, - receptionHandlerParameters, forwarderConfigurations); + receptionHandlerParameters, receptionHandlerConfigurations, forwarderConfigurations); final GroupValidationResult validationResult = distributionParameters.validate(); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult() - .contains("\"org.onap.policy.distribution.main.parameters.RestServerParameters\" INVALID, " - + "parameter group has status INVALID")); + .contains("\"org.onap.policy.distribution.main.parameters.RestServerParameters\" INVALID, " + + "parameter group has status INVALID")); } } diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestReceptionHandlerParameters.java index ab86cb65..2dde9666 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,7 +27,6 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters; -import org.onap.policy.distribution.reception.parameters.PssdConfigurationParametersGroup; import org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters; /** @@ -41,15 +40,14 @@ public class TestReceptionHandlerParameters { @Test public void testReceptionHandlerParameters() { 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, - pssdConfiguration, pHParameters); + CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME, + CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, 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(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, + rHParameters.getReceptionHandlerConfigurationName()); assertEquals(pHParameters, rHParameters.getPluginHandlerParameters()); assertTrue(validationResult.isValid()); } @@ -57,84 +55,79 @@ 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, pssdConfiguration, pHParameters); + final ReceptionHandlerParameters rHParameters = + new ReceptionHandlerParameters(null, CommonTestData.RECEPTION_HANDLER_CLASS_NAME, + CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters); final GroupValidationResult validationResult = rHParameters.validate(); assertEquals(null, rHParameters.getReceptionHandlerType()); assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName()); - assertEquals(pssdConfiguration, rHParameters.getPssdConfigurationParametersGroup()); + assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, + rHParameters.getReceptionHandlerConfigurationName()); assertEquals(pHParameters, rHParameters.getPluginHandlerParameters()); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult() - .contains("field \"receptionHandlerType\" type \"java.lang.String\" value \"null\" INVALID, " - + "must be a non-blank string")); + .contains("field \"receptionHandlerType\" type \"java.lang.String\" value \"null\" INVALID, " + + "must be a non-blank string")); } @Test public void testReceptionHandlerParameters_NullReceptionHandlerClassName() { final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false); - final PssdConfigurationParametersGroup pssdConfiguration = commonTestData - .getPssdConfigurationParametersGroup(false); - final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters( - CommonTestData.RECEPTION_HANDLER_TYPE, null, pssdConfiguration, pHParameters); + final ReceptionHandlerParameters rHParameters = + new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, null, + CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters); final GroupValidationResult validationResult = rHParameters.validate(); assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType()); assertEquals(null, rHParameters.getReceptionHandlerClassName()); - assertEquals(pssdConfiguration, rHParameters.getPssdConfigurationParametersGroup()); + assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, + rHParameters.getReceptionHandlerConfigurationName()); assertEquals(pHParameters, rHParameters.getPluginHandlerParameters()); assertFalse(validationResult.isValid()); - assertTrue(validationResult.getResult().contains( - "field \"receptionHandlerClassName\" type \"java.lang.String\" value \"null\" INVALID, " - + "must be a non-blank string containing full class name " - + "of the reception handler")); + assertTrue(validationResult.getResult() + .contains("field \"receptionHandlerClassName\" type \"java.lang.String\" value \"null\" INVALID, " + + "must be a non-blank string containing full class name " + "of the reception handler")); } @Test public void testReceptionHandlerParameters_EmptyReceptionHandlerType() { final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false); - final PssdConfigurationParametersGroup pssdConfiguration = commonTestData - .getPssdConfigurationParametersGroup(false); - final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters("", - CommonTestData.RECEPTION_HANDLER_CLASS_NAME, pssdConfiguration, pHParameters); + final ReceptionHandlerParameters rHParameters = + new ReceptionHandlerParameters("", CommonTestData.RECEPTION_HANDLER_CLASS_NAME, + CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters); final GroupValidationResult validationResult = rHParameters.validate(); assertEquals("", rHParameters.getReceptionHandlerType()); assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME, rHParameters.getReceptionHandlerClassName()); assertEquals(pHParameters, rHParameters.getPluginHandlerParameters()); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult() - .contains("field \"receptionHandlerType\" type \"java.lang.String\" value \"\" INVALID, " - + "must be a non-blank string")); + .contains("field \"receptionHandlerType\" type \"java.lang.String\" value \"\" INVALID, " + + "must be a non-blank string")); } @Test public void testReceptionHandlerParameters_EmptyReceptionHandlerClassName() { final PluginHandlerParameters pHParameters = commonTestData.getPluginHandlerParameters(false); - final PssdConfigurationParametersGroup pssdConfiguration = commonTestData - .getPssdConfigurationParametersGroup(false); - final ReceptionHandlerParameters rHParameters = new ReceptionHandlerParameters( - CommonTestData.RECEPTION_HANDLER_TYPE, "", pssdConfiguration, pHParameters); + final ReceptionHandlerParameters rHParameters = + new ReceptionHandlerParameters(CommonTestData.RECEPTION_HANDLER_TYPE, "", + CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters); final GroupValidationResult validationResult = rHParameters.validate(); assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType()); assertEquals("", rHParameters.getReceptionHandlerClassName()); - assertEquals(pssdConfiguration, rHParameters.getPssdConfigurationParametersGroup()); + assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, + rHParameters.getReceptionHandlerConfigurationName()); assertEquals(pHParameters, rHParameters.getPluginHandlerParameters()); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult() - .contains("field \"receptionHandlerClassName\" type \"java.lang.String\" value \"\" INVALID, " - + "must be a non-blank string containing full class name " - + "of the reception handler")); + .contains("field \"receptionHandlerClassName\" type \"java.lang.String\" value \"\" INVALID, " + + "must be a non-blank string containing full class name " + "of the reception handler")); } @Test public void testReceptionHandlerParameters_EmptyPluginHandler() { 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, - pssdConfiguration, pHParameters); + CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME, + CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters); GroupValidationResult result = rHParameters.validate(); assertFalse(result.isValid()); assertTrue(result.getResult().endsWith("must have at least one policy forwarder\n")); @@ -143,16 +136,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", - pssdConfiguration, pHParameters); + CommonTestData.RECEPTION_HANDLER_TYPE, CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid", + CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, pHParameters); final GroupValidationResult validationResult = rHParameters.validate(); assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, rHParameters.getReceptionHandlerType()); assertEquals(CommonTestData.RECEPTION_HANDLER_CLASS_NAME + "Invalid", - rHParameters.getReceptionHandlerClassName()); - assertEquals(pssdConfiguration, rHParameters.getPssdConfigurationParametersGroup()); + rHParameters.getReceptionHandlerClassName()); + assertEquals(CommonTestData.RECEPTION_CONFIGURATION_PARAMETERS, + rHParameters.getReceptionHandlerConfigurationName()); assertEquals(pHParameters, rHParameters.getPluginHandlerParameters()); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult().contains("reception handler class not found in classpath")); diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandlerParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandlerParameterGroup.java new file mode 100644 index 00000000..d452e96c --- /dev/null +++ b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandlerParameterGroup.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.distribution.main.testclasses; + +import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup; + +public class DummyReceptionHandlerParameterGroup extends ReceptionHandlerConfigurationParameterGroup { + + private String myStringParameter; + private int myIntegerParameter; + private boolean myBooleanParameter; + + /** + * Inner static class is to used as a Builder. + * + */ + public static class DummyReceptionHandlerParameterGroupBuilder { + private String myStringParameter; + private int myIntegerParameter; + private boolean myBooleanParameter; + + public DummyReceptionHandlerParameterGroupBuilder setMyStringParameter(final String val) { + myStringParameter = val; + return this; + } + + public DummyReceptionHandlerParameterGroupBuilder setMyIntegerParameter(final int val) { + myIntegerParameter = val; + return this; + } + + public DummyReceptionHandlerParameterGroupBuilder setMyBooleanParameter(final boolean val) { + myBooleanParameter = val; + return this; + } + + /** + * Creates a new DummyReceptionHandlerConfigurationParameterGroup instance. + */ + public DummyReceptionHandlerParameterGroup build() { + return new DummyReceptionHandlerParameterGroup(this); + } + } + + /** + * The constructor for instantiating PssdConfigurationParameterGroup. It is kept private so that + * it could only be called by PssdConfigurationBuilder. + * + * @param builder stores all the values used by PssdConfigurationParametersGroup + */ + private DummyReceptionHandlerParameterGroup(final DummyReceptionHandlerParameterGroupBuilder builder) { + myStringParameter = builder.myStringParameter; + myIntegerParameter = builder.myIntegerParameter; + myBooleanParameter = builder.myBooleanParameter; + } + + public String getMyStringParameter() { + return myStringParameter; + } + + public int getMyIntegerParameter() { + return myIntegerParameter; + } + + public boolean getMyBooleanParameter() { + return myBooleanParameter; + } + + + /** + * {@inheritDoc}. + */ + @Override + public GroupValidationResult validate() { + return new GroupValidationResult(this); + } + +} + diff --git a/main/src/test/resources/parameters/DistributionConfigParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters.json index 7a557624..acf56764 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -51,6 +28,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json index d11ac9ea..e22af281 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ }, @@ -47,6 +24,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json index c534154c..4d271308 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -46,6 +23,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json index b8010f8d..c25b2e35 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_EmptyReceptionHandler.json @@ -8,6 +8,16 @@ }, "receptionHandlerParameters":{ }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json index 0c9caa6c..bd52e186 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -70,6 +47,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json index ba895a67..60c28e08 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidForwarderConfigurationClassName.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -51,6 +28,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json index 7cafc266..46207204 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -51,6 +28,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json index 793702fb..123ff203 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.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 - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -51,6 +28,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json index 0d650331..47528ce0 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -51,6 +28,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json index f9392db5..f78bb65f 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyForwarders":{ "DummyForwarder":{ @@ -45,6 +22,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json index 7d9a8af4..3ac54f73 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -43,5 +20,15 @@ } } } + }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } } } diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json b/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json index b91e95d8..7a9ecd15 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_NoReceptionHandler.json @@ -5,5 +5,15 @@ "port":6969, "userName":"healthcheck", "password":"zb!XztG34" + }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } } }
\ No newline at end of file diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json b/main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json index c189671d..3118631b 100644 --- a/main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json +++ b/main/src/test/resources/parameters/DistributionConfigParameters_UnknownForwarderConfigurationClassName.json @@ -51,6 +51,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.Unknown", diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json index 1b797def..fc6b16aa 100644 --- a/main/src/test/resources/parameters/MinimumParameters.json +++ b/main/src/test/resources/parameters/MinimumParameters.json @@ -10,30 +10,7 @@ "DummyReceptionHandler":{ "receptionHandlerType":"DummyReceptionHandler", "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler", - "pssdConfiguration":{ - "asdcAddress": "localhost", - "messageBusAddress": [ - "a.com", - "b.com", - "c.com" - ], - "user": "tbdsdc-1480", - "password": "tbdsdc-1480", - "pollingInterval":20, - "pollingTimeout":30, - "consumerId": "policy-id", - "artifactTypes": [ - "TOSCA_CSAR", - "HEAT" - ], - "consumerGroup": "policy-group", - "environmentName": "environmentName", - "keystorePath": "null", - "keystorePassword": "null", - "activeserverTlsAuth": false, - "isFilterinEmptyResources": true, - "isUseHttpsWithDmaap": false - }, + "receptionHandlerConfigurationName":"dummyReceptionHandlerConfiguration", "pluginHandlerParameters":{ "policyDecoders":{ "DummyDecoder":{ @@ -51,6 +28,16 @@ } } }, + "receptionHandlerConfigurationParameters":{ + "dummyReceptionHandlerConfiguration":{ + "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup", + "parameters":{ + "myStringParameter": "stringValue", + "myIntegerParameter":20, + "myBooleanParameter": true + } + } + }, "policyForwarderConfigurationParameters":{ "dummyConfiguration":{ "parameterClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup", |