aboutsummaryrefslogtreecommitdiffstats
path: root/applications/monitoring/src/test/java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-07-03 14:29:37 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-07-03 14:38:18 -0400
commitdc6afa16a2b9fbd19373a1e2ca5859df2782dcb6 (patch)
treec5dd6428ad3abdeb6f4135d096ee5ba1e1adedee /applications/monitoring/src/test/java
parent369435c42225f030a729b23ce0a9f01d288deed3 (diff)
Fix xacml decision policy-type
Wrong attribute id was being used. Added info logging statement to assist in debugging. Added JUnit to support this. Issue-ID: POLICY-1843 Change-Id: I11d83574f91751804a45281d2e0c9cd3150e30eb Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/monitoring/src/test/java')
-rw-r--r--applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java25
1 files changed, 21 insertions, 4 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 04c9d20b..2ad83030 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
@@ -25,14 +25,12 @@ package org.onap.policy.xacml.pdp.application.monitoring;
import static org.assertj.core.api.Assertions.assertThat;
import com.att.research.xacml.api.Response;
-
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.ServiceLoader;
-
import org.apache.commons.lang3.tuple.Pair;
import org.junit.BeforeClass;
import org.junit.ClassRule;
@@ -62,6 +60,7 @@ public class MonitoringPdpApplicationTest {
private static File propertiesFile;
private static XacmlApplicationServiceProvider service;
private static DecisionRequest requestSinglePolicy;
+ private static DecisionRequest requestPolicyType;
private static StandardCoder gson = new StandardCoder();
@@ -82,6 +81,12 @@ public class MonitoringPdpApplicationTest {
TextFileUtils
.getTextFileAsString("../../main/src/test/resources/decisions/decision.single.input.json"),
DecisionRequest.class);
+ // Load Single Decision Request
+ //
+ requestPolicyType = gson.decode(
+ TextFileUtils
+ .getTextFileAsString("../../main/src/test/resources/decisions/decision.policytype.input.json"),
+ DecisionRequest.class);
//
// Setup our temporary folder
//
@@ -164,7 +169,7 @@ public class MonitoringPdpApplicationTest {
// into the PDP.
//
//
- // Now load the optimization policies
+ // Now load the monitoring policies
//
final List<ToscaPolicy> loadedPolicies = TestUtils.loadPolicies("src/test/resources/vDNS.policy.input.yaml",
service);
@@ -180,10 +185,22 @@ public class MonitoringPdpApplicationTest {
// Dump it out as Json
//
LOGGER.info(gson.encode(decision.getKey()));
- LOGGER.info("Now testing unloading of policy");
+ //
+ // Ask for a decision based on policy-type
+ //
+ decision = service.makeDecision(requestPolicyType);
+ LOGGER.info("Decision {}", decision);
+
+ assertThat(decision.getKey()).isNotNull();
+ assertThat(decision.getKey().getPolicies().size()).isEqualTo(1);
+ //
+ // Dump it out as Json
+ //
+ LOGGER.info(gson.encode(decision.getKey()));
//
// Now unload it
//
+ LOGGER.info("Now testing unloading of policy");
for (ToscaPolicy policy : loadedPolicies) {
assertThat(service.unloadPolicy(policy)).isTrue();
}