summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-08-19 18:39:14 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-08-19 18:39:18 -0400
commitcab983fd09411170fdde17227c3bfec8e72e9aa6 (patch)
tree2955e10bcbbad9877057e1645cc73d568e521439 /main
parent2db0f6ed167167a6f3825e5c77ec0e9e25342385 (diff)
Updates tests for new tcagen2 policy type
Forgot to include these. Once models got merged api failed. Issue-ID: POLICY-2772 Change-Id: Iae64effcba71ecbfbf6ab253de91842a9271c207 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'main')
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java20
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java4
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java18
-rw-r--r--main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.v2.yaml4
-rw-r--r--main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.v2.yaml4
5 files changed, 25 insertions, 25 deletions
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
index 351f2eb2..78a52872 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
@@ -92,13 +92,13 @@ public class TestApiRestServer {
private static final String OP_POLICY_NAME_VCPE = "operational.restart";
private static final String POLICYTYPES = "policytypes";
- private static final String POLICYTYPES_TCA = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app";
+ private static final String POLICYTYPES_TCA = "policytypes/onap.policies.monitoring.tcagen2";
private static final String POLICYTYPES_COLLECTOR =
"policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server";
private static final String POLICYTYPES_TCA_VERSION =
- "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0";
+ "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0";
private static final String POLICYTYPES_TCA_LATEST =
- "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/latest";
+ "policytypes/onap.policies.monitoring.tcagen2/versions/latest";
private static final String POLICYTYPES_COLLECTOR_VERSION =
"policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/1.0.0";
private static final String POLICYTYPES_COLLECTOR_LATEST =
@@ -111,13 +111,13 @@ public class TestApiRestServer {
private static final String POLICYTYPES_NAMING_VERSION = POLICYTYPES + "/onap.policies.Naming/versions/1.0.0";
private static final String POLICYTYPES_TCA_POLICIES =
- "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies";
+ "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies";
private static final String POLICYTYPES_TCA_POLICIES_VCPE =
- "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca";
+ "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca";
private static final String POLICYTYPES_TCA_POLICIES_VCPE_VERSION1 = "policytypes/"
- + "onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0";
+ + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0";
private static final String POLICYTYPES_TCA_POLICIES_VCPE_LATEST = "policytypes/"
- + "onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/latest";
+ + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/latest";
private static final String POLICYTYPES_DROOLS_POLICIES_VCPE_VERSION =
POLICYTYPES_DROOLS_VERSION + "/policies/" + OP_POLICY_NAME_VCPE + "/versions/1.0.0";
@@ -138,7 +138,7 @@ public class TestApiRestServer {
"policytypes/onap.policies.controlloop.operational.Common.yaml";
private static final String[] TOSCA_POLICYTYPE_RESOURCE_NAMES = {
- "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml",
+ "policytypes/onap.policies.monitoring.tcagen2.yaml",
"policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml",
"policytypes/onap.policies.controlloop.operational.common.Drools.yaml",
"policytypes/onap.policies.controlloop.guard.Common.yaml",
@@ -277,7 +277,7 @@ public class TestApiRestServer {
String toscaPolicy = ResourceUtils
.getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
- toscaPolicy = toscaPolicy.replaceAll("onap.policies.monitoring.cdap.tca.hi.lo.app", "IDontExist");
+ toscaPolicy = toscaPolicy.replaceAll("onap.policies.monitoring.tcagen2", "IDontExist");
TextFileUtils.putStringAsTextFile(toscaPolicy, "src/test/resources/policies/BadTestPolicy.yaml");
Response rawResponse2 = createResource(POLICYTYPES_TCA_POLICIES,
@@ -301,7 +301,7 @@ public class TestApiRestServer {
String toscaPolicy = ResourceUtils
.getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
- toscaPolicy = toscaPolicy.replaceAll("onap.policies.monitoring.cdap.tca.hi.lo.app", "IDontExist");
+ toscaPolicy = toscaPolicy.replaceAll("onap.policies.monitoring.tcagen2", "IDontExist");
toscaPolicy = toscaPolicy.replaceAll("onap.restart.tca", "onap.restart.tca.IDontExist");
TextFileUtils.putStringAsTextFile(toscaPolicy, "src/test/resources/policies/BadTestPolicy.yaml");
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
index aba6e55f..6e742c9b 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
@@ -74,7 +74,7 @@ public class TestPolicyProvider {
private static StandardYamlCoder standardYamlCoder;
private static final String POLICY_RESOURCE = "policies/vCPE.policy.monitoring.input.tosca.json";
- private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml";
+ private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.tcagen2.yaml";
private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_ID = "policies/vCPE.policy.bad.policytypeid.json";
private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_VERSION =
"policies/vCPE.policy.bad.policytypeversion.json";
@@ -366,7 +366,7 @@ public class TestPolicyProvider {
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"),
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml"),
ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
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 73daf95e..17d2cb94 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
@@ -60,10 +60,10 @@ public class TestPolicyTypeProvider {
private static final String POLICY_RESOURCE_MONITORING = "policies/vCPE.policy.monitoring.input.tosca.yaml";
private static final String POLICY_TYPE_RESOURCE_MONITORING =
- "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml";
+ "policytypes/onap.policies.monitoring.tcagen2.yaml";
private static final String POLICY_TYPE_RESOURCE_WITH_NO_VERSION =
"policytypes/onap.policies.optimization.Resource.no.version.yaml";
- private static final String POLICY_TYPE_NAME_MONITORING = "onap.policies.monitoring.cdap.tca.hi.lo.app";
+ private static final String POLICY_TYPE_NAME_MONITORING = "onap.policies.monitoring.tcagen2";
public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON =
"policytypes/onap.policies.controlloop.operational.Common.yaml";
@@ -146,7 +146,7 @@ public class TestPolicyTypeProvider {
}).doesNotThrowAnyException();
ToscaPolicyType policyType =
- policyTypeServiceTemplate.getPolicyTypes().get("onap.policies.monitoring.cdap.tca.hi.lo.app");
+ policyTypeServiceTemplate.getPolicyTypes().get("onap.policies.monitoring.tcagen2");
policyType.setDescription("Some other description");
assertThatThrownBy(() -> {
@@ -204,21 +204,21 @@ public class TestPolicyTypeProvider {
.decode(ResourceUtils.getResourceAsString(POLICY_RESOURCE_MONITORING), ToscaServiceTemplate.class);
policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
- String exceptionMessage = "policy type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 is in use, "
+ String exceptionMessage = "policy type onap.policies.monitoring.tcagen2:1.0.0 is in use, "
+ "it is referenced in policy onap.restart.tca:1.0.0";
assertThatThrownBy(() -> {
- policyTypeProvider.deletePolicyType("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0");
+ policyTypeProvider.deletePolicyType("onap.policies.monitoring.tcagen2", "1.0.0");
}).hasMessage(exceptionMessage);
- serviceTemplate = policyProvider.deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
+ serviceTemplate = policyProvider.deletePolicy("onap.policies.monitoring.tcagen2", "1.0.0",
"onap.restart.tca", "1.0.0");
assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
- serviceTemplate = policyTypeProvider.deletePolicyType("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0");
+ serviceTemplate = policyTypeProvider.deletePolicyType("onap.policies.monitoring.tcagen2", "1.0.0");
assertFalse(serviceTemplate.getPolicyTypes().isEmpty());
assertThatThrownBy(() -> {
- policyTypeProvider.deletePolicyType("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0");
- }).hasMessage("policy type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 not found");
+ policyTypeProvider.deletePolicyType("onap.policies.monitoring.tcagen2", "1.0.0");
+ }).hasMessage("policy type onap.policies.monitoring.tcagen2:1.0.0 not found");
}
}
diff --git a/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.v2.yaml b/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.v2.yaml
index 03ad85f7..f7bd691d 100644
--- a/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.v2.yaml
+++ b/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.v2.yaml
@@ -2,13 +2,13 @@ tosca_definitions_version: tosca_simple_yaml_1_1_0
topology_template:
policies:
- onap.scaleout.tca:
- type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ type: onap.policies.monitoring.tcagen2
type_version: 1.0.0
version: 2.0.0
metadata:
policy-id: onap.scaleout.tca
properties:
- tca_policy:
+ tca.policy:
domain: measurementsForVfScaling
metricsPerEventName:
- eventName: vLoadBalancer
diff --git a/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.v2.yaml b/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.v2.yaml
index 780b4321..bd543fce 100644
--- a/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.v2.yaml
+++ b/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.v2.yaml
@@ -3,12 +3,12 @@ topology_template:
policies:
-
onap.vfirewall.tca:
- type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ type: onap.policies.monitoring.tcagen2
version: 2.0.0
metadata:
policy-id: onap.vfirewall.tca
properties:
- tca_policy:
+ tca.policy:
domain: measurementsForVfScaling
metricsPerEventName:
-