diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-08-18 17:17:23 -0400 |
---|---|---|
committer | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-08-19 09:44:21 -0400 |
commit | 801ab43d13537d19710e8f948d4614f158daafc7 (patch) | |
tree | c03ff06d789e65266a6e2f58a255dd83fd70773b /plugins/reception-plugins/src/test | |
parent | 7fdd0a9a2eec02bf499663eff8fd7794b007c168 (diff) |
Add yaml support for policy & policy types
Adding support for yaml format of policy & policy types in distribution.
So that users can either define them in json or yaml format.
And then distribute to policy framework.
Issue-ID: POLICY-3509
Change-Id: Ifba7486bbc1e6876f0e3e39b0ae5ebe043567029
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'plugins/reception-plugins/src/test')
2 files changed, 14 insertions, 0 deletions
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java index 812ef6d6..e76e9f38 100644 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java @@ -81,6 +81,20 @@ public class PolicyDecoderFileInCsarToPolicyTest { } @Test + public void testDecodeYamlPolicy() throws PolicyDecodingException { + + final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy(); + decoder.configure(PolicyDecoderFileInCsarToPolicyParameterGroup.class.getSimpleName()); + + final File file = new File("src/test/resources/service-Sampleservice-yaml.csar"); + final Csar csar = new Csar(file.getAbsolutePath()); + + assertTrue(decoder.canHandle(csar)); + final Collection<ToscaEntity> policyHolders = decoder.decode(csar); + assertEquals(2, policyHolders.size()); + } + + @Test public void testDecodePolicyZipError() { final PolicyDecoderFileInCsarToPolicy decoder = new PolicyDecoderFileInCsarToPolicy(); diff --git a/plugins/reception-plugins/src/test/resources/service-Sampleservice-yaml.csar b/plugins/reception-plugins/src/test/resources/service-Sampleservice-yaml.csar Binary files differnew file mode 100644 index 00000000..386dbeeb --- /dev/null +++ b/plugins/reception-plugins/src/test/resources/service-Sampleservice-yaml.csar |