Preloading Tosca compliant operational policy type for apex-pdp 99/101099/4
authora.sreekumar <ajith.sreekumar@est.tech>
Mon, 3 Feb 2020 14:50:46 +0000 (14:50 +0000)
committera.sreekumar <ajith.sreekumar@est.tech>
Tue, 4 Feb 2020 12:27:11 +0000 (12:27 +0000)
Change-Id: I544e275758945007b4d68d0a6b069f5963780178
Issue-ID: POLICY-2147
Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
main/src/test/resources/parameters/ApiConfigParameters_Https.json
packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json
packages/policy-api-tarball/src/main/resources/etc/s3pConfig.json

index 8203b61..177ff53 100644 (file)
@@ -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 {
 
index 68a16bc..a48847c 100644 (file)
@@ -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"
     ]
 }
index faa12de..88363a4 100644 (file)
         "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"
-    ]
-}
+    ]}
index f11bff8..9d5a969 100644 (file)
@@ -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",