From 451b2fd1dc8c42f026f208310dcf6b7069b2e740 Mon Sep 17 00:00:00 2001 From: Supun94 Date: Thu, 10 Nov 2016 12:34:44 +0530 Subject: [PATCH] Minor refactoring on policy evaluation --- .../mgt/core/internal/PolicyManagementDataHolder.java | 2 +- .../mgt/core/internal/PolicyManagementServiceComponent.java | 2 +- .../carbon/policy/mgt/core/PolicyEvaluationTestCase.java | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementDataHolder.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementDataHolder.java index 5809468694..a85928b063 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementDataHolder.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementDataHolder.java @@ -97,7 +97,7 @@ public class PolicyManagementDataHolder { return policyEvaluationPoints.get(policyEvaluationPointName); } - public void putPolicyEvaluationPoint(String name, PolicyEvaluationPoint policyEvaluationPoint) { + public void setPolicyEvaluationPoint(String name, PolicyEvaluationPoint policyEvaluationPoint) { policyEvaluationPoints.put(name,policyEvaluationPoint); } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementServiceComponent.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementServiceComponent.java index 427109e1d0..0d8b41a64c 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementServiceComponent.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyManagementServiceComponent.java @@ -159,7 +159,7 @@ public class PolicyManagementServiceComponent { if (log.isDebugEnabled()) { log.debug("Setting Policy Information Service"); } - PolicyManagementDataHolder.getInstance().putPolicyEvaluationPoint(pepService.getName(), pepService); + PolicyManagementDataHolder.getInstance().setPolicyEvaluationPoint(pepService.getName(), pepService); } protected void unsetPEPService(PolicyEvaluationPoint pepService) { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java index 821526f2a5..e97030301d 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java @@ -27,14 +27,10 @@ import org.testng.annotations.Test; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; -import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; -import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.policy.mgt.common.*; -import org.wso2.carbon.policy.mgt.core.enforcement.DelegationTask; import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import org.wso2.carbon.policy.mgt.core.services.SimplePolicyEvaluationTest; @@ -51,7 +47,7 @@ public class PolicyEvaluationTestCase extends BasePolicyManagementDAOTest { @Override public void init() throws Exception { PolicyEvaluationPoint evaluationPoint = new SimplePolicyEvaluationTest(); - PolicyManagementDataHolder.getInstance().putPolicyEvaluationPoint(evaluationPoint.getName(), evaluationPoint); + PolicyManagementDataHolder.getInstance().setPolicyEvaluationPoint(evaluationPoint.getName(), evaluationPoint); } @Test