From b0f132227b0d77ea847f40d07f57d9d053c1555e Mon Sep 17 00:00:00 2001 From: "Tej, Tarun" Date: Fri, 22 Sep 2017 00:49:10 -0400 Subject: Additional Junit coverage for PAP REST additional tests for Policy engine PAP project Issue-Id: POLICY-52 Change-Id: I9a23ca758783e8f370c82a56143b53e3c858051c Signed-off-by: Tej, Tarun --- .../org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java | 4 ++-- .../pap/xacml/rest/controller/ClosedLoopDictionaryController.java | 5 +++++ .../pap/xacml/rest/controller/FirewallDictionaryController.java | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'ONAP-PAP-REST/src/main') diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java index eae3e79a9..d870ca86c 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java @@ -63,6 +63,7 @@ import org.onap.policy.xacml.api.XACMLErrorConstants; import org.onap.policy.xacml.std.pip.engines.aaf.AAFEngine; import org.onap.policy.xacml.util.XACMLPolicyScanner; +import com.att.research.xacml.api.XACML3; import com.att.research.xacml.api.pap.PAPException; import com.att.research.xacml.std.IdentifierImpl; @@ -423,7 +424,6 @@ public class DecisionPolicy extends Policy { // Values for AAF Provider are here for XML Creation. ConditionType condition = new ConditionType(); ApplyType decisionApply = new ApplyType(); - String selectedFunction = "boolean-equal"; AttributeValueType value1 = new AttributeValueType(); value1.setDataType(BOOLEAN_DATATYPE); @@ -439,7 +439,7 @@ public class DecisionPolicy extends Policy { innerDecisionApply.setFunctionId(FUNCTION_BOOLEAN_ONE_AND_ONLY); innerDecisionApply.getExpression().add(new ObjectFactory().createAttributeDesignator(value2)); - decisionApply.setFunctionId(dropDownMap.get(selectedFunction)); + decisionApply.setFunctionId(XACML3.ID_FUNCTION_BOOLEAN_EQUAL.stringValue()); decisionApply.getExpression().add(new ObjectFactory().createAttributeValue(value1)); decisionApply.getExpression().add(new ObjectFactory().createApply(innerDecisionApply)); condition.setExpression(new ObjectFactory().createApply(decisionApply)); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java index d142a46f3..675c82549 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java @@ -35,6 +35,7 @@ import org.json.JSONObject; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.pap.xacml.rest.adapters.GridData; +import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl; import org.onap.policy.pap.xacml.rest.util.JsonMessage; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.ClosedLoopD2Services; @@ -1042,6 +1043,10 @@ public class ClosedLoopDictionaryController{ } return null; } + + public static void setCommonClassDao(CommonClassDaoImpl commonClassDaoImpl) { + commonClassDao = commonClassDaoImpl; + } } diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java index 86706d154..3a4d7b71b 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java @@ -103,6 +103,11 @@ public class FirewallDictionaryController { public FirewallDictionaryController(CommonClassDao commonClassDao){ FirewallDictionaryController.commonClassDao = commonClassDao; } + + public static void setCommonClassDao(CommonClassDao clDao){ + commonClassDao = clDao; + } + /* * This is an empty constructor */ -- cgit 1.2.3-korg