From 432cec9fa6f143dad324cd11f62fb052c7da32b7 Mon Sep 17 00:00:00 2001 From: Michael Mokry Date: Thu, 11 Apr 2019 12:19:50 -0500 Subject: Changes to handle PDPX deploy/undeploy Added changes to handle incoming udpate for deploying or undeploying the policies by comparing both sets. STill need to add support for removing the policies and getting the deployed ToscaPolicyIdentifiers for PdpStatus response. * PLD - added functionality to unload policies in the applications and * PLD - added map of loaded policies * Mike - made change to address Jim's and Joshua's comments * Mike - Made change to use mapLoadedPolicies to get deployed policies from the applications * Mike - made change to assembly.xml to add support for apps directory. Change-Id: If7d119197171b68b905b7fd0f2b5be6cf6f609e7 Issue-ID: POLICY-1451 Signed-off-by: Michael Mokry Signed-off-by: Pamela Dragosh --- .../monitoring/MonitoringPdpApplicationTest.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'applications/monitoring') diff --git a/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java b/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java index cc11dcf6..9b26df16 100644 --- a/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java +++ b/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java @@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.File; import java.io.IOException; import java.util.Iterator; +import java.util.List; import java.util.Properties; import java.util.ServiceLoader; @@ -41,6 +42,7 @@ import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.TextFileUtils; import org.onap.policy.models.decisions.concepts.DecisionRequest; import org.onap.policy.models.decisions.concepts.DecisionResponse; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; import org.onap.policy.pdp.xacml.application.common.TestUtils; import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException; @@ -161,7 +163,8 @@ public class MonitoringPdpApplicationTest { // // Now load the optimization policies // - TestUtils.loadPolicies("src/test/resources/vDNS.policy.input.yaml", service); + final List loadedPolicies = TestUtils.loadPolicies("src/test/resources/vDNS.policy.input.yaml", + service); // // Ask for a decision // @@ -174,6 +177,21 @@ public class MonitoringPdpApplicationTest { // Dump it out as Json // LOGGER.info(gson.encode(response)); + LOGGER.info("Now testing unloading of policy"); + // + // Now unload it + // + for (ToscaPolicy policy : loadedPolicies) { + assertThat(service.unloadPolicy(policy)).isTrue(); + } + // + // Ask for a decision + // + response = service.makeDecision(requestSinglePolicy); + LOGGER.info("Decision {}", response); + + assertThat(response).isNotNull(); + assertThat(response.getPolicies().size()).isEqualTo(0); } @Test -- cgit 1.2.3-korg