diff options
author | liamfallon <liam.fallon@est.tech> | 2019-03-29 10:31:22 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-03-29 10:31:22 +0000 |
commit | cc5b96bfd33cd7d91fe6994d348e8d6a0ebb54fa (patch) | |
tree | 2fee38b739094176421927052b65ce6d9ffd5098 /models-pdp/src/test/java | |
parent | 6ccec5265d3431a1ca3265876b3df7bb422d9b62 (diff) |
Restructure for authorative models
Use authorative models instead of the JPA stored models
as the venacular models in the Policy Framework.
The next step is to pass the authorative objects over the
provider interface rather than the JPA obejcts. This change will
be made in the next review.
Minor changes to pdp objects to remove JPA things from them. These
object will be the authorative in-memory obejcts on the PDP side and
new JPA entity object will be introduced in a future review to persist
them.
Issue-ID: POLICY-1095
Change-Id: I40e7b713903980cb41bb315417111b67a9b17307
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-pdp/src/test/java')
3 files changed, 14 insertions, 10 deletions
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 51bb66c97..cac506acc 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 @@ -43,11 +43,14 @@ public class TestPdpGroup { PdpGroup orig = new PdpGroup(); // verify with null values - assertEquals("PdpGroup(pdpGroupState=null, properties=null, pdpSubgroups=[])", new PdpGroup(orig).toString()); + assertEquals("PdpGroup(name=null, version=null, description=null, pdpGroupState=null, " + + "properties=null, pdpSubgroups=[])", new PdpGroup(orig).toString()); // verify with all values orig.setDescription("my-descript"); - orig.getKey().setName("my-name"); + orig.setName("my-name"); + orig.setVersion("my-version"); + orig.setDescription("my-description"); orig.setPdpGroupState(PdpState.SAFE); PdpSubGroup sub1 = new PdpSubGroup(); @@ -61,7 +64,8 @@ public class TestPdpGroup { props.put("key-B", "value-B"); orig.setProperties(props); - assertEquals("PdpGroup(pdpGroupState=SAFE, properties={key-A=value-A, key-B=value-B}, " + assertEquals("PdpGroup(name=my-name, version=my-version, description=my-description, " + + "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, " diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpInstanceDetails.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpInstanceDetails.java index 2220ae126..79bb52ee8 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpInstanceDetails.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpInstanceDetails.java @@ -34,12 +34,12 @@ public class TestPdpInstanceDetails { @Test public void testCopyConstructor() { - assertThatThrownBy(() -> new PdpInstanceDetails(null)).isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> new Pdp(null)).isInstanceOf(NullPointerException.class); - PdpInstanceDetails orig = new PdpInstanceDetails(); + Pdp orig = new Pdp(); // verify with null values - assertEquals(orig.toString(), new PdpInstanceDetails(orig).toString()); + assertEquals(orig.toString(), new Pdp(orig).toString()); // verify with all values orig.setHealthy(PdpHealthStatus.TEST_IN_PROGRESS); @@ -47,6 +47,6 @@ public class TestPdpInstanceDetails { orig.setMessage("my-message"); orig.setPdpState(PdpState.SAFE); - assertEquals(orig.toString(), new PdpInstanceDetails(orig).toString()); + assertEquals(orig.toString(), new Pdp(orig).toString()); } } 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 bc6363fae..eac2fb5d6 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 @@ -28,7 +28,7 @@ import java.util.Arrays; import java.util.Map; import java.util.TreeMap; import org.junit.Test; -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. @@ -51,9 +51,9 @@ public class TestPdpSubGroup { orig.setCurrentInstanceCount(10); orig.setDesiredInstanceCount(11); - PdpInstanceDetails inst1 = new PdpInstanceDetails(); + Pdp inst1 = new Pdp(); inst1.setInstanceId("my-id-A"); - PdpInstanceDetails inst2 = new PdpInstanceDetails(); + Pdp inst2 = new Pdp(); inst2.setInstanceId("my-id-B"); orig.setPdpInstances(Arrays.asList(inst1, inst2)); |