From e80efa0dbe903e976f5b2799144658c7ba02e534 Mon Sep 17 00:00:00 2001 From: ramverma Date: Thu, 13 Sep 2018 16:31:35 +0100 Subject: Adding policy decoder to extract file from csar * Adding decoder configuration parameters infrastructure to support plugin based architecture. Adding a new policy decoder after this will be just creating a new decoder class and its corresponding parameter class. * Adding a new decoder which extracts policy file from given csar. It is written in a generic way to extract file for any pdp like apex, drools. * Adding configuration parameters for the new decoder. The policy file name and policy type is passed as parameter to the decoder. * Fixing few broken package declaration in pdpx decoder tests. * Adding test cases for all code changes. Change-Id: I95e68cebce0f9747ca63b090f9b9116ce8836939 Issue-ID: POLICY-1101 Signed-off-by: ramverma --- .../reception/handling/AbstractReceptionHandlerTest.java | 5 ++++- .../onap/policy/distribution/reception/handling/DummyDecoder.java | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'reception/src/test') diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java b/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java index d339507c..8dc84621 100644 --- a/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java +++ b/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java @@ -29,6 +29,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; + import org.junit.Test; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.distribution.forwarding.PolicyForwarder; @@ -57,6 +58,7 @@ public class AbstractReceptionHandlerTest { private static final String FORWARDER_CLASS_NAME = "org.onap.policy.distribution.reception.handling.DummyPolicyForwarder"; private static final String FORWARDER_CONFIGURATION_PARAMETERS = "DummyConfiguration"; + private static final String DECODER_CONFIGURATION_PARAMETERS = "DummyDecoderConfiguration"; @Test public void testInputReceived() throws PolicyDecodingException, NoSuchFieldException, SecurityException, @@ -171,7 +173,8 @@ public class AbstractReceptionHandlerTest { private Map getPolicyDecoders() { final Map policyDecoders = new HashMap(); - final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME); + final PolicyDecoderParameters pDParameters = + new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME, DECODER_CONFIGURATION_PARAMETERS); policyDecoders.put(DECODER_KEY, pDParameters); return policyDecoders; } diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java b/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java index 2de1737e..74792b1e 100644 --- a/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java +++ b/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java @@ -56,4 +56,7 @@ public class DummyDecoder implements PolicyDecoder { public Collection decode(final PolicyInput input) throws PolicyDecodingException { return policesToReturn; } + + @Override + public void configure(final String parameterGroupName) {} } -- cgit 1.2.3-korg