aboutsummaryrefslogtreecommitdiffstats
path: root/applications/monitoring/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-07-21 13:50:44 +0000
committerGerrit Code Review <gerrit@onap.org>2021-07-21 13:50:44 +0000
commitf01fce93c17db824d772240b9c68c07d15c6869a (patch)
tree62db091689fefce9b812efaf0b23d01417ec69fd /applications/monitoring/src
parent527c3c8542dfc4d0078213441529ec68eec1372e (diff)
parent24446884306a87a1d22fb8d0b28efbf41201a87c (diff)
Merge "Include returned attributes in Decision"
Diffstat (limited to 'applications/monitoring/src')
-rw-r--r--applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java55
1 files changed, 51 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 d3738d62..7fab09b2 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
@@ -182,6 +182,12 @@ public class MonitoringPdpApplicationTest {
assertThat(decision.getKey()).isNotNull();
assertThat(decision.getKey().getPolicies()).isEmpty();
+ //
+ // Monitoring applications should not have this information returned
+ //
+ assertThat(decision.getKey().getAdvice()).isNull();
+ assertThat(decision.getKey().getObligations()).isNull();
+ assertThat(decision.getKey().getAttributes()).isNull();
}
@SuppressWarnings("unchecked")
@@ -202,10 +208,18 @@ public class MonitoringPdpApplicationTest {
//
Pair<DecisionResponse, Response> decision = service.makeDecision(requestSinglePolicy, null);
LOGGER.info("Decision {}", decision);
-
+ //
+ // Should have one policy returned
+ //
assertThat(decision.getKey()).isNotNull();
assertThat(decision.getKey().getPolicies()).hasSize(1);
//
+ // Monitoring applications should not have this information returned
+ //
+ assertThat(decision.getKey().getAdvice()).isNull();
+ assertThat(decision.getKey().getObligations()).isNull();
+ assertThat(decision.getKey().getAttributes()).isNull();
+ //
// Dump it out as Json
//
LOGGER.info(gson.encode(decision.getKey()));
@@ -214,9 +228,20 @@ public class MonitoringPdpApplicationTest {
//
decision = service.makeDecision(requestPolicyType, null);
LOGGER.info("Decision {}", decision);
-
+ //
+ // Should have one policy returned
+ //
assertThat(decision.getKey()).isNotNull();
assertThat(decision.getKey().getPolicies()).hasSize(1);
+ //
+ // Monitoring applications should not have this information returned
+ //
+ assertThat(decision.getKey().getAdvice()).isNull();
+ assertThat(decision.getKey().getObligations()).isNull();
+ assertThat(decision.getKey().getAttributes()).isNull();
+ //
+ // Validate the full policy is returned
+ //
Map<String, Object> jsonPolicy = (Map<String, Object>) decision.getKey().getPolicies().get("onap.scaleout.tca");
assertThat(jsonPolicy).isNotNull();
assertThat(jsonPolicy.get("properties")).isNotNull();
@@ -231,9 +256,20 @@ public class MonitoringPdpApplicationTest {
requestQueryParams.put("abbrev", new String[] {"true"});
decision = service.makeDecision(requestPolicyType, requestQueryParams);
LOGGER.info("Decision {}", decision);
-
+ //
+ // Should have one policy returned
+ //
assertThat(decision.getKey()).isNotNull();
assertThat(decision.getKey().getPolicies()).hasSize(1);
+ //
+ // Monitoring applications should not have this information returned
+ //
+ assertThat(decision.getKey().getAdvice()).isNull();
+ assertThat(decision.getKey().getObligations()).isNull();
+ assertThat(decision.getKey().getAttributes()).isNull();
+ //
+ // Validate an abbreviated policy is returned
+ //
jsonPolicy = (Map<String, Object>) decision.getKey().getPolicies().get("onap.scaleout.tca");
assertThat(jsonPolicy).isNotNull().doesNotContainKey("properties");
//
@@ -243,9 +279,20 @@ public class MonitoringPdpApplicationTest {
requestQueryParams.put("abbrev", new String[] {"false"});
decision = service.makeDecision(requestPolicyType, requestQueryParams);
LOGGER.info("Decision {}", decision);
-
+ //
+ // Should have one policy returned
+ //
assertThat(decision.getKey()).isNotNull();
assertThat(decision.getKey().getPolicies()).hasSize(1);
+ //
+ // Monitoring applications should not have this information returned
+ //
+ assertThat(decision.getKey().getAdvice()).isNull();
+ assertThat(decision.getKey().getObligations()).isNull();
+ assertThat(decision.getKey().getAttributes()).isNull();
+ //
+ // And should have full policy returned
+ //
jsonPolicy = (Map<String, Object>) decision.getKey().getPolicies().get("onap.scaleout.tca");
assertThat(jsonPolicy).isNotNull();
assertThat(jsonPolicy.get("properties")).isNotNull();