From 801ab43d13537d19710e8f948d4614f158daafc7 Mon Sep 17 00:00:00 2001 From: Ram Krishna Verma Date: Wed, 18 Aug 2021 17:17:23 -0400 Subject: 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 --- .../policy/file/PolicyDecoderFileInCsarToPolicyTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'plugins/reception-plugins/src/test/java') 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 @@ -80,6 +80,20 @@ public class PolicyDecoderFileInCsarToPolicyTest { assertEquals(2, policyHolders.size()); } + @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 policyHolders = decoder.decode(csar); + assertEquals(2, policyHolders.size()); + } + @Test public void testDecodePolicyZipError() { -- cgit 1.2.3-korg