aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src/test
diff options
context:
space:
mode:
authorChenfei Gao <cgao@research.att.com>2019-06-07 11:14:16 -0400
committerChenfei Gao <cgao@research.att.com>2019-06-07 15:15:04 -0400
commit94a863e0a9b5f65b804cf26936c67ee815e49850 (patch)
treeea9029ead577f59e9b03f16799aa774a99be11e2 /models-tosca/src/test
parent8676a38be6877235fe857a5f0bc289b2e036d4bb (diff)
Fix version field to represent policy version instead of type version
Added changes to make version field in return of GET guard policy call represent the version of guard policy instead of its type version. Issue-ID: POLICY-1809 Change-Id: Ie8db6e89d8439576ee5f6ee99c3222386775b195 Signed-off-by: Chenfei Gao <cgao@research.att.com>
Diffstat (limited to 'models-tosca/src/test')
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java
index f2fb53d60..6d32c6d0b 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapperTest.java
@@ -21,11 +21,13 @@
package org.onap.policy.models.tosca.legacy.mapping;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
import java.util.LinkedHashMap;
-
+import java.util.Map;
import org.junit.Test;
import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
@@ -44,7 +46,7 @@ public class LegacyGuardPolicyMapperTest {
serviceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
serviceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
- JpaToscaPolicy policy = new JpaToscaPolicy(new PfConceptKey("PolicyName", "0.0.1"));
+ JpaToscaPolicy policy = new JpaToscaPolicy(new PfConceptKey("PolicyName", "2.0.0"));
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(policy.getKey(), policy);
assertThatThrownBy(() -> {
@@ -55,5 +57,11 @@ public class LegacyGuardPolicyMapperTest {
assertThatThrownBy(() -> {
new LegacyGuardPolicyMapper().fromToscaServiceTemplate(serviceTemplate);
}).hasMessageContaining("no properties defined on TOSCA policy");
+
+ policy.setProperties(new LinkedHashMap<>());
+ Map<String, LegacyGuardPolicyOutput> guardPolicyMap =
+ new LegacyGuardPolicyMapper().fromToscaServiceTemplate(serviceTemplate);
+ LegacyGuardPolicyOutput guardPolicy = guardPolicyMap.values().iterator().next();
+ assertEquals("2.0.0", guardPolicy.getVersion());
}
}