aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2019-03-31 23:17:59 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-31 23:17:59 +0000
commitfbed360c0acdc127fdf56a99401c1aea691ce57e (patch)
tree1b61422a0c4984365ef506ce5661f9e475a2bb8a /models-pdp
parent96585ff6166369ae6c3f5326e56d55114ae6a3e0 (diff)
parentcc5b96bfd33cd7d91fe6994d348e8d6a0ebb54fa (diff)
Merge "Restructure for authorative models"
Diffstat (limited to 'models-pdp')
-rw-r--r--models-pdp/pom.xml2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/Pdp.java (renamed from models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetails.java)4
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java20
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java9
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java2
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java5
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java (renamed from models-pdp/src/main/java/org/onap/policy/models/pdp/provider/PdpProvider.java)2
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpGroup.java10
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpInstanceDetails.java8
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPdpSubGroup.java6
11 files changed, 37 insertions, 33 deletions
diff --git a/models-pdp/pom.xml b/models-pdp/pom.xml
index 1a4685664..3f423b8c1 100644
--- a/models-pdp/pom.xml
+++ b/models-pdp/pom.xml
@@ -28,7 +28,7 @@
<version>2.0.0-SNAPSHOT</version>
</parent>
- <artifactId>models-pdp</artifactId>
+ <artifactId>policy-models-pdp</artifactId>
<name>${project.artifactId}</name>
<description>The models for internal PDP API's.</description>
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetails.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/Pdp.java
index 6cf122e19..1eaa41547 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpInstanceDetails.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/Pdp.java
@@ -38,7 +38,7 @@ import org.onap.policy.models.pdp.enums.PdpState;
@Setter
@ToString
@NoArgsConstructor
-public class PdpInstanceDetails {
+public class Pdp {
@NonNull
private String instanceId;
@@ -54,7 +54,7 @@ public class PdpInstanceDetails {
*
* @param source source from which to copy the fields
*/
- public PdpInstanceDetails(PdpInstanceDetails source) {
+ public Pdp(Pdp source) {
this.instanceId = source.instanceId;
this.pdpState = source.pdpState;
this.healthy = source.healthy;
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 4a26b16dd..c69679416 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
@@ -25,13 +25,10 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import lombok.Getter;
+import lombok.Data;
import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.pdp.enums.PdpState;
-import org.onap.policy.models.tosca.simple.concepts.ToscaEntityType;
/**
* Class to represent a PDPGroup, which groups multiple PDPSubGroup entities together for
@@ -39,13 +36,12 @@ import org.onap.policy.models.tosca.simple.concepts.ToscaEntityType;
*
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
-@Getter
-@Setter
-@ToString
+@Data
@NoArgsConstructor
-public class PdpGroup extends ToscaEntityType {
- private static final long serialVersionUID = 1L;
-
+public class PdpGroup {
+ private String name;
+ private String version;
+ private String description;
private PdpState pdpGroupState;
private Map<String, String> properties;
private List<PdpSubGroup> pdpSubgroups;
@@ -62,7 +58,9 @@ public class PdpGroup extends ToscaEntityType {
* @param source source from which to copy fields
*/
public PdpGroup(PdpGroup source) {
- super(source);
+ this.name = source.name;
+ this.version = source.version;
+ this.description = source.description;
this.pdpGroupState = source.pdpGroupState;
this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
this.pdpSubgroups = PfUtils.mapList(source.pdpSubgroups, PdpSubGroup::new);
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
index 814d35732..eb0758e61 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
@@ -28,7 +28,7 @@ import lombok.ToString;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpMessageType;
import org.onap.policy.models.pdp.enums.PdpState;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
/**
* Class to represent the PDP_STATUS message that all the PDP's will send to PAP.
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
index 0466c6300..b4539ec3e 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
@@ -29,7 +29,7 @@ import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
/**
* Class to represent a group of all PDP's of the same pdp type running for a particular
@@ -41,16 +41,13 @@ import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
@Setter
@ToString
public class PdpSubGroup {
-
- // TODO subclass from ToscaEntityType
-
private String pdpType;
private List<PolicyTypeIdent> supportedPolicyTypes;
private List<ToscaPolicy> policies;
private int currentInstanceCount;
private int desiredInstanceCount;
private Map<String, String> properties;
- private List<PdpInstanceDetails> pdpInstances;
+ private List<Pdp> pdpInstances;
/**
* Constructs the object.
@@ -71,6 +68,6 @@ public class PdpSubGroup {
this.currentInstanceCount = source.currentInstanceCount;
this.desiredInstanceCount = source.desiredInstanceCount;
this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
- this.pdpInstances = PfUtils.mapList(source.pdpInstances, PdpInstanceDetails::new);
+ this.pdpInstances = PfUtils.mapList(source.pdpInstances, Pdp::new);
}
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
index a048cde48..5c99a56f5 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
@@ -27,7 +27,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.onap.policy.models.pdp.enums.PdpMessageType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
/**
* Class to represent the PDP_UPDATE message that PAP will send to a PDP.
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java
index 7d31c3344..e8bbb2c30 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/enums/PdpHealthStatus.java
@@ -42,4 +42,9 @@ public enum PdpHealthStatus {
* PDP is currently under test state and performing tests.
*/
TEST_IN_PROGRESS,
+
+ /**
+ * The health status of the PDP is unknown.
+ */
+ UNKNOWN
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/provider/PdpProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
index 57feba620..fe0576dfe 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/provider/PdpProvider.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.models.pdp.provider;
+package org.onap.policy.models.pdp.persistence.provider;
import lombok.NonNull;
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));