diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/DeviceManagementTestCase.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/DeviceManagementTestCase.java index c096f0bd42b..dae28fdfe9c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/DeviceManagementTestCase.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/DeviceManagementTestCase.java @@ -18,23 +18,20 @@ package org.wso2.carbon.device.mgt.core; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.Test; -public class DeviceManagementTestCase extends TestCase { +import static org.junit.Assert.assertEquals; + +public class DeviceManagementTestCase { private static final Log log = LogFactory.getLog(DeviceManagementTestCase.class); - /** - * @return the suite of tests being tested - */ - public static Test suite() { - return new TestSuite(DeviceManagementTestCase.class); + @Test + public void setUp() throws Exception { + log.info("Testing started."); + assertEquals("A", "A"); } - - } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java index 7fd3bf5dc1d..9cb5ea37311 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java @@ -20,11 +20,64 @@ package org.wso2.carbon.policy.mgt.common.spi; import org.wso2.carbon.policy.mgt.common.Policy; +/** + * This interface defines the policy management which should be implemented by the plugins + */ + public interface PolicyManagerService { - void addPolicy(Policy policy); + // void addPolicy(Policy policy); + + /** + * This method adds a policy per device which should be implemented by the related plugins. + * @param deviceId + * @param deviceType + * @param policy + */ + + void addPolicyToDevice(String deviceId, String deviceType, Policy policy); + + /** + * This method adds a policy to device type by the related device type plugins. + * @param deviceType + * @param policy + */ + + void addPolicyToDeviceType(String deviceType,Policy policy); + + /** + * This method adds the policy to specific role. + * @param roleName + * @param policy + */ + void addPolicyToRole(String roleName, Policy policy); + + // Policy getPolicy(); + + /** + * This method gives the device specific policy. + * @param deviceId + * @param deviceType + * @return Policy + */ + + Policy getPolicyOfDevice(String deviceId, String deviceType); + + /** + * This method returns the device type specific policy. + * @param deviceType + * @return Policy + */ + + Policy getPolicyOfDeviceType(String deviceType); + + /** + * This method returns the role specific policy. + * @param roleName + * @return + */ + + Policy getPolicyOfRole(String roleName); - void addPolicy(String deviceId, String deviceType, Policy policy); - void addPolicy(String deviceType,Policy policy); }