summaryrefslogtreecommitdiffstats
path: root/models-pdp
diff options
context:
space:
mode:
Diffstat (limited to 'models-pdp')
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java14
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java15
2 files changed, 14 insertions, 15 deletions
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 0c088b87e..19f79ee88 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
@@ -52,14 +52,6 @@ public class PdpUpdate extends PdpMessage {
private Long pdpHeartbeatIntervalMs;
/**
- * Policies that the PDP should deploy. This is a complete list, so PDPs should be
- * prepared to deploy new policies listed and undeploy policies that are no longer
- * listed. Note: this list may be empty, as a PDP may remain attached to a subgroup
- * even if all of the policies are removed from the subgroup.
- */
- private List<ToscaPolicy> policies = new LinkedList<>();
-
- /**
* Policies that the PDP should deploy.
*/
private List<ToscaPolicy> policiesToBeDeployed = new LinkedList<>();
@@ -87,7 +79,9 @@ public class PdpUpdate extends PdpMessage {
this.description = source.description;
this.pdpHeartbeatIntervalMs = source.pdpHeartbeatIntervalMs;
- this.policies = (source.policies == null ? null
- : source.policies.stream().map(ToscaPolicy::new).collect(Collectors.toList()));
+ this.policiesToBeDeployed = (source.policiesToBeDeployed == null ? null
+ : source.policiesToBeDeployed.stream().map(ToscaPolicy::new).collect(Collectors.toList()));
+ this.policiesToBeUndeployed = (source.policiesToBeUndeployed == null ? null
+ : source.policiesToBeUndeployed.stream().map(ToscaConceptIdentifier::new).collect(Collectors.toList()));
}
}
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
index c37979f81..a24b410ae 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpUpdateTest.java
@@ -3,7 +3,7 @@
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import static org.onap.policy.models.pdp.concepts.PdpMessageUtils.removeVariable
import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collectors;
import org.junit.Test;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
@@ -41,7 +42,8 @@ public class PdpUpdateTest {
assertThatThrownBy(() -> new PdpUpdate(null)).isInstanceOf(NullPointerException.class);
PdpUpdate orig = new PdpUpdate();
- orig.setPolicies(null);
+ orig.setPoliciesToBeDeployed(null);
+ orig.setPoliciesToBeUndeployed(null);
// verify with null values
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(new PdpUpdate(orig).toString()));
@@ -62,14 +64,17 @@ public class PdpUpdateTest {
policy2.setVersion("4.5.6");
List<ToscaPolicy> policies = Arrays.asList(policy1, policy2);
- orig.setPolicies(policies);
+ orig.setPoliciesToBeDeployed(policies);
+ orig.setPoliciesToBeUndeployed(policies.stream().map(ToscaPolicy::getIdentifier).collect(Collectors.toList()));
PdpUpdate other = new PdpUpdate(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
// ensure list and items are not the same object
- assertNotSame(other.getPolicies(), policies);
- assertNotSame(other.getPolicies().get(0), policies.get(0));
+ assertNotSame(other.getPoliciesToBeDeployed(), policies);
+ assertNotSame(other.getPoliciesToBeDeployed().get(0), policies.get(0));
+ assertNotSame(other.getPoliciesToBeUndeployed(), policies);
+ assertNotSame(other.getPoliciesToBeUndeployed().get(0), policies.get(0));
}
}