summaryrefslogtreecommitdiffstats
path: root/controlloop/common/guard/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-08-13 15:52:22 -0400
committerJim Hahn <jrh3@att.com>2019-08-15 09:21:28 -0400
commitfdaae76549bafb2e482c02fb26de719c69431b48 (patch)
treea3f477da55f80fe7e4bed3d959d8089cf1971438 /controlloop/common/guard/src/main
parent9e8023a455633c7daf0dd291c6268986e39352d7 (diff)
Modify to work with new drools-pdp
Due to sonar fixes, drools-pdp changed in a way that requires changes to drools-applications. In the case of template.demo, lots of test cases had to be modified, so they were refactored to extract common setup and tear down code. Fixed checkstyle issues. Fixed license date. Change-Id: Ie9e0239b95916ae7ef8c1b669987f7bb07d841b9 Issue-ID: POLICY-1968 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/guard/src/main')
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java2
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java9
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java13
3 files changed, 11 insertions, 13 deletions
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
index 22fce1999..611dd2d8b 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java
@@ -66,7 +66,7 @@ public class CallGuardTask implements Runnable {
private PolicyGuardResponse guardResponse;
/**
- * Guard url is grabbed from PolicyEngine.manager properties
+ * Guard url is grabbed from PolicyEngine manager properties.
*/
public CallGuardTask(WorkingMemory wm, String cl, String act,
String rec, String tar, String reqId, Supplier<Integer> vfcnt) {
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
index 53f1cea4b..ed6cd6c5f 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
@@ -24,13 +24,12 @@ package org.onap.policy.guard;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.drools.system.PolicyEngine;
+import org.onap.policy.drools.system.PolicyEngineConstants;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.rest.RestManager;
@@ -50,9 +49,9 @@ public class PolicyGuardXacmlHelper {
* Constructor.
*/
public PolicyGuardXacmlHelper() {
- this.url = PolicyEngine.manager.getEnvironmentProperty("guard.url");
- this.user = PolicyEngine.manager.getEnvironmentProperty("pdpx.username");
- this.pwd = PolicyEngine.manager.getEnvironmentProperty("pdpx.password");
+ this.url = PolicyEngineConstants.getManager().getEnvironmentProperty("guard.url");
+ this.user = PolicyEngineConstants.getManager().getEnvironmentProperty("pdpx.username");
+ this.pwd = PolicyEngineConstants.getManager().getEnvironmentProperty("pdpx.password");
}
/**
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
index d859fbe09..717ca3f45 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
@@ -25,11 +25,10 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
-
import org.apache.commons.io.IOUtils;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.guard.ControlLoopGuard;
-import org.onap.policy.drools.system.PolicyEngine;
+import org.onap.policy.drools.system.PolicyEngineConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
@@ -135,16 +134,16 @@ public final class Util {
* <p>see /guard/src/test/java/org/onap/policy/guard/UtilTest.java for setting test properties
*/
public static void setGuardEnvProps(String url, String username, String password) {
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.PROP_GUARD_URL, url);
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.PROP_GUARD_USER, username);
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.PROP_GUARD_PASS, password);
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.PROP_GUARD_URL, url);
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.PROP_GUARD_USER, username);
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.PROP_GUARD_PASS, password);
}
public static void setGuardEnvProp(String key, String value) {
- PolicyEngine.manager.setEnvironmentProperty(key, value);
+ PolicyEngineConstants.getManager().setEnvironmentProperty(key, value);
}
public static String getGuardProp(String propName) {
- return PolicyEngine.manager.getEnvironmentProperty(propName);
+ return PolicyEngineConstants.getManager().getEnvironmentProperty(propName);
}
}