aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSRawPolicyServiceTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSRawPolicyServiceTest.java')
-rw-r--r--ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSRawPolicyServiceTest.java58
1 files changed, 35 insertions, 23 deletions
diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSRawPolicyServiceTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSRawPolicyServiceTest.java
index 8d5312705..b9e9403d4 100644
--- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSRawPolicyServiceTest.java
+++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSRawPolicyServiceTest.java
@@ -20,31 +20,43 @@
package org.onap.policy.pdp.rest.api.services;
import static org.junit.Assert.assertEquals;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
import org.junit.Test;
-import org.onap.policy.api.PolicyException;
import org.onap.policy.api.PolicyParameters;
public class BRMSRawPolicyServiceTest {
- @Test
- public void testRaw() throws PolicyException {
- String systemKey = "xacml.properties";
- String testVal = "testVal";
- PolicyParameters testParams = new PolicyParameters();
-
- // Set the system property temporarily
- String oldProperty = System.getProperty(systemKey);
- System.setProperty(systemKey, "xacml.pdp.properties");
-
- BRMSRawPolicyService service = new BRMSRawPolicyService(testVal, testVal, testParams, testVal);
- assertEquals(service.getValidation(), false);
- assertEquals(service.getMessage(), "PE300 - Data Issue: No Rule Body given");
-
- // Restore the original system property
- if (oldProperty != null) {
- System.setProperty(systemKey, oldProperty);
- }
- else {
- System.clearProperty(systemKey);
- }
- }
+ @Test
+ public void testRaw() throws FileNotFoundException, IOException {
+ Properties prop = new Properties();
+ prop.load(new FileInputStream("src/test/resources/pass.xacml.pdp.properties"));
+ String succeeded = prop.getProperty("xacml.rest.pap.url");
+ List<String> paps = Arrays.asList(succeeded.split(","));
+ PAPServices.setPaps(paps);
+ PAPServices.setJunit(true);
+ prop.clear();
+
+ String systemKey = "xacml.properties";
+ String testVal = "testVal";
+ PolicyParameters testParams = new PolicyParameters();
+
+ // Set the system property temporarily
+ String oldProperty = System.getProperty(systemKey);
+ System.setProperty(systemKey, "xacml.pdp.properties");
+
+ BRMSRawPolicyService service = new BRMSRawPolicyService(testVal, testVal, testParams, testVal);
+ assertEquals(false, service.getValidation());
+ assertEquals("PE300 - Data Issue: No Rule Body given", service.getMessage());
+
+ // Restore the original system property
+ if (oldProperty != null) {
+ System.setProperty(systemKey, oldProperty);
+ } else {
+ System.clearProperty(systemKey);
+ }
+ }
}