From: a.sreekumar Date: Mon, 3 Feb 2020 14:50:46 +0000 (+0000) Subject: Preloading Tosca compliant operational policy type for apex-pdp X-Git-Tag: 2.2.0~16 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=d1b8a23cedeb7bb0ebf7371eea447fed1bd3e3aa;p=policy%2Fapi.git Preloading Tosca compliant operational policy type for apex-pdp Change-Id: I544e275758945007b4d68d0a6b069f5963780178 Issue-ID: POLICY-2147 Signed-off-by: a.sreekumar --- diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java index 8203b619..177ff535 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java @@ -3,7 +3,7 @@ * ONAP Policy API * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ import static org.junit.Assert.assertNotNull; import java.util.Base64; import java.util.Collections; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -66,6 +65,8 @@ public class TestPolicyTypeProvider { public static final String POLICY_TYPE_RESOURCE_OPERATIONAL = "policytypes/onap.policies.controlloop.operational.Common.yaml"; + public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_APEX = + "policytypes/onap.policies.controlloop.operational.common.Apex.yaml"; public static final String POLICY_TYPE_OPERATIONAL_COMMON = "onap.policies.controlloop.operational.Common"; public static final String POLICY_TYPE_OPERATIONAL_APEX = "onap.policies.controlloop.operational.common.Apex"; public static final String POLICY_TYPE_OPERATIONAL_DROOLS = "onap.policies.controlloop.operational.common.Drools"; @@ -154,19 +155,26 @@ public class TestPolicyTypeProvider { @Test public void testCreateOperationalPolicyTypes() throws CoderException, PfModelException { - ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode( - ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL), ToscaServiceTemplate.class); + ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder + .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL), ToscaServiceTemplate.class); ToscaServiceTemplate serviceTemplate = policyTypeProvider.createPolicyType(policyTypeServiceTemplate); assertNotNull(serviceTemplate.getPolicyTypes().get(POLICY_TYPE_OPERATIONAL_COMMON)); - assertNotNull(serviceTemplate.getPolicyTypes().get(POLICY_TYPE_OPERATIONAL_APEX)); assertNotNull(serviceTemplate.getPolicyTypes().get(POLICY_TYPE_OPERATIONAL_DROOLS)); policyTypeProvider.deletePolicyType(POLICY_TYPE_OPERATIONAL_COMMON, POLICY_TYPE_VERSION); - policyTypeProvider.deletePolicyType(POLICY_TYPE_OPERATIONAL_APEX, POLICY_TYPE_VERSION); policyTypeProvider.deletePolicyType(POLICY_TYPE_OPERATIONAL_DROOLS, POLICY_TYPE_VERSION); } + @Test + public void testCreateApexOperationalPolicyTypes() throws CoderException, PfModelException { + ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode( + ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_APEX), ToscaServiceTemplate.class); + ToscaServiceTemplate serviceTemplate = policyTypeProvider.createPolicyType(policyTypeServiceTemplate); + assertNotNull(serviceTemplate.getPolicyTypes().get(POLICY_TYPE_OPERATIONAL_APEX)); + policyTypeProvider.deletePolicyType(POLICY_TYPE_OPERATIONAL_APEX, POLICY_TYPE_VERSION); + } + @Test public void testDeletePolicyType() throws Exception { diff --git a/main/src/test/resources/parameters/ApiConfigParameters_Https.json b/main/src/test/resources/parameters/ApiConfigParameters_Https.json index 68a16bc8..a48847cb 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters_Https.json +++ b/main/src/test/resources/parameters/ApiConfigParameters_Https.json @@ -40,6 +40,8 @@ "policytypes/onap.policies.drools.Controller.yaml", "policytypes/onap.policies.native.Drools.yaml", "policytypes/onap.policies.native.Xacml.yaml", - "policytypes/onap.policies.native.Apex.yaml" + "policytypes/onap.policies.native.Apex.yaml", + "policytypes/onap.policies.controlloop.operational.Common.yaml", + "policytypes/onap.policies.controlloop.operational.common.Apex.yaml" ] } diff --git a/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json b/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json index faa12def..88363a41 100644 --- a/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json +++ b/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json @@ -38,10 +38,10 @@ "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml", "policytypes/onap.policies.controlloop.Operational.yaml", "policytypes/onap.policies.controlloop.operational.Common.yaml", + "policytypes/onap.policies.controlloop.operational.common.Apex.yaml", "policytypes/onap.policies.Naming.yaml", "policytypes/onap.policies.drools.Controller.yaml", "policytypes/onap.policies.native.Drools.yaml", "policytypes/onap.policies.native.Xacml.yaml", "policytypes/onap.policies.native.Apex.yaml" - ] -} + ]} diff --git a/packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json b/packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json index f11bff81..9d5a9698 100644 --- a/packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json +++ b/packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json @@ -35,6 +35,8 @@ "policytypes/onap.policies.controlloop.guard.MinMax.yaml", "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml", "policytypes/onap.policies.controlloop.Operational.yaml", + "policytypes/onap.policies.controlloop.operational.Common.yaml", + "policytypes/onap.policies.controlloop.operational.common.Apex.yaml", "policytypes/onap.policies.Naming.yaml", "policytypes/onap.policies.drools.Controller.yaml", "policytypes/onap.policies.native.Drools.yaml",