aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-04-01 12:23:51 -0400
committerJim Hahn <jrh3@att.com>2019-04-01 12:23:51 -0400
commit65b465c2791d17589719fda2e1341ec75aac8af7 (patch)
tree9378cf9f5c6947ef17775a5c7a762dfe4ccb3b56
parent5eacd4c059625788887dd49672f739485aa32cf2 (diff)
Fix breakage from ToscaPolicy refactoring
A few tests in models-pdp broken when ToscaPolicy was moved and refactored. Change-Id: If8e17a140ebc4f8f83b1f5c7cb32a542dd6e5390 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java19
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java1
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java2
3 files changed, 13 insertions, 9 deletions
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java
index 44204e514..5f8819b48 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpUpdate.java
@@ -28,8 +28,7 @@ import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
/**
* Test the copy constructor, as {@link TestModels} tests the other methods.
@@ -54,20 +53,24 @@ public class TestPdpUpdate {
orig.setPdpType("my-type");
ToscaPolicy policy1 = new ToscaPolicy();
- policy1.setKey(new PfConceptKey("policy-a", "1.2.3"));
+ policy1.setName("policy-a");
+ policy1.setVersion("1.2.3");
ToscaPolicy policy2 = new ToscaPolicy();
- policy2.setKey(new PfConceptKey("policy-b", "4.5.6"));
+ policy2.setName("policy-b");
+ policy2.setVersion("4.5.6");
List<ToscaPolicy> policies = Arrays.asList(policy1, policy2);
orig.setPolicies(policies);
PdpUpdate other = new PdpUpdate(orig);
- assertEquals("PdpUpdate(name=my-name, pdpType=my-type, description=my-description, pdpGroup=my-group, "
- + "pdpSubgroup=my-subgroup, policies=["
- + "ToscaPolicy(type=PfConceptKey(name=NULL, version=0.0.0), properties=null, targets=null), "
- + "ToscaPolicy(type=PfConceptKey(name=NULL, version=0.0.0), properties=null, targets=null)])",
+ assertEquals("PdpUpdate(name=my-name, pdpType=my-type, description=my-description, "
+ + "pdpGroup=my-group, pdpSubgroup=my-subgroup, policies=["
+ + "ToscaPolicy(super=ToscaEntity(name=policy-a, version=1.2.3, derivedFrom=null, "
+ + "metadata=null, description=null), type=null, typeVersion=null, properties=null), "
+ + "ToscaPolicy(super=ToscaEntity(name=policy-b, version=4.5.6, derivedFrom=null, "
+ + "metadata=null, description=null), type=null, typeVersion=null, properties=null)])",
other.toString());
// ensure list and items are not the same object
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java
index 87d0d9a75..a61f2a781 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java
@@ -62,6 +62,7 @@ public class ToscaEntity implements PfNameVersion {
this.name = copyObject.name;
this.version = copyObject.version;
this.derivedFrom = copyObject.derivedFrom;
+ this.description = copyObject.description;
if (copyObject.metadata != null) {
metadata = new LinkedHashMap<>();
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
index 9bd84e8eb..38c68599d 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
@@ -41,7 +41,7 @@ import lombok.ToString;
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
-@ToString
+@ToString(callSuper = true)
public class ToscaPolicy extends ToscaEntity {
private String type;