From cee84a9344f35356f86384b0d48127f5a83e3776 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Tue, 26 Mar 2019 22:31:43 +0000 Subject: Add Legacy Op Policy Persistence Legacy operational policies now fully supported for serialization and persistence from provider through to database and back. Unit test coverage completed also Issue-ID: POLICY-1095 Change-Id: I65755859c94b50edee537d2685f51a7838c6541f Signed-off-by: liamfallon --- .../java/org/onap/policy/models/pdp/concepts/PdpGroup.java | 1 + .../org/onap/policy/models/pdp/concepts/TestPdpGroup.java | 11 ++++++++--- .../org/onap/policy/models/pdp/concepts/TestPdpSubGroup.java | 8 ++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'models-pdp') diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java index bb67a4060..4a26b16dd 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java @@ -24,6 +24,7 @@ package org.onap.policy.models.pdp.concepts; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; + import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpGroup.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpGroup.java index 22c7a71ac..51bb66c97 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpGroup.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpGroup.java @@ -1,8 +1,9 @@ -/* +/*- * ============LICENSE_START======================================================= * ONAP Policy Models * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +43,7 @@ public class TestPdpGroup { PdpGroup orig = new PdpGroup(); // verify with null values - assertEquals(orig.toString(), new PdpGroup(orig).toString()); + assertEquals("PdpGroup(pdpGroupState=null, properties=null, pdpSubgroups=[])", new PdpGroup(orig).toString()); // verify with all values orig.setDescription("my-descript"); @@ -60,7 +61,11 @@ public class TestPdpGroup { props.put("key-B", "value-B"); orig.setProperties(props); - assertEquals(orig.toString(), new PdpGroup(orig).toString()); + assertEquals("PdpGroup(pdpGroupState=SAFE, properties={key-A=value-A, key-B=value-B}, " + + "pdpSubgroups=[PdpSubGroup(pdpType=null, supportedPolicyTypes=[], policies=[], " + + "currentInstanceCount=10, desiredInstanceCount=0, properties=null, pdpInstances=[]), " + + "PdpSubGroup(pdpType=null, supportedPolicyTypes=[], policies=[], currentInstanceCount=11, " + + "desiredInstanceCount=0, properties=null, pdpInstances=[])])", new PdpGroup(orig).toString()); } @Test diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpSubGroup.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpSubGroup.java index 2a20d2f7b..bc6363fae 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpSubGroup.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpSubGroup.java @@ -1,8 +1,9 @@ -/* +/*- * ============LICENSE_START======================================================= * ONAP Policy Models * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +42,10 @@ public class TestPdpSubGroup { PdpSubGroup orig = new PdpSubGroup(); // verify with null values - assertEquals(orig.toString(), new PdpSubGroup(orig).toString()); + assertEquals( + "PdpSubGroup(pdpType=null, supportedPolicyTypes=[], policies=[], " + + "currentInstanceCount=0, desiredInstanceCount=0, properties=null, pdpInstances=[])", + new PdpSubGroup(orig).toString()); // verify with all values orig.setCurrentInstanceCount(10); -- cgit 1.2.3-korg