summaryrefslogtreecommitdiffstats
path: root/applications/monitoring/src/test
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-04-08 08:47:38 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-04-10 08:39:41 -0400
commite034d785a227815f66138d1f83f49624c402aa97 (patch)
tree38feabe112c00b97bc3deab32c4fb845f63a7b04 /applications/monitoring/src/test
parent5dd6d165a0b3ee88563e5bcabd4c2a7fc42a676b (diff)
Test decision from main entry
Tests a decision upon startup. This also updates the use of ToscaPolicyTypeIdentifier for all the applications. Very basic packaging for applications and their properties. Added cleaning of unused imports to remove sonar issues. Added production persistence.xml file to guard application. Not sure if we need a copy in the application/common resource directory. Issue-ID: POLICY-1440 Change-Id: If96eef5a9e0a7c6cc5461c0bdb6f0cd708cc41bb 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.java17
-rw-r--r--applications/monitoring/src/test/resources/xacml.properties2
2 files changed, 11 insertions, 8 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 4af4bac4..8099ffdd 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
@@ -46,6 +46,8 @@ 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.ToscaPolicyTypeIdentifier;
+import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException;
import org.onap.policy.pdp.xacml.application.common.XacmlApplicationServiceProvider;
import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils;
import org.slf4j.Logger;
@@ -131,11 +133,11 @@ public class MonitoringPdpApplicationTest {
// Ensure it has the supported policy types and
// can support the correct policy types.
//
- assertThat(service.canSupportPolicyType("onap.Monitoring", "1.0.0")).isTrue();
- assertThat(service.canSupportPolicyType("onap.Monitoring", "1.5.0")).isTrue();
- assertThat(service.canSupportPolicyType("onap.policies.monitoring.foobar", "1.0.1")).isTrue();
- assertThat(service.canSupportPolicyType("onap.foobar", "1.0.0")).isFalse();
- assertThat(service.supportedPolicyTypes()).contains("onap.Monitoring");
+ assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier("onap.Monitoring", "1.0.0"))).isTrue();
+ assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier("onap.Monitoring", "1.5.0"))).isTrue();
+ assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
+ "onap.policies.monitoring.foobar", "1.0.1"))).isTrue();
+ assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier("onap.foobar", "1.0.0"))).isFalse();
//
// Ensure it supports decisions
//
@@ -156,7 +158,7 @@ public class MonitoringPdpApplicationTest {
@SuppressWarnings("unchecked")
@Test
- public void test3AddvDnsPolicy() throws IOException, CoderException {
+ public void test3AddvDnsPolicy() throws IOException, CoderException, XacmlApplicationException {
//
// Now load the vDNS Policy - make sure
// the pdp can support it and have it load
@@ -185,8 +187,9 @@ public class MonitoringPdpApplicationTest {
//
assertThat(policyDefinition.containsKey("type")).isTrue();
assertThat(service.canSupportPolicyType(
+ new ToscaPolicyTypeIdentifier(
policyDefinition.get("type").toString(),
- policyDefinition.get("version").toString()))
+ policyDefinition.get("version").toString())))
.isTrue();
}
}
diff --git a/applications/monitoring/src/test/resources/xacml.properties b/applications/monitoring/src/test/resources/xacml.properties
index 56a92d69..36eac3cd 100644
--- a/applications/monitoring/src/test/resources/xacml.properties
+++ b/applications/monitoring/src/test/resources/xacml.properties
@@ -22,5 +22,5 @@ xacml.att.policyFinderFactory=org.onap.policy.pdp.xacml.application.common.OnapP
# Policies to load
#
xacml.rootPolicies=monitoring
-monitoring.file=src/main/resources/RootMonitoringPolicy.xml
+monitoring.file=../../packages/policy-xacmlpdp-tarball/src/main/resources/apps/monitoring/RootMonitoringPolicy.xml