aboutsummaryrefslogtreecommitdiffstats
path: root/models-pap
diff options
context:
space:
mode:
Diffstat (limited to 'models-pap')
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpDeployPolicies.java (renamed from models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPolicy.java)34
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroup.java24
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpInstanceDetails.java20
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpPolicies.java1
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpSubGroup.java26
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/Policy.java21
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyIdent.java36
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyIdentOptVersion.java (renamed from models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpInstanceDetails.java)38
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyTypeIdent.java38
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpGroup.java66
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpSubGroup.java75
11 files changed, 100 insertions, 279 deletions
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPolicy.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpDeployPolicies.java
index 6a042d3be..1f4339f15 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPolicy.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpDeployPolicies.java
@@ -20,30 +20,20 @@
package org.onap.policy.models.pap.concepts;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
+import java.util.List;
-import org.junit.Test;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
/**
- * Test the copy constructor, as {@link TestModels} tests the other methods.
+ * Request deploy or update a set of policies using the <i>simple</i> PDP Group deployment
+ * REST API. Only the "name" and "policyVersion" fields of a Policy are used, and only the
+ * "name" field is actually required.
*/
-public class TestPolicy {
-
- @Test
- public void testCopyConstructor() {
- assertThatThrownBy(() -> new Policy(null)).isInstanceOf(NullPointerException.class);
-
- Policy orig = new Policy();
-
- // verify with null values
- assertEquals(orig.toString(), new Policy(orig).toString());
-
- // verify with all values
- orig.setName("my-name");
- orig.setPolicyType("my-type");
- orig.setPolicyTypeImpl("my-impl");
- orig.setPolicyTypeVersion("my-type-vers");
- assertEquals(orig.toString(), new Policy(orig).toString());
- }
+@Getter
+@Setter
+@ToString
+public class PdpDeployPolicies {
+ private List<PolicyIdentOptVersion> policies;
}
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroup.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroup.java
index d5e4191a2..29c4713db 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroup.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroup.java
@@ -21,14 +21,11 @@
package org.onap.policy.models.pap.concepts;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
-import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.pdp.enums.PdpState;
/**
@@ -47,25 +44,4 @@ public class PdpGroup {
private String description;
private Map<String, String> properties;
private List<PdpSubGroup> pdpSubgroups;
-
- /**
- * Constructs the object.
- */
- public PdpGroup() {
- super();
- }
-
- /**
- * Constructs the object, making a deep copy from the source.
- *
- * @param source source from which to copy fields
- */
- public PdpGroup(@NonNull PdpGroup source) {
- this.name = source.name;
- this.version = source.version;
- this.pdpGroupState = source.pdpGroupState;
- this.description = source.description;
- this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
- this.pdpSubgroups = PfUtils.mapList(source.pdpSubgroups, PdpSubGroup::new);
- }
}
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpInstanceDetails.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpInstanceDetails.java
index c214c7409..d5846160c 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpInstanceDetails.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpInstanceDetails.java
@@ -22,7 +22,6 @@
package org.onap.policy.models.pap.concepts;
import lombok.Getter;
-import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
@@ -42,23 +41,4 @@ public class PdpInstanceDetails {
private PdpState pdpState;
private PdpHealthStatus healthy;
private String message;
-
- /**
- * Constructs the object.
- */
- public PdpInstanceDetails() {
- super();
- }
-
- /**
- * Constructs the object, making a deep copy from the source.
- *
- * @param source source from which to copy fields
- */
- public PdpInstanceDetails(@NonNull PdpInstanceDetails source) {
- this.instanceId = source.instanceId;
- this.pdpState = source.pdpState;
- this.healthy = source.healthy;
- this.message = source.message;
- }
}
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpPolicies.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpPolicies.java
index e5ae24d0f..3111becca 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpPolicies.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpPolicies.java
@@ -26,6 +26,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
+// TODO delete this once PAP has been modified to use PdpDeployPolicies
/**
* Request deploy or update a set of policies using the <i>simple</i> PDP Group deployment
* REST API. Only the "name" and "policyVersion" fields of a Policy are used, and only the
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpSubGroup.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpSubGroup.java
index 43356982e..9989d2516 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpSubGroup.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpSubGroup.java
@@ -21,15 +21,11 @@
package org.onap.policy.models.pap.concepts;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
-import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.keys.PolicyTypeIdent;
/**
* Class to represent a group of all PDP's of the same pdp type running for a particular
@@ -49,26 +45,4 @@ public class PdpSubGroup {
private int desiredInstanceCount;
private Map<String, String> properties;
private List<PdpInstanceDetails> pdpInstances;
-
- /**
- * Constructs the object.
- */
- public PdpSubGroup() {
- super();
- }
-
- /**
- * Constructs the object, making a deep copy from the source.
- *
- * @param source source from which to copy fields
- */
- public PdpSubGroup(@NonNull PdpSubGroup source) {
- this.pdpType = source.pdpType;
- this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, PolicyTypeIdent::new);
- this.policies = PfUtils.mapList(source.policies, Policy::new);
- 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);
- }
}
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/Policy.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/Policy.java
index b83510e83..541eb2435 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/Policy.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/Policy.java
@@ -22,7 +22,6 @@
package org.onap.policy.models.pap.concepts;
import lombok.Getter;
-import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
@@ -41,24 +40,4 @@ public class Policy {
private String policyType;
private String policyTypeVersion;
private String policyTypeImpl;
-
- /**
- * Constructs the object.
- */
- public Policy() {
- super();
- }
-
- /**
- * Constructs the object, making a deep copy from the source.
- *
- * @param source source from which to copy fields
- */
- public Policy(@NonNull Policy source) {
- this.name = source.name;
- this.policyVersion = source.policyVersion;
- this.policyType = source.policyType;
- this.policyTypeVersion = source.policyTypeVersion;
- this.policyTypeImpl = source.policyTypeImpl;
- }
}
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyIdent.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyIdent.java
new file mode 100644
index 000000000..2eb9df136
--- /dev/null
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyIdent.java
@@ -0,0 +1,36 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Models
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.pap.concepts;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * Identifies a policy. Both the name and version must be non-null.
+ */
+@Getter
+@Setter
+@ToString
+public class PolicyIdent {
+ private String name;
+ private String version;
+}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpInstanceDetails.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyIdentOptVersion.java
index 65fbef612..ecac2a27e 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpInstanceDetails.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyIdentOptVersion.java
@@ -20,32 +20,20 @@
package org.onap.policy.models.pap.concepts;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.onap.policy.models.pdp.enums.PdpHealthStatus;
-import org.onap.policy.models.pdp.enums.PdpState;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.Setter;
+import lombok.ToString;
/**
- * Test the copy constructor, as {@link TestModels} tests the other methods.
+ * Policy identifier with an optional version; only the "name" is required.
*/
-public class TestPdpInstanceDetails {
-
- @Test
- public void testCopyConstructor() {
- assertThatThrownBy(() -> new PdpInstanceDetails(null)).isInstanceOf(NullPointerException.class);
-
- PdpInstanceDetails orig = new PdpInstanceDetails();
-
- // verify with null values
- assertEquals(orig.toString(), new PdpInstanceDetails(orig).toString());
-
- // verify with all values
- orig.setHealthy(PdpHealthStatus.TEST_IN_PROGRESS);
- orig.setInstanceId("my-id");
- orig.setMessage("my-message");
- orig.setPdpState(PdpState.SAFE);
- assertEquals(orig.toString(), new PdpInstanceDetails(orig).toString());
- }
+@Getter
+@Setter
+@ToString
+public class PolicyIdentOptVersion {
+ @NonNull
+ private String name;
+
+ private String version;
}
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyTypeIdent.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyTypeIdent.java
new file mode 100644
index 000000000..3d466b7f5
--- /dev/null
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyTypeIdent.java
@@ -0,0 +1,38 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Models
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.pap.concepts;
+
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * Identifies a policy type. Both the name and version must be non-null.
+ */
+@Getter
+@Setter
+@ToString
+@NonNull
+public class PolicyTypeIdent {
+ private String name;
+ private String version;
+}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpGroup.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpGroup.java
deleted file mode 100644
index ee52d82fb..000000000
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpGroup.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP Policy Models
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.pap.concepts;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.TreeMap;
-import org.junit.Test;
-import org.onap.policy.models.pdp.enums.PdpState;
-
-/**
- * Test the copy constructor, as {@link TestModels} tests the other methods.
- */
-public class TestPdpGroup {
-
- @Test
- public void testCopyConstructor() {
- assertThatThrownBy(() -> new PdpGroup(null)).isInstanceOf(NullPointerException.class);
-
- PdpGroup orig = new PdpGroup();
-
- // verify with null values
- assertEquals(orig.toString(), new PdpGroup(orig).toString());
-
- // verify with all values
- orig.setDescription("my-descript");
- orig.setName("my-name");
- orig.setPdpGroupState(PdpState.SAFE);
-
- PdpSubGroup sub1 = new PdpSubGroup();
- sub1.setCurrentInstanceCount(10);
- PdpSubGroup sub2 = new PdpSubGroup();
- sub2.setCurrentInstanceCount(11);
- orig.setPdpSubgroups(Arrays.asList(sub1, sub2));
-
- Map<String, String> props = new TreeMap<>();
- props.put("key-A", "value-A");
- props.put("key-B", "value-B");
- orig.setProperties(props);
-
- System.out.println("orig=" + orig);
-
- assertEquals(orig.toString(), new PdpGroup(orig).toString());
- }
-}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpSubGroup.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpSubGroup.java
deleted file mode 100644
index 9af2f4e9d..000000000
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpSubGroup.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP Policy Models
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.pap.concepts;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.TreeMap;
-import org.junit.Test;
-import org.onap.policy.models.base.keys.PolicyTypeIdent;
-
-/**
- * Test the copy constructor, as {@link TestModels} tests the other methods.
- */
-public class TestPdpSubGroup {
-
- @Test
- public void testCopyConstructor() {
- assertThatThrownBy(() -> new PdpSubGroup(null)).isInstanceOf(NullPointerException.class);
-
- PdpSubGroup orig = new PdpSubGroup();
-
- // verify with null values
- assertEquals(orig.toString(), new PdpSubGroup(orig).toString());
-
- // verify with all values
- orig.setCurrentInstanceCount(10);
- orig.setDesiredInstanceCount(11);
-
- PdpInstanceDetails inst1 = new PdpInstanceDetails();
- inst1.setInstanceId("my-id-A");
- PdpInstanceDetails inst2 = new PdpInstanceDetails();
- inst2.setInstanceId("my-id-B");
- orig.setPdpInstances(Arrays.asList(inst1, inst2));
-
- orig.setPdpType("my-type");
-
- Policy pol1 = new Policy();
- pol1.setName("policy-A");
- Policy pol2 = new Policy();
- pol2.setName("policy-B");
- orig.setPolicies(Arrays.asList(pol1, pol2));
-
- Map<String, String> props = new TreeMap<>();
- props.put("key-A", "value-A");
- props.put("key-B", "value-B");
- orig.setProperties(props);
-
- PolicyTypeIdent supp1 = new PolicyTypeIdent("supp-A", "1.2");
- PolicyTypeIdent supp2 = new PolicyTypeIdent("supp-B", "3.4");
- orig.setSupportedPolicyTypes(Arrays.asList(supp1, supp2));
-
- assertEquals(orig.toString(), new PdpSubGroup(orig).toString());
- }
-}