From d1b8a23cedeb7bb0ebf7371eea447fed1bd3e3aa Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Mon, 3 Feb 2020 14:50:46 +0000 Subject: Preloading Tosca compliant operational policy type for apex-pdp Change-Id: I544e275758945007b4d68d0a6b069f5963780178 Issue-ID: POLICY-2147 Signed-off-by: a.sreekumar --- .../main/rest/provider/TestPolicyTypeProvider.java | 20 ++++++++++++++------ .../parameters/ApiConfigParameters_Https.json | 4 +++- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'main/src/test') 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" ] } -- cgit 1.2.3-korg