summaryrefslogtreecommitdiffstats
path: root/applications/monitoring/src/test
diff options
context:
space:
mode:
authorMichael Mokry <michael.mokry@att.com>2019-04-11 12:19:50 -0500
committerMichael Mokry <michael.mokry@att.com>2019-04-11 17:15:07 -0500
commit432cec9fa6f143dad324cd11f62fb052c7da32b7 (patch)
tree3d7d5bb4f1e7ada0e8ca3255e03149800a1b4b00 /applications/monitoring/src/test
parent4013653daa38a7fe1b9ffcae02e27d0bc411ac8f (diff)
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 <michael.mokry@att.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/monitoring/src/test')
-rw-r--r--applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java20
1 files changed, 19 insertions, 1 deletions
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<ToscaPolicy> 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