From 3a298be0739c2a8350fff085d1230d13104c3f16 Mon Sep 17 00:00:00 2001 From: Jasintha Date: Wed, 11 Oct 2017 16:22:09 +0530 Subject: [PATCH 1/4] Adding couple of missing testcase in policy service --- .../mgt/core/PolicyManagerServiceImpl.java | 10 ++++-- .../core/PolicyManagerServiceImplTest.java | 33 +++++++++++++++++-- .../services/SimplePolicyEvaluationTest.java | 7 +++- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java index 7b6eb4bb24..628b829a4d 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java @@ -149,8 +149,14 @@ public class PolicyManagerServiceImpl implements PolicyManagerService { deviceIdentifier.getId() + " - " + deviceIdentifier.getType()); } } catch (PolicyEvaluationException e) { - String msg = "Error occurred while getting the effective features from the PEP service " + - deviceIdentifier.getId() + " - " + deviceIdentifier.getType(); + + String msg; + if(deviceIdentifier != null) { + msg = "Error occurred while getting the effective features from the PEP service " + + deviceIdentifier.getId() + " - " + deviceIdentifier.getType(); + }else { + msg = "Null deviceIdentifier object is passed to the method"; + } log.error(msg, e); throw new FeatureManagementException(msg, e); } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java index 75e5bb69b8..5af4a20ab0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java @@ -19,6 +19,7 @@ package org.wso2.carbon.policy.mgt.core; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.mockito.Spy; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -51,6 +52,8 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderServiceImpl; +import org.wso2.carbon.policy.mgt.common.FeatureManagementException; +import org.wso2.carbon.policy.mgt.common.PolicyEvaluationException; import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.enforcement.DelegationTask; @@ -212,6 +215,7 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { policy1.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); policy1 = policyManagerService.addPolicy(policy1); + int policyCount = policyManagerService.getPolicyCount(); Assert.assertEquals(policyCount, 1, "Policy count should be 1"); @@ -232,6 +236,8 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { policyManagerService.getPAP().activatePolicy(policy1.getId()); Policy effectivePolicy = policyManagerService.getEffectivePolicy(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); Assert.assertEquals(effectivePolicy.getPolicyName(), POLICY1, POLICY1 + " was not activated for " + DEVICE1); + + } @Test(dependsOnMethods = "activatePolicy") @@ -326,9 +332,32 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { } @Test(dependsOnMethods = "updatePolicy") - public void deletePolicy() throws PolicyManagementException { + public void deletePolicyById() throws PolicyManagementException { policyManagerService.deletePolicy(policy1.getId()); Policy tempPolicy = policyManagerService.getPAP().getPolicy(policy1.getId()); Assert.assertNull(tempPolicy, "Policy was not deleted successfully"); } -} + + @Test(dependsOnMethods = "updatePolicy") + public void deletePolicyByPolicy() throws PolicyManagementException { + policyManagerService.deletePolicy(policy1); + Policy tempPolicy = policyManagerService.getPAP().getPolicy(policy1.getId()); + Assert.assertNull(tempPolicy, "Policy was not deleted successfully"); + } + + @Test(dependsOnMethods = "applyPolicy") + public void getEffectiveFeatures( ) throws Exception { + List effectiveFeatures = policyManagerService. + getEffectiveFeatures(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); + Assert.assertNotNull(effectiveFeatures); + Assert.assertEquals(POLICY1_FEATURE1_CODE,effectiveFeatures.get(0).getFeatureCode()); + try{ + policyManagerService.getEffectiveFeatures(null); + }catch(FeatureManagementException e){ + Assert.assertTrue(e.getCause()instanceof PolicyEvaluationException); + } + + } + + +} \ No newline at end of file diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java index 0d22f62e49..d8ace70ae2 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java @@ -27,6 +27,7 @@ import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; import org.wso2.carbon.policy.mgt.common.*; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.policy.mgt.core.PolicyManagerServiceImpl; +import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import java.util.Collections; import java.util.List; @@ -76,7 +77,11 @@ SimplePolicyEvaluationTest implements PolicyEvaluationPoint { @Override public List getEffectiveFeatures(DeviceIdentifier deviceIdentifier) throws PolicyEvaluationException { - return null; + if(deviceIdentifier!=null) { + return getEffectivePolicy(deviceIdentifier).getProfile().getProfileFeaturesList(); + }else { + throw new PolicyEvaluationException(); + } } @Override From 7eff68b807adef79bebab029a29ea9e5a52f897f Mon Sep 17 00:00:00 2001 From: Jasintha Date: Wed, 11 Oct 2017 21:04:53 +0530 Subject: [PATCH 2/4] improve some exsiting testcase to increase coverage and new testcase --- .../mgt/core/PolicyManagerServiceImpl.java | 8 ++------ .../mgt/core/PolicyManagerServiceImplTest.java | 16 ++++++++++++++-- .../services/SimplePolicyEvaluationTest.java | 8 +++++--- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java index 628b829a4d..b1fe61ab7e 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java @@ -150,13 +150,9 @@ public class PolicyManagerServiceImpl implements PolicyManagerService { } } catch (PolicyEvaluationException e) { - String msg; - if(deviceIdentifier != null) { - msg = "Error occurred while getting the effective features from the PEP service " + + String msg = "Error occurred while getting the effective features from the PEP service " + deviceIdentifier.getId() + " - " + deviceIdentifier.getType(); - }else { - msg = "Null deviceIdentifier object is passed to the method"; - } + log.error(msg, e); throw new FeatureManagementException(msg, e); } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java index 5af4a20ab0..8f4880ed3e 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java @@ -40,6 +40,7 @@ import org.wso2.carbon.device.mgt.common.policy.mgt.Policy; import org.wso2.carbon.device.mgt.common.policy.mgt.Profile; import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.NonComplianceData; import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; @@ -84,6 +85,8 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { private static final String POLICY1 = "policy1"; private static final String POLICY1_FEATURE1_CODE = "DISALLOW_ADJUST_VOLUME"; private static final String ADMIN_USER = "admin"; + public static final String DEVICE_2 = "device2"; + public static final String DEVICE_TYPE_B = "deviceTypeB"; private DeviceManagementProviderService deviceMgtService; private GroupManagementProviderService groupMgtService; @@ -309,8 +312,11 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { complianceFeatures.add(complianceFeature); policyManagerService.checkCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), complianceFeatures); boolean deviceCompliance = policyManagerService.isCompliant(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); - Assert.assertFalse(deviceCompliance, "Policy was compliant even though the response was not compliant"); + List complianceFeatureList = policyManagerService. + checkPolicyCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), complianceFeatures); + Assert.assertNotNull(complianceFeature); + Assert.assertEquals(POLICY1_FEATURE1_CODE,complianceFeatureList.get(0).getFeatureCode()); } @Test(dependsOnMethods = "inactivatePolicy") @@ -352,12 +358,18 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { Assert.assertNotNull(effectiveFeatures); Assert.assertEquals(POLICY1_FEATURE1_CODE,effectiveFeatures.get(0).getFeatureCode()); try{ - policyManagerService.getEffectiveFeatures(null); + policyManagerService.getEffectiveFeatures(new DeviceIdentifier(DEVICE_2, DEVICE_TYPE_B)); }catch(FeatureManagementException e){ Assert.assertTrue(e.getCause()instanceof PolicyEvaluationException); } } + @Test(dependsOnMethods = "applyPolicy") + public void getDeviceCompliance() throws Exception{ + NonComplianceData deviceCompliance = policyManagerService.getDeviceCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); + Assert.assertNotNull(deviceCompliance); + } + } \ No newline at end of file diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java index d8ace70ae2..b424befe3d 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java @@ -36,6 +36,7 @@ public class SimplePolicyEvaluationTest implements PolicyEvaluationPoint { private static final Log log = LogFactory.getLog(SimplePolicyEvaluationTest.class); + public static final String DEVICE2 = "device2"; // assuming this device does not have valid policy @Override public Policy getEffectivePolicy(DeviceIdentifier deviceIdentifier) throws PolicyEvaluationException { @@ -77,10 +78,11 @@ SimplePolicyEvaluationTest implements PolicyEvaluationPoint { @Override public List getEffectiveFeatures(DeviceIdentifier deviceIdentifier) throws PolicyEvaluationException { - if(deviceIdentifier!=null) { - return getEffectivePolicy(deviceIdentifier).getProfile().getProfileFeaturesList(); - }else { + if(DEVICE2.equals(deviceIdentifier.getId())) { throw new PolicyEvaluationException(); + }else { + return getEffectivePolicy(deviceIdentifier).getProfile().getProfileFeaturesList(); + } } From 8cfbff20492f23ab947d31af4f3a5ee5928dad0c Mon Sep 17 00:00:00 2001 From: Jasintha Date: Thu, 12 Oct 2017 06:11:39 +0530 Subject: [PATCH 3/4] adding new tescases and did code formatting --- .../mgt/core/PolicyManagerServiceImpl.java | 2 - .../core/PolicyManagerServiceImplTest.java | 60 +++++++++++++++++-- .../services/SimplePolicyEvaluationTest.java | 3 - 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java index b1fe61ab7e..11e69580e0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImpl.java @@ -149,10 +149,8 @@ public class PolicyManagerServiceImpl implements PolicyManagerService { deviceIdentifier.getId() + " - " + deviceIdentifier.getType()); } } catch (PolicyEvaluationException e) { - String msg = "Error occurred while getting the effective features from the PEP service " + deviceIdentifier.getId() + " - " + deviceIdentifier.getType(); - log.error(msg, e); throw new FeatureManagementException(msg, e); } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java index 8f4880ed3e..3174a047ff 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java @@ -62,6 +62,7 @@ import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import org.wso2.carbon.policy.mgt.core.mock.TypeADeviceManagementService; import org.wso2.carbon.policy.mgt.core.services.SimplePolicyEvaluationTest; import org.wso2.carbon.policy.mgt.core.task.MonitoringTask; +import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService; import org.wso2.carbon.policy.mgt.core.util.PolicyManagementConstants; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; @@ -84,6 +85,7 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { private static final String GROUP1 = "group1"; private static final String POLICY1 = "policy1"; private static final String POLICY1_FEATURE1_CODE = "DISALLOW_ADJUST_VOLUME"; + private static final String POLICY1_CAM_FEATURE1_CODE = "DISALLOW_OPEN_CAM"; private static final String ADMIN_USER = "admin"; public static final String DEVICE_2 = "device2"; public static final String DEVICE_TYPE_B = "deviceTypeB"; @@ -92,6 +94,7 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { private GroupManagementProviderService groupMgtService; private OperationManager operationManager; private PolicyManagerService policyManagerService; + private Profile profile; private Policy policy1; @@ -240,7 +243,6 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { Policy effectivePolicy = policyManagerService.getEffectivePolicy(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); Assert.assertEquals(effectivePolicy.getPolicyName(), POLICY1, POLICY1 + " was not activated for " + DEVICE1); - } @Test(dependsOnMethods = "activatePolicy") @@ -359,17 +361,65 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { Assert.assertEquals(POLICY1_FEATURE1_CODE,effectiveFeatures.get(0).getFeatureCode()); try{ policyManagerService.getEffectiveFeatures(new DeviceIdentifier(DEVICE_2, DEVICE_TYPE_B)); - }catch(FeatureManagementException e){ - Assert.assertTrue(e.getCause()instanceof PolicyEvaluationException); + }catch(FeatureManagementException ex){ + if(ex.getCause() instanceof PolicyEvaluationException){ + Assert.assertTrue(ex.getCause() instanceof PolicyEvaluationException); + }else { + throw ex; + } } - } @Test(dependsOnMethods = "applyPolicy") public void getDeviceCompliance() throws Exception{ - NonComplianceData deviceCompliance = policyManagerService.getDeviceCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); + NonComplianceData deviceCompliance = policyManagerService. + getDeviceCompliance(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); Assert.assertNotNull(deviceCompliance); } + @Test(dependsOnMethods = "applyPolicy") + public void getTaskScheduleService() throws Exception{ + TaskScheduleService taskScheduleService = policyManagerService.getTaskScheduleService(); + Assert.assertNotNull(taskScheduleService); + } + @Test(dependsOnMethods = "applyPolicy") + public void addProfile() throws Exception{ + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + profile = new Profile(); + profile.setTenantId(tenantId); + profile.setCreatedDate(new Timestamp(System.currentTimeMillis())); + profile.setDeviceType(DEVICE_TYPE_A); + + List profileFeatures = new ArrayList(); + ProfileFeature profileFeature = new ProfileFeature(); + profileFeature.setContent("{'enable':'true'}"); + profileFeature.setDeviceType(DEVICE_TYPE_A); + profileFeature.setFeatureCode(POLICY1_FEATURE1_CODE); + profileFeatures.add(profileFeature); + profile.setProfileFeaturesList(profileFeatures); + profile.setProfileName("tp_profile2"); + profile.setUpdatedDate(new Timestamp(System.currentTimeMillis())); + Profile profile1 = policyManagerService.addProfile(profile); + Assert.assertNotNull(profile1); + Assert.assertEquals("tp_profile2",profile1.getProfileName()); + } + + @Test(dependsOnMethods = "addProfile") + public void updateProfile() throws Exception{ + Policy effectivePolicy = policyManagerService.getEffectivePolicy(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); + Profile currentProfile = effectivePolicy.getProfile(); + List profileFeatures = new ArrayList<>(); + ProfileFeature profileFeature = new ProfileFeature(); + profileFeature.setContent("{'enable':'true'}"); + profileFeature.setDeviceType(DEVICE_TYPE_A); + profileFeature.setFeatureCode(POLICY1_CAM_FEATURE1_CODE); + profileFeatures.add(profileFeature); + profile.setProfileFeaturesList(profileFeatures); + profile.setUpdatedDate(new Timestamp(System.currentTimeMillis())); + Profile updatedProfile = policyManagerService.updateProfile(this.profile); + Assert.assertNotNull(profile); + Assert.assertNotNull(currentProfile.getProfileFeaturesList().get(0).getFeatureCode(), + updatedProfile.getProfileFeaturesList().get(0).getFeatureCode()); + } } \ No newline at end of file diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java index b424befe3d..97b8ee23b1 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/services/SimplePolicyEvaluationTest.java @@ -41,12 +41,10 @@ SimplePolicyEvaluationTest implements PolicyEvaluationPoint { @Override public Policy getEffectivePolicy(DeviceIdentifier deviceIdentifier) throws PolicyEvaluationException { Policy policy = new Policy(); - List policyList; PolicyAdministratorPoint policyAdministratorPoint; PolicyInformationPoint policyInformationPoint; PolicyManagerService policyManagerService = new PolicyManagerServiceImpl(); - try { if (policyManagerService != null) { @@ -82,7 +80,6 @@ SimplePolicyEvaluationTest implements PolicyEvaluationPoint { throw new PolicyEvaluationException(); }else { return getEffectivePolicy(deviceIdentifier).getProfile().getProfileFeaturesList(); - } } From 18411ccc88cbaeb3c4d65017ab8386b3453aa4fb Mon Sep 17 00:00:00 2001 From: Jasintha Date: Thu, 12 Oct 2017 06:16:12 +0530 Subject: [PATCH 4/4] Removing additional line spaces --- .../carbon/policy/mgt/core/PolicyManagerServiceImplTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java index 3174a047ff..e21fa59f4b 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyManagerServiceImplTest.java @@ -221,7 +221,6 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { policy1.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); policy1 = policyManagerService.addPolicy(policy1); - int policyCount = policyManagerService.getPolicyCount(); Assert.assertEquals(policyCount, 1, "Policy count should be 1"); @@ -242,7 +241,6 @@ public class PolicyManagerServiceImplTest extends BasePolicyManagementDAOTest { policyManagerService.getPAP().activatePolicy(policy1.getId()); Policy effectivePolicy = policyManagerService.getEffectivePolicy(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A)); Assert.assertEquals(effectivePolicy.getPolicyName(), POLICY1, POLICY1 + " was not activated for " + DEVICE1); - } @Test(dependsOnMethods = "activatePolicy")