aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2020-02-03 14:50:46 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2020-02-04 12:27:11 +0000
commitd1b8a23cedeb7bb0ebf7371eea447fed1bd3e3aa (patch)
tree4afebc5e3f93efe99685045cbaa7ffc5b082f36b /main/src/test
parent5d73c3386efb49808d1cafe63bb0b9041878a2d9 (diff)
Preloading Tosca compliant operational policy type for apex-pdp
Change-Id: I544e275758945007b4d68d0a6b069f5963780178 Issue-ID: POLICY-2147 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java20
-rw-r--r--main/src/test/resources/parameters/ApiConfigParameters_Https.json4
2 files changed, 17 insertions, 7 deletions
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,20 +155,27 @@ 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 {
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode(
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"
]
}