diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index c44e907445..2a9724f401 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index c852d985b6..7402cbaba7 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index c749c90d52..32b7f2dcb2 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index bccaa548bd..f07a079293 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index 245dcb65c1..280ffa0bf7 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - API Management Integration Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 7b0d297a3f..58c650bf2b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - API Management Integration Generated Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index 7c965aea03..2e24d52ef1 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 7ce429b6e2..3f4730426c 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - API Management Extensions Component http://wso2.org diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index dc8e6ca2e8..240826feaa 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index f3142c811d..1fdd142fd6 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 8f3fcc9897..8a1dcef4da 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 9d2af0b316..fb65b60d56 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Certificate Management Component http://wso2.org diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 02df708b63..17a984a5f1 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index da1da0fde5..176f7b5f0d 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index a2df62c320..6ffb131f90 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index b61070c398..be3e07f4c3 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 92a02d1696..07ce3ed2df 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index b4c832a8a7..28445bde7d 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 679d655a7e..a9bd46768a 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml index e73348653d..0cff321d76 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index 57cf03630e..ebf275c3f9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 68fb2729b1..9304772f52 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index e5f84f067f..edd571ee21 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 6d09e4f4ce..80d8207a34 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml @@ -229,10 +229,7 @@ org.powermock powermock-module-testng - - - org.powermock - powermock-api-mockito + test org.wso2.carbon @@ -358,7 +355,11 @@ javassist javassist - + + + org.powermock + powermock-api-mockito + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java index f5f209d61f..10699b2f4d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java @@ -20,11 +20,10 @@ package org.wso2.carbon.device.mgt.core.authorization; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.context.CarbonContext; -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.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException; import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService; import org.wso2.carbon.device.mgt.common.authorization.DeviceAuthorizationResult; @@ -36,11 +35,9 @@ import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.permission.mgt.PermissionUtils; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; - -import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Map; + /** * Implementation of DeviceAccessAuthorization service. @@ -233,7 +230,7 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori return userRealm.getAuthorizationManager() .isUserAuthorized(removeTenantDomain(username), PermissionUtils.getAbsolutePermissionPath(CDM_ADMIN_PERMISSION), - PermissionMethod.UI_EXECUTE); + CarbonConstants.UI_PERMISSION_ACTION); } return false; } @@ -265,22 +262,6 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori return PermissionUtils.putPermission(permission); } - private Map getOwnershipOfDevices(List devices) { - Map ownershipData = new HashMap<>(); - EnrolmentInfo enrolmentInfo; - String owner; - for (Device device : devices) { - enrolmentInfo = device.getEnrolmentInfo(); - if (enrolmentInfo != null) { - owner = enrolmentInfo.getOwner(); - if (owner != null && !owner.isEmpty()) { - ownershipData.put(device.getDeviceIdentifier(), owner); - } - } - } - return ownershipData; - } - public static final class PermissionMethod { public static final String READ = "read"; public static final String WRITE = "write"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index decb956f1e..1dc588f0e1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -122,7 +122,14 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " + "t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE " + "t.NAME = ? AND t.ID = d.DEVICE_TYPE_ID AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ?) d1 WHERE d1.ID = e.DEVICE_ID " + - "AND TENANT_ID = ? ORDER BY e.DATE_OF_LAST_UPDATE DESC"; + "AND TENANT_ID = ? ORDER BY e.DATE_OF_LAST_UPDATE DESC, e.STATUS ASC"; + // Status adeed as an orderby clause to fix a bug : when an existing device is + // re-enrolled, earlier enrollment is marked as removed and a new enrollment is added. + // However, both enrollments share the same time stamp. When retrieving the device + // due to same timestamp, enrollment information is incorrect, intermittently. Hence + // status also should be taken into consideration when ordering. This should not present a + // problem for other status transitions, as there would be an intermediary removed + // state in between. stmt = conn.prepareStatement(sql); stmt.setString(1, deviceIdentifier.getType()); stmt.setString(2, deviceIdentifier.getId()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java index 36b56e357a..9110299009 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java @@ -390,7 +390,7 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic } } - private EventProcessorAdminServiceStub getEventProcessorAdminServiceStub() throws JWTClientException { + protected EventProcessorAdminServiceStub getEventProcessorAdminServiceStub() throws JWTClientException { //send alert to event-processing String eventProcessorAdminServiceWSUrl = Utils.replaceSystemProperty(GeoServices.DAS_URL) + "/services/EventProcessorAdminService"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java index 052a9aeccb..a2aefc111f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java @@ -118,6 +118,8 @@ public class ConfigOperationDAOImpl extends GenericOperationDAOImpl { bais = new ByteArrayInputStream(operationDetails); ois = new ObjectInputStream(bais); configOperation = (ConfigOperation) ois.readObject(); + configOperation.setId(rs.getInt("OPERATION_ID")); + configOperation.setEnabled(rs.getBoolean("ENABLED")); } } catch (IOException e) { throw new OperationManagementDAOException("IO Error occurred while de serialize the policy operation " + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index fe77b94180..ff278493f9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -481,8 +481,6 @@ public interface DeviceManagementProviderService { */ PlatformConfiguration getConfiguration(String deviceType) throws DeviceManagementException; - void updateDeviceEnrolmentInfo(Device device, EnrolmentInfo.Status active) throws DeviceManagementException; - /** * This method is used to check whether the device is enrolled with the give user. * diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index e5d065a196..4c1454015b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -1741,6 +1741,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv if (requireDeviceInfo) { this.getAllDeviceInfo(userDevices); } + devices.addAll(userDevices); } return devices; } @@ -1890,41 +1891,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return result; } - @Override - public void updateDeviceEnrolmentInfo(Device device, EnrolmentInfo.Status status) throws DeviceManagementException { - try { - if (device == null || status == null) { - String msg = "Received incomplete data for updateDeviceEnrolmentInfo"; - log.error(msg); - throw new DeviceManagementException(msg); - } - if (log.isDebugEnabled()) { - log.debug("Updating enrolment for device: " + device.getId() + " of type '" + device.getType() + "'"); - } - DeviceManagementDAOFactory.beginTransaction(); - device.getEnrolmentInfo().setDateOfLastUpdate(new Date().getTime()); - device.getEnrolmentInfo().setStatus(status); - deviceDAO.updateDevice(device, this.getTenantId()); - DeviceManagementDAOFactory.commitTransaction(); - } catch (DeviceManagementDAOException e) { - DeviceManagementDAOFactory.rollbackTransaction(); - String msg = "Error occurred while updating device enrolment status for " + device.getDeviceIdentifier() + - " of type " + device.getType(); - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } catch (TransactionManagementException e) { - String msg = "Error occurred while initiating transaction"; - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } catch (Exception e) { - String msg = "Error occurred in updateDeviceEnrolmentInfo"; - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - } - @Override public void registerDeviceManagementService(DeviceManagementService deviceManagementService) { if (log.isDebugEnabled()) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java new file mode 100644 index 0000000000..0d47d369cd --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java @@ -0,0 +1,356 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.core.authorization; + +import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; +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.DeviceNotFoundException; +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException; +import org.wso2.carbon.device.mgt.common.authorization.DeviceAuthorizationResult; +import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; +import org.wso2.carbon.device.mgt.common.group.mgt.RoleDoesNotExistException; +import org.wso2.carbon.device.mgt.common.permission.mgt.PermissionManagementException; +import org.wso2.carbon.device.mgt.core.TestDeviceManagementService; +import org.wso2.carbon.device.mgt.core.common.TestDataHolder; +import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent; +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.registry.core.config.RegistryContext; +import org.wso2.carbon.registry.core.exceptions.RegistryException; +import org.wso2.carbon.registry.core.internal.RegistryDataHolder; +import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService; +import org.wso2.carbon.registry.core.service.RegistryService; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.api.UserStoreManager; +import org.wso2.carbon.user.api.Permission; +import org.wso2.carbon.user.core.service.RealmService; +import org.wso2.carbon.user.core.tenant.JDBCTenantManager; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Map; +import java.util.List; +import java.util.HashMap; +import java.util.Arrays; + +/** + * Unit tests for DeviceAccessAuthorizationServiceTest + */ +public class DeviceAccessAuthorizationServiceTest { + private static final Log log = LogFactory.getLog(DeviceAccessAuthorizationServiceTest.class); + private static final String DEVICE_TYPE = "AUTH_SERVICE_TEST_TYPE"; + private static final int NO_OF_DEVICES = 5; + private static final String ADMIN_USER = "admin"; + private static final String NON_ADMIN_ALLOWED_USER = "nonAdmin"; + private static final String NORMAL_USER = "normal"; + private static final String ADMIN_ROLE = "adminRole"; + private static final String NON_ADMIN_ROLE = "nonAdminRole"; + private static final String DEFAULT_GROUP = "defaultGroup"; + private static final String DEVICE_ID_PREFIX = "AUTH-SERVICE-TEST-DEVICE-ID-"; + private static final String USER_CLAIM_EMAIL_ADDRESS = "http://wso2.org/claims/emailaddress"; + private static final String USER_CLAIM_FIRST_NAME = "http://wso2.org/claims/givenname"; + private static final String USER_CLAIM_LAST_NAME = "http://wso2.org/claims/lastname"; + private static final String ADMIN_PERMISSION = "/permission/admin"; + private static final String NON_ADMIN_PERMISSION = "/permission/admin/manage/device-mgt/devices/owning-device/view"; + private static final String FIRST_NAME = "firstName"; + private static final String LAST_NAME = "lastName"; + private static final String EMAIL = "email"; + private static final String PASSWORD = "password"; + private DeviceAccessAuthorizationServiceImpl deviceAccessAuthorizationService; + private List deviceIds = new ArrayList<>(); + private List groupDeviceIds = new ArrayList<>(); + private Map defaultUserClaims; + + @BeforeClass + public void init() throws Exception { + DeviceConfigurationManager.getInstance().initConfig(); + log.info("Initializing test environment to test DeviceAccessAuthorization Class"); + for (int i = 0; i < NO_OF_DEVICES; i++) { + deviceIds.add(new DeviceIdentifier(DEVICE_ID_PREFIX + i, DEVICE_TYPE)); + } + List devices = TestDataHolder.generateDummyDeviceData(this.deviceIds); + DeviceManagementProviderService deviceMgtService = new DeviceManagementProviderServiceImpl(); + DeviceManagementServiceComponent.notifyStartupListeners(); + DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceMgtService); + DeviceManagementDataHolder.getInstance().setRegistryService(getRegistryService()); + DeviceManagementDataHolder.getInstance().setGroupManagementProviderService(new + GroupManagementProviderServiceImpl()); + DeviceManagementDataHolder.getInstance().setDeviceTaskManagerService(null); + deviceMgtService.registerDeviceType(new TestDeviceManagementService(DEVICE_TYPE, + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)); + for (Device device : devices) { + deviceMgtService.enrollDevice(device); + } + List returnedDevices = deviceMgtService.getAllDevices(DEVICE_TYPE); + for (Device device : returnedDevices) { + if (!device.getDeviceIdentifier().startsWith(DEVICE_ID_PREFIX)) { + throw new Exception("Incorrect device with ID - " + device.getDeviceIdentifier() + " returned!"); + } + } + deviceAccessAuthorizationService = Mockito.mock(DeviceAccessAuthorizationServiceImpl.class, + Mockito.CALLS_REAL_METHODS); + defaultUserClaims = buildDefaultUserClaims(FIRST_NAME, LAST_NAME, EMAIL); + initializeTestEnvironment(); + //Starting tenant flow + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID, true); + } + + private RegistryService getRegistryService() throws RegistryException, UserStoreException { + RealmService realmService = new InMemoryRealmService(); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); + BasicDataSource dataSource = new BasicDataSource(); + String connectionUrl = "jdbc:h2:./target/databasetest/CARBON_TEST"; + dataSource.setUrl(connectionUrl); + dataSource.setDriverClassName("org.h2.Driver"); + JDBCTenantManager jdbcTenantManager = new JDBCTenantManager(dataSource, + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); + realmService.setTenantManager(jdbcTenantManager); + RegistryDataHolder.getInstance().setRealmService(realmService); + DeviceManagementDataHolder.getInstance().setRealmService(realmService); + InputStream is = this.getClass().getClassLoader().getResourceAsStream("carbon-home/repository/conf/registry.xml"); + RegistryContext context = RegistryContext.getBaseInstance(is, realmService); + context.setSetup(true); + return context.getEmbeddedRegistryService(); + } + + private void initializeTestEnvironment() throws UserStoreException, GroupManagementException, + RoleDoesNotExistException, DeviceNotFoundException { + //creating UI permission + Permission adminPermission = new Permission(ADMIN_PERMISSION, CarbonConstants.UI_PERMISSION_ACTION); + Permission deviceViewPermission = new Permission(NON_ADMIN_PERMISSION, CarbonConstants.UI_PERMISSION_ACTION); + UserStoreManager userStoreManager = DeviceManagementDataHolder.getInstance().getRealmService() + .getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID).getUserStoreManager(); + //Adding a non Admin User + userStoreManager.addUser(NON_ADMIN_ALLOWED_USER, PASSWORD, null, defaultUserClaims, null); + //Adding a normal user + userStoreManager.addUser(NORMAL_USER, PASSWORD, null, defaultUserClaims, null); + //Adding role with permission to Admin user + userStoreManager.addRole(ADMIN_ROLE, new String[]{ADMIN_USER}, new Permission[]{adminPermission}); + //Adding role with permission to non Admin user + userStoreManager.addRole(NON_ADMIN_ROLE, new String[]{NON_ADMIN_ALLOWED_USER}, + new Permission[]{deviceViewPermission}); + //Creating default group + GroupManagementProviderService groupManagementProviderService = DeviceManagementDataHolder.getInstance() + .getGroupManagementProviderService(); + groupManagementProviderService.createDefaultGroup(DEFAULT_GROUP); + int groupId = groupManagementProviderService.getGroup(DEFAULT_GROUP).getGroupId(); + //Sharing group with admin and non admin roles + groupManagementProviderService.manageGroupSharing(groupId, new ArrayList<>(Arrays.asList(ADMIN_ROLE, + NON_ADMIN_ROLE))); + //Adding first 2 devices to the group + groupDeviceIds.add(deviceIds.get(0)); + groupDeviceIds.add(deviceIds.get(1)); + groupManagementProviderService.addDevices(groupId, groupDeviceIds); + } + + private Map buildDefaultUserClaims(String firstName, String lastName, String emailAddress) { + Map defaultUserClaims = new HashMap<>(); + defaultUserClaims.put(USER_CLAIM_FIRST_NAME, firstName); + defaultUserClaims.put(USER_CLAIM_LAST_NAME, lastName); + defaultUserClaims.put(USER_CLAIM_EMAIL_ADDRESS, emailAddress); + if (log.isDebugEnabled()) { + log.debug("Default claim map is created for new user: " + defaultUserClaims.toString()); + } + return defaultUserClaims; + } + + //Admin User test cases + @Test(description = "Check authorization giving a device identifier and username") + public void userAuthDevIdUserName() throws Exception { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); + for (DeviceIdentifier deviceId : deviceIds) { + Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceId, ADMIN_USER), + "Device access authorization for admin user failed"); + } + } + + @Test(description = "Authorization for multiple device identifiers and username") + public void userAuthDevIdUserNameResult() throws DeviceAccessAuthorizationException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); + DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. + isUserAuthorized(deviceIds, ADMIN_USER); + Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 5, + "Expected 5 authorized devices for admin user"); + Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 0, + "Expected 0 un-authorized devices for admin user"); + } + + @Test(description = "Authorization by device identifier") + public void userAuthDevId() throws Exception { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); + for (DeviceIdentifier deviceId : deviceIds) { + Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceId), + "Authorize user from device identifier failed"); + } + } + + @Test(description = "Authorization by multiple device identifiers") + public void userAuthDevIdResult() throws Exception { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); + DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. + isUserAuthorized(deviceIds); + Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 5, + "Expected 5 authorized devices for admin user"); + Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 0, + "Expected 0 un-authorized devices for admin user"); + } + + @Test(description = "Check current user is a device administrator") + public void isDevAdminAdminUser() throws DeviceAccessAuthorizationException, UserStoreException, + PermissionManagementException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); + Assert.assertTrue(deviceAccessAuthorizationService.isDeviceAdminUser(), + "Admin user failed to authorize as admin"); + } + + //Non admin user tests + @Test(description = "Check authorization by device identifier and permission Allowed test case") + public void userAuthDevIdPermission() throws DeviceAccessAuthorizationException, UserStoreException, + PermissionManagementException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceIds.get(0), + new String[]{NON_ADMIN_PERMISSION}), "Non admin user with permissions attempt to access failed"); + } + + @Test(description = "Check authorization by device identifier and permission Not-allowed test case") + public void userAuthFalseDevIdPermission() throws DeviceAccessAuthorizationException, UserStoreException, + PermissionManagementException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + Assert.assertFalse(deviceAccessAuthorizationService.isUserAuthorized(deviceIds.get(3), + new String[]{NON_ADMIN_PERMISSION}), "Non admin user accessing not allowed device authorized"); + } + + @Test(description = "Authorization by giving a device identifier, username and permission Allowed test case") + public void userAuthDevIdUserNamePermission() throws DeviceAccessAuthorizationException, UserStoreException, + PermissionManagementException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceIds.get(0), NON_ADMIN_ALLOWED_USER, + new String[]{NON_ADMIN_PERMISSION}), "Non admin user with permissions attempt to access failed"); + } + + @Test(description = "Authorization by giving a device identifier, username and permission Not-allowed test case") + public void userAuthFalseDevIdUserNamePermission() throws DeviceAccessAuthorizationException, UserStoreException, + PermissionManagementException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + Assert.assertFalse(deviceAccessAuthorizationService.isUserAuthorized(deviceIds.get(3), NON_ADMIN_ALLOWED_USER, + new String[]{NON_ADMIN_PERMISSION}), "Non admin user accessing not allowed device authorized"); + } + + @Test(description = "Authorization by giving device identifiers and permission") + public void userAuthDevIdPermissionResult() throws DeviceAccessAuthorizationException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. + isUserAuthorized(deviceIds, new String[]{NON_ADMIN_PERMISSION}); + Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 2, + "Non admin user authentication to 2 devices in a shared group failed"); + Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 3, + "Non admin user authentication to 3 devices in a non-shared group failed"); + } + + @Test(description = "Authorization by giving device identifiers, username and permission") + public void userAuthDevIdUserNamePermissionResult() throws DeviceAccessAuthorizationException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. + isUserAuthorized(deviceIds, NON_ADMIN_ALLOWED_USER, new String[]{NON_ADMIN_PERMISSION}); + Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 2, + "Non admin user authentication to 2 devices in a shared group failed"); + Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 3, + "Non admin user authentication to 3 devices in a non-shared group failed"); + } + + @Test(description = "Authorization for device admin called by normal user") + public void isDevAdminNormalUser() throws DeviceAccessAuthorizationException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NORMAL_USER); + Assert.assertFalse(deviceAccessAuthorizationService.isDeviceAdminUser(), "Normal user allowed as admin user"); + } + + //Check branches of isUserAuthorized + @Test(description = "Checking branch - user is device owner") + public void nonAdminDeviceOwner() throws DeviceAccessAuthorizationException, DeviceManagementException { + + //Creating a temporary device + Device device = new Device(); + EnrolmentInfo enrolmentInfo = new EnrolmentInfo(NON_ADMIN_ALLOWED_USER, EnrolmentInfo.OwnerShip.BYOD, null); + device.setEnrolmentInfo(enrolmentInfo); + device.setName("temp"); + device.setType(DEVICE_TYPE); + device.setDeviceIdentifier("1234"); + DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().enrollDevice(device); + + //temporary device identifier + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setType(DEVICE_TYPE); + deviceIdentifier.setId("1234"); + + List tempList = new ArrayList<>(); + tempList.add(deviceIdentifier); + + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. + isUserAuthorized(tempList, NON_ADMIN_ALLOWED_USER, new String[]{NON_ADMIN_PERMISSION}); + Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 1, + "Non admin device owner failed to access device"); + Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 0, + "Non admin device owner failed to access device"); + } + + @Test(description = "Check authorization without giving permissions") + public void userAuthWithoutPermissions() throws DeviceAccessAuthorizationException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. + isUserAuthorized(deviceIds, NON_ADMIN_ALLOWED_USER, null); + Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 0, + "Non admin user try authentication without permission failed"); + Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 5, + "Non admin user try authentication without permission failed"); + } + + //check Exception cases + @Test(description = "check a null username in isUserAuthorized method") + public void callUserAuthWithoutUsername() throws DeviceAccessAuthorizationException { + PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_ALLOWED_USER); + DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. + isUserAuthorized(deviceIds, "", new String[]{NON_ADMIN_PERMISSION}); + Assert.assertEquals(deviceAuthorizationResult, null, + "Not null result for empty username in isUserAuthorized method"); + } + + @AfterClass + public void clearAll() { + PrivilegedCarbonContext.endTenantFlow(); + } + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/BaseDeviceManagementTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/BaseDeviceManagementTest.java index e5c21cdcd8..51789b1fef 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/BaseDeviceManagementTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/BaseDeviceManagementTest.java @@ -80,7 +80,7 @@ public abstract class BaseDeviceManagementTest { NotificationManagementDAOFactory.init(dataSource); } - private void initServices() throws DeviceManagementException, RegistryException { + protected void initServices() throws DeviceManagementException, RegistryException { DeviceConfigurationManager.getInstance().initConfig(); DeviceManagementProviderService deviceMgtService = new DeviceManagementProviderServiceImpl(); DeviceManagementServiceComponent.notifyStartupListeners(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java index a23fdbc638..94d1357598 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/common/TestDataHolder.java @@ -20,6 +20,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.app.mgt.Application; +import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.common.notification.mgt.Notification; import org.wso2.carbon.device.mgt.common.notification.mgt.Notification; @@ -55,6 +56,28 @@ public class TestDataHolder { return device; } + public static DeviceInfo generateDummyDeviceInfo() { + DeviceInfo deviceInfo = new DeviceInfo(); + deviceInfo.setIMEI("IMEI-12345"); + deviceInfo.setIMSI("IMSI-12344"); + deviceInfo.setDeviceModel("DUMMY_MODEL"); + deviceInfo.setVendor("Google"); + deviceInfo.setOsVersion("Oreo"); + deviceInfo.setOsBuildDate("24-05-2017"); + deviceInfo.setBatteryLevel(25.0); + deviceInfo.setInternalTotalMemory(1.5); + deviceInfo.setInternalAvailableMemory(2.5); + deviceInfo.setExternalTotalMemory(16.76); + deviceInfo.setExternalAvailableMemory(4.56); + deviceInfo.setConnectionType("CON_TYPE"); + deviceInfo.setSsid("SSID"); + deviceInfo.setCpuUsage(23.5); + deviceInfo.setTotalRAMMemory(1.5); + deviceInfo.setAvailableRAMMemory(2.33); + deviceInfo.setPluggedIn(true); + return deviceInfo; + } + public static Notification getNotification(int notificationId, String status, String deviceId, String description, String deviceName, int operationId, String deviceType) { @@ -98,6 +121,21 @@ public class TestDataHolder { return devices; } + public static Device generateDummyDeviceData(DeviceIdentifier deviceIdentifier) { + Device device = new Device(); + EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); + enrolmentInfo.setDateOfEnrolment(new Date().getTime()); + enrolmentInfo.setDateOfLastUpdate(new Date().getTime()); + enrolmentInfo.setOwner(OWNER); + enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); + enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED); + device.setEnrolmentInfo(enrolmentInfo); + device.setDescription("Test Description"); + device.setDeviceIdentifier(deviceIdentifier.getId()); + device.setType(deviceIdentifier.getType()); + return device; + } + public static DeviceType generateDeviceTypeData(String devTypeName) { DeviceType deviceType = new DeviceType(); deviceType.setName(devTypeName); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java new file mode 100644 index 0000000000..26aad9a908 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * you may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.wso2.carbon.device.mgt.core.geo.service; + +import org.mockito.Mockito; + +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +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.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.geo.service.Alert; +import org.wso2.carbon.device.mgt.common.geo.service.GeoFence; +import org.wso2.carbon.device.mgt.common.geo.service.GeoLocationBasedServiceException; +import org.wso2.carbon.device.mgt.core.TestDeviceManagementService; +import org.wso2.carbon.device.mgt.core.common.TestDataHolder; +import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub; +import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; + +import java.rmi.RemoteException; +import java.util.List; + +public class GeoLocationProviderServiceTest { + + private static final String DEVICE_TYPE = "GL_TEST_TYPE"; + private static final String DEVICE_ID = "GL-TEST-DEVICE-ID-1"; + private static final String SAMPLE_GEO_JSON = "12121"; + private static final String SAMPLE_AREA_NAME = "CUSTOM_NAME"; + private static final String SAMPLE_QUERY_NAME = "QUERY_NAME"; + private static final String SAMPLE_PROXIMITY_DISATANCE = "100"; + private static final String SAMPLE_PROXIMITY_TIME = "50"; + private static final String SAMPLE_SPEED_ALERT_VALUE = "120"; + private static final String SAMPLE_STATIONARY_TIME = "1500"; + private static final String SAMPLE_FLUCTUATION_RADIUS = "2000"; + + private EventProcessorAdminServiceStub mockEventProcessorAdminServiceStub; + private GeoLocationProviderServiceImpl geoLocationProviderServiceImpl; + + @BeforeClass + public void init() throws Exception { + initMocks(); + enrollDevice(); + } + + @Test (description = "Create a sample geo exit-alert with relevant details.") + public void createGeoExitAlert() throws GeoLocationBasedServiceException { + Boolean result = geoLocationProviderServiceImpl. + createGeoAlert(getExitAlert(), getDeviceIdentifier(), DeviceManagementConstants.GeoServices.ALERT_TYPE_EXIT); + Assert.assertEquals(result, Boolean.TRUE); + } + + @Test (description = "Create a sample geo within-alert with relevant details.") + public void createGeoWithinAlert() throws GeoLocationBasedServiceException { + Boolean result = geoLocationProviderServiceImpl. + createGeoAlert(getWithinAlert(), getDeviceIdentifier(), DeviceManagementConstants.GeoServices.ALERT_TYPE_WITHIN); + Assert.assertEquals(result, Boolean.TRUE); + } + + @Test (description = "Create a sample geo proximity-alert with relevant details.") + public void createGeoProximityAlert() throws GeoLocationBasedServiceException { + Boolean result = geoLocationProviderServiceImpl. + createGeoAlert(getProximityAlert(), getDeviceIdentifier(), DeviceManagementConstants.GeoServices.ALERT_TYPE_PROXIMITY); + Assert.assertEquals(result, Boolean.TRUE); + } + + @Test (description = "Create a sample geo speed-alert with relevant details.") + public void createGeoSpeedAlert() throws GeoLocationBasedServiceException { + Boolean result = geoLocationProviderServiceImpl. + createGeoAlert(getSpeedAlert(), getDeviceIdentifier(), DeviceManagementConstants.GeoServices.ALERT_TYPE_SPEED); + Assert.assertEquals(result, Boolean.TRUE); + } + + @Test (description = "Create a sample geo stationary-alert with relevant details.") + public void createGeoStationaryAlert() throws GeoLocationBasedServiceException { + Boolean result = geoLocationProviderServiceImpl. + createGeoAlert(getStationaryAlert(), getDeviceIdentifier(), DeviceManagementConstants.GeoServices.ALERT_TYPE_STATIONARY); + Assert.assertEquals(result, Boolean.TRUE); + } + + @Test (description = "Create a sample geo traffic-alert with relevant details.") + public void createGeoTrafficAlert() throws GeoLocationBasedServiceException { + Boolean result = geoLocationProviderServiceImpl. + createGeoAlert(getTrafficAlert(), getDeviceIdentifier(), DeviceManagementConstants.GeoServices.ALERT_TYPE_TRAFFIC); + Assert.assertEquals(result, Boolean.TRUE); + } + + @Test(dependsOnMethods = "createGeoSpeedAlert", description = "retrieve saved geo speed-alert.") + public void getGeoSpeedAlerts() throws GeoLocationBasedServiceException { + String result; + result = geoLocationProviderServiceImpl.getSpeedAlerts(getDeviceIdentifier()); + Assert.assertNotNull(result); + Assert.assertEquals(result, "{'speedLimit':" + SAMPLE_SPEED_ALERT_VALUE + "}"); + } + + @Test(dependsOnMethods = "createGeoTrafficAlert" , description = "retrieve saved geo exit-alert.") + public void getGeoTrafficAlerts() throws GeoLocationBasedServiceException { + List geoFences; + geoFences = geoLocationProviderServiceImpl.getTrafficAlerts(getDeviceIdentifier()); + Assert.assertNotNull(geoFences); + GeoFence geoFenceNode = geoFences.get(0); + Assert.assertEquals(geoFenceNode.getGeoJson(), "{\n" + + " \"" + DeviceManagementConstants.GeoServices.GEO_FENCE_GEO_JSON + "\": \"" + SAMPLE_GEO_JSON + "\"\n" + + "}"); + } + + @Test(dependsOnMethods = "createGeoStationaryAlert", description = "retrieve saved geo stationary-alert.") + public void getGeoStationaryAlerts() throws GeoLocationBasedServiceException { + List geoFences; + geoFences = geoLocationProviderServiceImpl.getStationaryAlerts(getDeviceIdentifier()); + Assert.assertNotNull(geoFences); + GeoFence geoFenceNode = geoFences.get(0); + Assert.assertEquals(geoFenceNode.getAreaName(), SAMPLE_AREA_NAME); + Assert.assertEquals(geoFenceNode.getQueryName(), SAMPLE_QUERY_NAME); + Assert.assertEquals(geoFenceNode.getStationaryTime(), SAMPLE_STATIONARY_TIME); + } + + private void initMocks() throws JWTClientException, RemoteException { + mockEventProcessorAdminServiceStub = Mockito.mock(EventProcessorAdminServiceStub.class); + geoLocationProviderServiceImpl = Mockito.mock(GeoLocationProviderServiceImpl.class, Mockito.CALLS_REAL_METHODS); + Mockito.doReturn(mockEventProcessorAdminServiceStub). + when(geoLocationProviderServiceImpl).getEventProcessorAdminServiceStub(); + Mockito.doReturn("success"). + when(mockEventProcessorAdminServiceStub).validateExecutionPlan(Mockito.anyString()); + } + + private DeviceIdentifier getDeviceIdentifier() { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId("1234"); + deviceIdentifier.setType("TEST"); + return deviceIdentifier; + } + + private Alert getWithinAlert() { + Alert alert = new Alert(); + alert.setDeviceId(DEVICE_ID); + alert.setCepAction("CEP_ACTION"); + alert.setParseData("{\n" + + " \" " + DeviceManagementConstants.GeoServices.GEO_FENCE_GEO_JSON + "\": \"" + SAMPLE_GEO_JSON + "\"\n" + + "}"); + alert.setCustomName(SAMPLE_AREA_NAME); + alert.setExecutionPlan("EXECUTION_PLAN"); + alert.setQueryName(SAMPLE_QUERY_NAME); + return alert; + } + + private Alert getExitAlert() { + Alert alert = new Alert(); + alert.setDeviceId(DEVICE_ID); + alert.setQueryName(SAMPLE_QUERY_NAME); + alert.setCustomName(SAMPLE_AREA_NAME); + alert.setStationeryTime(SAMPLE_STATIONARY_TIME); + alert.setFluctuationRadius(SAMPLE_FLUCTUATION_RADIUS); + alert.setParseData("{\n" + + " \" " + DeviceManagementConstants.GeoServices.GEO_FENCE_GEO_JSON + "\": \"" + SAMPLE_GEO_JSON + "\"\n" + + "}"); + alert.setExecutionPlan("EXECUTION_PLAN"); + return alert; + } + + private Alert getProximityAlert() { + Alert alert = new Alert(); + alert.setDeviceId(DEVICE_ID); + alert.setProximityTime(SAMPLE_PROXIMITY_TIME); + alert.setProximityDistance(SAMPLE_PROXIMITY_DISATANCE); + alert.setParseData("{\n" + + " \" " + DeviceManagementConstants.GeoServices.GEO_FENCE_GEO_JSON + "\": \"" + SAMPLE_GEO_JSON + "\"\n" + + "}"); + return alert; + } + + private Alert getSpeedAlert() { + Alert alert = new Alert(); + alert.setDeviceId(DEVICE_ID); + alert.setParseData("{\n" + + " \"" + DeviceManagementConstants.GeoServices.GEO_FENCE_GEO_JSON + "\": \"" + SAMPLE_GEO_JSON + "\",\n" + + " \"" + DeviceManagementConstants.GeoServices.SPEED_ALERT_VALUE + "\": \"" + SAMPLE_SPEED_ALERT_VALUE + "\"\n" + + "}"); + return alert; + } + + private Alert getStationaryAlert() { + Alert alert = new Alert(); + alert.setDeviceId(DEVICE_ID); + alert.setQueryName(SAMPLE_QUERY_NAME); + alert.setCustomName(SAMPLE_AREA_NAME); + alert.setStationeryTime(SAMPLE_STATIONARY_TIME); + alert.setFluctuationRadius(SAMPLE_FLUCTUATION_RADIUS); + alert.setParseData("{\n" + + " \"" + DeviceManagementConstants.GeoServices.GEO_FENCE_GEO_JSON + "\": \"" + SAMPLE_GEO_JSON + "\"\n" + + "}"); + return alert; + } + + private Alert getTrafficAlert() { + Alert alert = new Alert(); + alert.setDeviceId(DEVICE_ID); + alert.setParseData("{\n" + + " \"" + DeviceManagementConstants.GeoServices.GEO_FENCE_GEO_JSON +"\": \"" + SAMPLE_GEO_JSON + "\"\n" + + "}"); + alert.setCustomName(SAMPLE_AREA_NAME); + alert.setExecutionPlan("EXECUTION_PLAN"); + alert.setQueryName(SAMPLE_QUERY_NAME); + return alert; + } + + private void enrollDevice() throws Exception { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(DEVICE_ID, DEVICE_TYPE); + Device device = TestDataHolder.generateDummyDeviceData(deviceIdentifier); + DeviceManagementProviderService deviceMgtService = DeviceManagementDataHolder.getInstance(). + getDeviceManagementProvider(); + deviceMgtService.registerDeviceType(new TestDeviceManagementService(DEVICE_TYPE, + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)); + deviceMgtService.enrollDevice(device); + + Device returnedDevice = deviceMgtService.getDevice(deviceIdentifier); + + if (!returnedDevice.getDeviceIdentifier().equals(deviceIdentifier.getId())) { + throw new Exception("Incorrect device with ID - " + device.getDeviceIdentifier() + " returned!"); + } + } + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/OperationManagementTests.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/OperationManagementTests.java index 9ba56c160a..6ee4c3af37 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/OperationManagementTests.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/operation/OperationManagementTests.java @@ -25,6 +25,7 @@ import org.wso2.carbon.context.PrivilegedCarbonContext; 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.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; @@ -50,6 +51,7 @@ import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.List; @@ -72,6 +74,7 @@ public class OperationManagementTests extends BaseDeviceManagementTest { private List deviceIds = new ArrayList<>(); private OperationManager operationMgtService; + private DeviceManagementProviderService deviceMgmtProvider; private Activity commandActivity; private long commandActivityBeforeUpdatedTimestamp; @@ -94,6 +97,7 @@ public class OperationManagementTests extends BaseDeviceManagementTest { throw new Exception("Incorrect device with ID - " + device.getDeviceIdentifier() + " returned!"); } } + this.deviceMgmtProvider = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(); NotificationStrategy notificationStrategy = new TestNotificationStrategy(); this.operationMgtService = new OperationManagerImpl(DEVICE_TYPE, notificationStrategy); } @@ -144,7 +148,8 @@ public class OperationManagementTests extends BaseDeviceManagementTest { } @Test(expectedExceptions = InvalidDeviceException.class) - public void addNonInitializedDevicesCommandOperation() throws DeviceManagementException, OperationManagementException, + public void addNonInitializedDevicesCommandOperation() throws DeviceManagementException, + OperationManagementException, InvalidDeviceException { DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); List deviceIdentifiers = new ArrayList<>(); @@ -207,8 +212,8 @@ public class OperationManagementTests extends BaseDeviceManagementTest { } private void validateOperationResponse(Activity activity, ActivityStatus.Status expectedStatus) { - Assert.assertEquals(activity.getActivityStatus().size(), NO_OF_DEVICES, "The operation response for add operation only have - " + - activity.getActivityStatus().size()); + Assert.assertEquals(activity.getActivityStatus().size(), NO_OF_DEVICES, "The operation response for add " + + "operation only have - " + activity.getActivityStatus().size()); for (ActivityStatus status : activity.getActivityStatus()) { Assert.assertEquals(status.getStatus(), expectedStatus); } @@ -223,7 +228,8 @@ public class OperationManagementTests extends BaseDeviceManagementTest { } @Test(dependsOnMethods = "addProfileOperation", expectedExceptions = OperationManagementException.class) - public void getOperationsAsNonAdmin() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void getOperationsAsNonAdmin() throws DeviceManagementException, OperationManagementException, + InvalidDeviceException { try { startTenantFlowAsNonAdmin(); for (DeviceIdentifier deviceIdentifier : deviceIds) { @@ -235,15 +241,18 @@ public class OperationManagementTests extends BaseDeviceManagementTest { } @Test(dependsOnMethods = "getOperations") - public void getPendingOperations() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void getPendingOperations() throws DeviceManagementException, OperationManagementException, + InvalidDeviceException { for (DeviceIdentifier deviceIdentifier : deviceIds) { List operations = this.operationMgtService.getPendingOperations(deviceIdentifier); - Assert.assertEquals(operations.size(), 4, "The pending operations should be 4, but found only " + operations.size()); + Assert.assertEquals(operations.size(), 4, "The pending operations should be 4, but found only " + + operations.size()); } } @Test(dependsOnMethods = "getOperations", expectedExceptions = OperationManagementException.class) - public void getPendingOperationsAsNonAdmin() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { + public void getPendingOperationsAsNonAdmin() throws DeviceManagementException, OperationManagementException, + InvalidDeviceException { try { startTenantFlowAsNonAdmin(); for (DeviceIdentifier deviceIdentifier : deviceIds) { @@ -357,14 +366,16 @@ public class OperationManagementTests extends BaseDeviceManagementTest { @Test(dependsOnMethods = "getNextPendingOperation") public void getOperationByDeviceAndOperationId() throws OperationManagementException { DeviceIdentifier deviceIdentifier = this.deviceIds.get(0); - String operationId = this.commandActivity.getActivityId(). - replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, ""); Operation operation = this.operationMgtService.getOperationByDeviceAndOperationId(deviceIdentifier, - Integer.parseInt(operationId)); + getOperationId(this.commandActivity.getActivityId())); Assert.assertTrue(operation.getStatus().equals(Operation.Status.COMPLETED)); Assert.assertTrue(operation.getType().equals(Operation.Type.COMMAND)); } + private int getOperationId(String activityId) { + return Integer.parseInt(activityId.replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, "")); + } + @Test(dependsOnMethods = "getNextPendingOperation", expectedExceptions = OperationManagementException.class) public void getOperationByDeviceAndOperationIdNonAdmin() throws OperationManagementException { startTenantFlowAsNonAdmin(); @@ -382,12 +393,14 @@ public class OperationManagementTests extends BaseDeviceManagementTest { @Test(dependsOnMethods = "getOperationByDeviceAndOperationId") public void getOperationsByDeviceAndStatus() throws OperationManagementException, DeviceManagementException { DeviceIdentifier deviceIdentifier = this.deviceIds.get(0); - List operation = this.operationMgtService.getOperationsByDeviceAndStatus(deviceIdentifier, Operation.Status.PENDING); + List operation = this.operationMgtService.getOperationsByDeviceAndStatus(deviceIdentifier, + Operation.Status.PENDING); Assert.assertEquals(operation.size(), 3); } @Test(dependsOnMethods = "getOperationByDeviceAndOperationId", expectedExceptions = OperationManagementException.class) - public void getOperationsByDeviceAndStatusByNonAdmin() throws OperationManagementException, DeviceManagementException { + public void getOperationsByDeviceAndStatusByNonAdmin() throws OperationManagementException, + DeviceManagementException { startTenantFlowAsNonAdmin(); try { DeviceIdentifier deviceIdentifier = this.deviceIds.get(0); @@ -474,7 +487,8 @@ public class OperationManagementTests extends BaseDeviceManagementTest { } @Test(dependsOnMethods = "getOperationForInactiveDevice", expectedExceptions = OperationManagementException.class) - public void getPaginatedOperationDeviceForInvalidDevice() throws DeviceManagementException, OperationManagementException { + public void getPaginatedOperationDeviceForInvalidDevice() throws DeviceManagementException, + OperationManagementException { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID, true); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); @@ -482,7 +496,8 @@ public class OperationManagementTests extends BaseDeviceManagementTest { PaginationRequest request = new PaginationRequest(1, 2); request.setDeviceType(DEVICE_TYPE); request.setOwner(ADMIN_USER); - PaginationResult result = this.operationMgtService.getOperations(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE), request); + PaginationResult result = this.operationMgtService.getOperations + (new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE), request); Assert.assertEquals(result.getRecordsFiltered(), 4); Assert.assertEquals(result.getData().size(), 2); Assert.assertEquals(result.getRecordsTotal(), 4); @@ -492,13 +507,150 @@ public class OperationManagementTests extends BaseDeviceManagementTest { } @Test(dependsOnMethods = "getOperationForInactiveDevice", expectedExceptions = OperationManagementException.class) - public void getPendingOperationDeviceForInvalidDevice() throws DeviceManagementException, OperationManagementException { - this.operationMgtService.getPendingOperations(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE)); + public void getPendingOperationDeviceForInvalidDevice() throws DeviceManagementException, + OperationManagementException { + this.operationMgtService.getPendingOperations(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE)); } - @Test(dependsOnMethods = "getPendingOperationDeviceForInvalidDevice", expectedExceptions = OperationManagementException.class) - public void getNextPendingOperationDeviceForInvalidDevice() throws DeviceManagementException, OperationManagementException { + @Test(dependsOnMethods = "getPendingOperationDeviceForInvalidDevice", + expectedExceptions = OperationManagementException.class) + public void getNextPendingOperationDeviceForInvalidDevice() throws DeviceManagementException, + OperationManagementException { this.operationMgtService.getNextPendingOperation(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE)); } + @Test(dependsOnMethods = "getNextPendingOperationDeviceForInvalidDevice", + expectedExceptions = OperationManagementException.class) + public void getUpdateOperationForInvalidDevice() throws DeviceManagementException, OperationManagementException { + this.operationMgtService.updateOperation(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE), + getOperation(new CommandOperation(), Operation.Type.COMMAND, COMMAND_OPERATON_CODE)); + } + + @Test(dependsOnMethods = "getUpdateOperationForInvalidDevice", + expectedExceptions = OperationManagementException.class) + public void getOperationByDeviceAndOperationIdInvalidDevice() throws DeviceManagementException, + OperationManagementException { + this.operationMgtService.getOperationByDeviceAndOperationId(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE), + getOperationId(this.commandActivity.getActivityId())); + } + + @Test(dependsOnMethods = "getOperationByDeviceAndOperationIdInvalidDevice", + expectedExceptions = OperationManagementException.class) + public void getOperationsByDeviceAndStatusInvalidDevice() throws DeviceManagementException, + OperationManagementException { + this.operationMgtService.getOperationsByDeviceAndStatus(new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE), + Operation.Status.PENDING); + } + + @Test(dependsOnMethods = "getOperationsByDeviceAndStatusInvalidDevice", + expectedExceptions = OperationManagementException.class) + public void getOperationsInvalidOperationId() throws DeviceManagementException, + OperationManagementException { + this.operationMgtService.getOperation(123445); + } + + @Test(dependsOnMethods = "getOperationsInvalidOperationId", expectedExceptions = IllegalArgumentException.class) + public void getOperationsByActivityIdInvalidActivityId() throws DeviceManagementException, + OperationManagementException { + this.operationMgtService.getOperationByActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + 0); + } + + @Test(dependsOnMethods = "getOperationsByActivityIdInvalidActivityId", + expectedExceptions = IllegalArgumentException.class) + public void getOperationByActivityIdAndDeviceInvalidActivityId() throws DeviceManagementException, + OperationManagementException { + this.operationMgtService.getOperationByActivityIdAndDevice( + DeviceManagementConstants.OperationAttributes.ACTIVITY + 0, + new DeviceIdentifier(INVALID_DEVICE, DEVICE_TYPE)); + } + + @Test(dependsOnMethods = "getOperationByActivityIdAndDeviceInvalidActivityId") + public void getPendingOperationsInactiveEnrollment() throws DeviceManagementException, + OperationManagementException { + changeStatus(EnrolmentInfo.Status.INACTIVE); + List operations = this.operationMgtService.getPendingOperations(this.deviceIds.get(1)); + Assert.assertTrue(operations != null); + Assert.assertEquals(operations.size(), 4); + changeStatus(EnrolmentInfo.Status.ACTIVE); + } + + private void changeStatus(EnrolmentInfo.Status status) throws DeviceManagementException, + OperationManagementException { + Device device = this.deviceMgmtProvider.getDevice(this.deviceIds.get(1)); + Assert.assertTrue(device != null); + Assert.assertEquals(device.getType(), DEVICE_TYPE); + Assert.assertTrue(device.getEnrolmentInfo() != null); + device.getEnrolmentInfo().setStatus(status); + boolean modified = this.deviceMgmtProvider.changeDeviceStatus(this.deviceIds.get(1), status); + Assert.assertTrue(modified); + device = this.deviceMgmtProvider.getDevice(this.deviceIds.get(1)); + Assert.assertEquals(device.getEnrolmentInfo().getStatus(), status); + } + + @Test(dependsOnMethods = "getPendingOperationsInactiveEnrollment") + public void getNextPendingOperationInactiveEnrollment() throws DeviceManagementException, + OperationManagementException { + changeStatus(EnrolmentInfo.Status.INACTIVE); + Operation operation = this.operationMgtService.getNextPendingOperation(this.deviceIds.get(1)); + Assert.assertTrue(operation != null); + changeStatus(EnrolmentInfo.Status.ACTIVE); + } + + @Test(dependsOnMethods = "getNextPendingOperationInactiveEnrollment") + public void getNextPendingOperationForAllOperations() throws DeviceManagementException, + OperationManagementException { + for (int i = 0; i < 4; i++) { + Operation operation = this.operationMgtService.getNextPendingOperation(this.deviceIds.get(1)); + operation.setStatus(Operation.Status.COMPLETED); + this.operationMgtService.updateOperation(deviceIds.get(1), operation); + } + Assert.assertTrue(this.operationMgtService.getNextPendingOperation(this.deviceIds.get(1)) == null); + } + + @Test(dependsOnMethods = "getNextPendingOperationForAllOperations") + public void getOperationByDeviceAndOperationIdForAllOperations() throws DeviceManagementException, + OperationManagementException { + for (int i = 1; i <= 4; i++) { + Operation operation = this.operationMgtService.getOperationByDeviceAndOperationId(this.deviceIds.get(1), i); + Assert.assertEquals(operation.getStatus(), Operation.Status.COMPLETED); + } + } + + @Test(dependsOnMethods = "getOperationByDeviceAndOperationIdForAllOperations") + public void getOperationForAllOperations() throws DeviceManagementException, + OperationManagementException { + for (int i = 1; i <= 4; i++) { + Operation operation = this.operationMgtService.getOperation(i); + Assert.assertTrue(operation != null); + } + } + + @Test(dependsOnMethods = "getOperationForAllOperations") + public void addCustomPolicyOperation() throws OperationManagementException, InvalidDeviceException { + this.addCustomOperation(Operation.Type.POLICY, DeviceManagementConstants.AuthorizationSkippedOperationCodes. + POLICY_OPERATION_CODE); + } + + @Test(dependsOnMethods = "getOperationForAllOperations") + public void addCustomMonitorOperation() throws OperationManagementException, InvalidDeviceException { + this.addCustomOperation(Operation.Type.COMMAND, DeviceManagementConstants.AuthorizationSkippedOperationCodes. + MONITOR_OPERATION_CODE); + } + + @Test(dependsOnMethods = "getOperationForAllOperations") + public void addCustomPolicyRevokeOperation() throws OperationManagementException, InvalidDeviceException { + this.addCustomOperation(Operation.Type.POLICY, DeviceManagementConstants.AuthorizationSkippedOperationCodes. + POLICY_REVOKE_OPERATION_CODE); + } + + private void addCustomOperation(Operation.Type type, String operationCode) throws OperationManagementException, InvalidDeviceException { + Operation operation = new Operation(); + operation.setCode(operationCode); + operation.setType(type); + Activity activity = this.operationMgtService.addOperation(operation, Collections.singletonList(this.deviceIds.get(2))); + Assert.assertEquals(activity.getActivityStatus().size(), 1); + for (ActivityStatus status : activity.getActivityStatus()) { + Assert.assertEquals(status.getStatus(), ActivityStatus.Status.PENDING); + } + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceTest.java index 4cb26bc170..d2425c4cdd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceTest.java @@ -23,11 +23,16 @@ 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.EnrolmentInfo; +import org.wso2.carbon.device.mgt.common.TransactionManagementException; import org.wso2.carbon.device.mgt.core.TestDeviceManagementService; import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; import org.wso2.carbon.device.mgt.core.common.BaseDeviceManagementTest; import org.wso2.carbon.device.mgt.core.common.TestDataHolder; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; +import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; +import org.wso2.carbon.device.mgt.core.device.details.mgt.dao.DeviceDetailsDAO; +import org.wso2.carbon.device.mgt.core.device.details.mgt.dao.DeviceDetailsMgtDAOException; import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent; @@ -40,6 +45,8 @@ import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import java.io.InputStream; +import java.util.Calendar; +import java.util.Date; import java.util.List; public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTest { @@ -47,7 +54,7 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes private static final Log log = LogFactory.getLog(DeviceManagementProviderServiceTest.class); private DeviceManagementProviderService providerService; private static final String DEVICE_TYPE = "RANDOM_DEVICE_TYPE"; - private static final String DEVICE_TYPE_2 = "RANDOM_DEVICE_TYPE"; + private DeviceDetailsDAO deviceDetailsDAO = DeviceManagementDAOFactory.getDeviceDetailsDAO(); DeviceManagementProviderService deviceMgtService; @@ -65,7 +72,6 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes DeviceManagementDataHolder.getInstance().setDeviceTaskManagerService(null); deviceMgtService.registerDeviceType(new TestDeviceManagementService(DEVICE_TYPE, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)); - } private RegistryService getRegistryService() throws RegistryException { @@ -170,39 +176,39 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes } } -// @Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"}) -// public void testReEnrollmentofSameDeviceWithOtherUser() { -// -// EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); -// enrolmentInfo.setDateOfEnrolment(new Date().getTime()); -// enrolmentInfo.setDateOfLastUpdate(new Date().getTime()); -// enrolmentInfo.setOwner("user1"); -// enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); -// enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED); -// -// Device alternateDevice = TestDataHolder.generateDummyDeviceData("12345", DEVICE_TYPE, -// enrolmentInfo); -// -// try { -// Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE)); -// -// deviceMgtService.enrollDevice(alternateDevice); -// Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice -// .getDeviceIdentifier(), alternateDevice.getType())); -// -// log.info(retrievedDevice1.getEnrolmentInfo().getOwner()); -// log.info(retrievedDevice2.getEnrolmentInfo().getOwner()); -// -// Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase -// (retrievedDevice2.getEnrolmentInfo().getOwner())); -// } catch (DeviceManagementException e) { -// String msg = "Error Occured while enrolling device"; -// Assert.fail(msg, e); -// } -// } + @Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"}) + public void testReEnrollmentofSameDeviceWithOtherUser() { + EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); + enrolmentInfo.setDateOfEnrolment(new Date().getTime()); + enrolmentInfo.setDateOfLastUpdate(new Date().getTime()); + enrolmentInfo.setOwner("user1"); + enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); + enrolmentInfo.setStatus(EnrolmentInfo.Status.CREATED); - @Test(dependsOnMethods = {"testReEnrollmentofSameDeviceUnderSameUser"}) + Device alternateDevice = TestDataHolder.generateDummyDeviceData("12345", DEVICE_TYPE, + enrolmentInfo); + + try { + Device retrievedDevice1 = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE)); + + deviceMgtService.enrollDevice(alternateDevice); + Device retrievedDevice2 = deviceMgtService.getDevice(new DeviceIdentifier(alternateDevice + .getDeviceIdentifier(), alternateDevice.getType())); + + log.info(retrievedDevice1.getEnrolmentInfo().getOwner()); + log.info(retrievedDevice2.getEnrolmentInfo().getOwner()); + + Assert.assertFalse(retrievedDevice1.getEnrolmentInfo().getOwner().equalsIgnoreCase + (retrievedDevice2.getEnrolmentInfo().getOwner())); + } catch (DeviceManagementException e) { + String msg = "Error Occured while enrolling device"; + Assert.fail(msg, e); + } + } + + + @Test(dependsOnMethods = {"testReEnrollmentofSameDeviceWithOtherUser"}) public void testDisenrollment() { Device device = TestDataHolder.generateDummyDeviceData(DEVICE_TYPE); try { @@ -320,5 +326,114 @@ public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTes } } + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDevice() { + try { + Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345",DEVICE_TYPE)); + Assert.assertTrue(device.getDeviceIdentifier().equalsIgnoreCase("12345")); + } catch (DeviceManagementException e) { + String msg = "Error occurred while updating the device status"; + Assert.fail(msg, e); + } + } + + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDeviceWithInfo() { + try { + Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE) + , true); + Assert.assertTrue(device.getDeviceInfo() != null); + } catch (DeviceManagementException e) { + String msg = "Error occurred while updating the device status"; + Assert.fail(msg, e); + } + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetDeviceWithOutInfo() { + try { + Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", DEVICE_TYPE) + , false); + Assert.assertTrue(device.getDeviceInfo() == null); + } catch (DeviceManagementException e) { + String msg = "Error occurred while updating the device status"; + Assert.fail(msg, e); + } + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testGetAllDevicesOfRole() { + try { + List devices = deviceMgtService.getAllDevicesOfRole("admin"); + Assert.assertTrue(devices.size() > 0); + } catch (DeviceManagementException e) { + String msg = "Error occurred while updating the device status"; + Assert.fail(msg, e); + } + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testDeviceByOwner() { + try { + Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", + DEVICE_TYPE), "admin", true); + Assert.assertTrue(device != null); + } catch (DeviceManagementException e) { + String msg = "Error occurred while updating the device status"; + Assert.fail(msg, e); + } + } + + @Test(dependsOnMethods = {"testSuccessfulDeviceEnrollment"}) + public void testDeviceByDate() { + try { + Device initialDevice = deviceMgtService.getDevice(new DeviceIdentifier("12345", + DEVICE_TYPE)); + + DeviceManagementDAOFactory.beginTransaction(); + + //Device details table will be reffered when looking for last updated time + //This dao entry is to mimic a device info operation + deviceDetailsDAO.addDeviceInformation(initialDevice.getId(), TestDataHolder + .generateDummyDeviceInfo()); + } catch (DeviceManagementException e) { + e.printStackTrace(); + } catch (TransactionManagementException e) { + e.printStackTrace(); + } catch (DeviceDetailsMgtDAOException e) { + e.printStackTrace(); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + + try { + Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", + DEVICE_TYPE), yesterday()); + Assert.assertTrue(device != null); + } catch (DeviceManagementException e) { + String msg = "Error occurred while updating the device status"; + Assert.fail(msg, e); + } + } + + @Test(dependsOnMethods = {"testDeviceByDate"}) + public void testDeviceByDateAndOwner() { + try { + Device device = deviceMgtService.getDevice(new DeviceIdentifier("12345", + DEVICE_TYPE), "admin", yesterday(), true); + Assert.assertTrue(device != null); + } catch (DeviceManagementException e) { + String msg = "Error occurred while updating the device status"; + Assert.fail(msg, e); + } + } + + private Date yesterday() { + final Calendar cal = Calendar.getInstance(); + cal.add(Calendar.DATE, -1); + return cal.getTime(); + } + } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/testng.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/testng.xml index c2f9229db8..d228944439 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/testng.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/testng.xml @@ -42,10 +42,12 @@ + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index b6d56c8adb..a4043282a1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml @@ -96,6 +96,12 @@ org.wso2.carbon.governance org.wso2.carbon.governance.registry.extensions test + + + jaxen + jaxen + + org.wso2.carbon.registry @@ -106,6 +112,14 @@ org.slf4j jcl-over-slf4j + + org.slf4j + slf4j-api + + + org.slf4j + log4j-over-slf4j + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java index 1f0915bd90..1f1ee0d868 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java @@ -130,6 +130,17 @@ public class DeviceTypeManager implements DeviceManager { //Check whether device dao definition exist. String tableName = deviceTypeConfiguration.getDeviceDetails().getTableId(); if (tableName != null && !tableName.isEmpty()) { + DataSource dataSource = deviceTypeConfiguration.getDataSource(); + if (dataSource == null) { + throw new DeviceTypeDeployerPayloadException("Could not find the datasource related with the " + + "table id " + tableName + " for the device type " + deviceType); + } + TableConfig tableConfig = dataSource.getTableConfig(); + + if (tableConfig == null) { + throw new DeviceTypeDeployerPayloadException("Could not find the table config with the " + + "table id " + tableName + " for the device type " + deviceType); + } List tables = deviceTypeConfiguration.getDataSource().getTableConfig().getTable(); Table deviceDefinitionTable = null; for (Table table : tables) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/exception/DeviceTypeConfigurationException.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/exception/DeviceTypeConfigurationException.java index d044e7ebeb..14b0d7445c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/exception/DeviceTypeConfigurationException.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/exception/DeviceTypeConfigurationException.java @@ -21,33 +21,10 @@ package org.wso2.carbon.device.mgt.extensions.device.type.template.config.except public class DeviceTypeConfigurationException extends Exception { private static final long serialVersionUID = -3151279431229070297L; - - public DeviceTypeConfigurationException(int errorCode, String message) { - super(message); - } - - public DeviceTypeConfigurationException(int errorCode, String message, Throwable cause) { - super(message, cause); - } - + public DeviceTypeConfigurationException(String msg, Exception nestedEx) { super(msg, nestedEx); } - public DeviceTypeConfigurationException(String message, Throwable cause) { - super(message, cause); - } - - public DeviceTypeConfigurationException(String msg) { - super(msg); - } - - public DeviceTypeConfigurationException() { - super(); - } - - public DeviceTypeConfigurationException(Throwable cause) { - super(cause); - } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/exception/InvalidConfigurationStateException.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/exception/InvalidConfigurationStateException.java deleted file mode 100644 index 3d39345327..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/config/exception/InvalidConfigurationStateException.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception; - -public class InvalidConfigurationStateException extends RuntimeException { - - private static final long serialVersionUID = -3151279411229070297L; - - public InvalidConfigurationStateException(int errorCode, String message) { - super(message); - } - - public InvalidConfigurationStateException(int errorCode, String message, Throwable cause) { - super(message, cause); - } - - public InvalidConfigurationStateException(String msg, Exception nestedEx) { - super(msg, nestedEx); - } - - public InvalidConfigurationStateException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidConfigurationStateException(String msg) { - super(msg); - } - - public InvalidConfigurationStateException() { - super(); - } - - public InvalidConfigurationStateException(Throwable cause) { - super(cause); - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceDAODefinition.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceDAODefinition.java index d8f77a64a6..ab11f39de0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceDAODefinition.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceDAODefinition.java @@ -41,17 +41,26 @@ public class DeviceDAODefinition { public DeviceDAODefinition(Table table) { + if (table == null) { + throw new DeviceTypeDeployerPayloadException("Table is null. Cannot create DeviceDAODefinition"); + } deviceTableName = table.getName(); primarykey = table.getPrimaryKey(); - List attributes = table.getAttributes().getAttribute(); + if (deviceTableName == null || deviceTableName.isEmpty()) { throw new DeviceTypeDeployerPayloadException("Missing deviceTableName"); } if (primarykey == null || primarykey.isEmpty()) { - throw new DeviceTypeDeployerPayloadException("Missing primaryKey "); + throw new DeviceTypeDeployerPayloadException("Missing primaryKey for the table " + deviceTableName); } + if (table.getAttributes() == null) { + throw new DeviceTypeDeployerPayloadException("Table " + deviceTableName + " attributes are not specified. " + + "Cannot created DeviceDAODefinition"); + } + + List attributes = table.getAttributes().getAttribute(); if (attributes == null || attributes.size() == 0) { throw new DeviceTypeDeployerPayloadException("Missing Attributes "); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/exception/DeviceTypeDeployerPayloadException.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/exception/DeviceTypeDeployerPayloadException.java index b25547950e..87f862277c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/exception/DeviceTypeDeployerPayloadException.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/exception/DeviceTypeDeployerPayloadException.java @@ -26,20 +26,9 @@ public class DeviceTypeDeployerPayloadException extends RuntimeException { super(msg, nestedEx); } - public DeviceTypeDeployerPayloadException(String message, Throwable cause) { - super(message, cause); - } - public DeviceTypeDeployerPayloadException(String msg) { super(msg); } - public DeviceTypeDeployerPayloadException() { - super(); - } - - public DeviceTypeDeployerPayloadException(Throwable cause) { - super(cause); - } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/exception/DeviceTypeMgtPluginException.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/exception/DeviceTypeMgtPluginException.java index b1548eb65f..1919e88f42 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/exception/DeviceTypeMgtPluginException.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/exception/DeviceTypeMgtPluginException.java @@ -26,20 +26,4 @@ public class DeviceTypeMgtPluginException extends Exception{ super(msg, nestedEx); } - public DeviceTypeMgtPluginException(String message, Throwable cause) { - super(message, cause); - } - - public DeviceTypeMgtPluginException(String msg) { - super(msg); - } - - public DeviceTypeMgtPluginException() { - super(); - } - - public DeviceTypeMgtPluginException(Throwable cause) { - super(cause); - } - } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/file/FileSystemBasedLicenseManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/file/FileSystemBasedLicenseManager.java index 30878f924c..7d7da9891a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/file/FileSystemBasedLicenseManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/file/FileSystemBasedLicenseManager.java @@ -39,9 +39,15 @@ public class FileSystemBasedLicenseManager implements LicenseManager { String licenseConfigPath = PATH_MOBILE_PLUGIN_CONF_DIR + File.separator + deviceType + File.separator + "license.xml"; File licenseConfig = new File(licenseConfigPath); + + if (!licenseConfig.exists()) { + throw new LicenseManagementException( + "License file not found in the path for the device type " + deviceType); + } JAXBContext context = JAXBContext.newInstance(License.class); Unmarshaller unmarshaller = context.createUnmarshaller(); return (License) unmarshaller.unmarshal(licenseConfig); + } catch (JAXBException e) { throw new LicenseManagementException("Error occurred while un-marshalling license configuration " + "used for '" + deviceType + "' platform from file system", e); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/BaseExtensionsTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/BaseExtensionsTest.java index 8d69cac776..3ec819a10b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/BaseExtensionsTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/BaseExtensionsTest.java @@ -51,7 +51,7 @@ public class BaseExtensionsTest { @BeforeSuite public void init() throws RegistryException, IOException { ClassLoader classLoader = getClass().getClassLoader(); - URL resourceUrl = classLoader.getResource("license.rxt"); + URL resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "license.rxt"); String rxt = null; File carbonHome; if (resourceUrl != null) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerNegativeTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerNegativeTest.java new file mode 100644 index 0000000000..d2d9060d12 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerNegativeTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.extensions.device.type.template; + +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DataSource; +import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; +import org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; +import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException; +import org.wso2.carbon.device.mgt.extensions.utils.Utils; +import org.xml.sax.SAXException; + +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; +import java.io.File; +import java.io.IOException; +import java.net.URL; + +/** + * This class tests the negative scenarios in {@link DeviceTypeManager} initialization; + */ +public class DeviceTypeManagerNegativeTest { + private DeviceTypeConfiguration defectiveDeviceTypeConfiguration1; + private DeviceTypeConfiguration defectiveDeviceTypeConfiguration2; + private DeviceTypeConfiguration androidDeviceTypeConfiguration; + private DeviceTypeConfigIdentifier deviceTypeConfigIdentifier; + private final String DEFECTIVE_DEVICE_TYPE = "defectiveDeviceType"; + private final String TABLE_NAME = "DEFECTIVE_DEVICE"; + + @BeforeTest + public void setup() + throws SAXException, JAXBException, ParserConfigurationException, DeviceTypeConfigurationException, + IOException { + ClassLoader classLoader = getClass().getClassLoader(); + URL resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "defective-devicetype.xml"); + File configurationFile = null; + if (resourceUrl != null) { + configurationFile = new File(resourceUrl.getFile()); + } + if (configurationFile != null) { + defectiveDeviceTypeConfiguration1 = Utils.getDeviceTypeConfiguration(configurationFile.getAbsoluteFile()); + } + deviceTypeConfigIdentifier = new DeviceTypeConfigIdentifier(DEFECTIVE_DEVICE_TYPE, + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); + + resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "defective-devicetype2.xml"); + if (resourceUrl != null) { + configurationFile = new File(resourceUrl.getFile()); + } + if (configurationFile != null) { + defectiveDeviceTypeConfiguration2 = Utils.getDeviceTypeConfiguration(configurationFile.getAbsoluteFile()); + } + + resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "android.xml"); + if (resourceUrl != null) { + configurationFile = new File(resourceUrl.getFile()); + } + if (configurationFile != null) { + androidDeviceTypeConfiguration = Utils.getDeviceTypeConfiguration(configurationFile.getAbsoluteFile()); + } + } + + @Test(description = "This test case tests the behaviour of the DeviceTypeManager creation without defining the " + + "datasource but by specifying the table id", expectedExceptions = { DeviceTypeDeployerPayloadException + .class}, expectedExceptionsMessageRegExp = "Could not find the datasource related with the table id " + + TABLE_NAME + " for the device type " + DEFECTIVE_DEVICE_TYPE) + public void testWithoutDataSource() { + new DeviceTypeManager(deviceTypeConfigIdentifier, defectiveDeviceTypeConfiguration1); + + } + + @Test(description = "This test case tests the behaviour of the DeviceTypeManager creation without defining the " + + "table config",expectedExceptions = { DeviceTypeDeployerPayloadException.class}, + expectedExceptionsMessageRegExp = "Could not find the table config with the table id " + TABLE_NAME + + " for the device type " + DEFECTIVE_DEVICE_TYPE, + dependsOnMethods = {"testWithoutDataSource"}) + public void testWithoutTableConfig() { + DataSource dataSource = new DataSource(); + defectiveDeviceTypeConfiguration1.setDataSource(dataSource); + new DeviceTypeManager(deviceTypeConfigIdentifier, defectiveDeviceTypeConfiguration1); + } + + @Test(description = "This test case tests the behaviour of the DeviceTypeManager creation without defining the " + + "correct table as per the device details", + expectedExceptions = { DeviceTypeDeployerPayloadException.class}, + expectedExceptionsMessageRegExp = "Could not find definition for table: " + TABLE_NAME) + public void testWithoutTable() { + new DeviceTypeManager(deviceTypeConfigIdentifier, defectiveDeviceTypeConfiguration2); + } + + @Test(description = "This test case tests the behaviour of the DeviceTypeManager creation without having the " + + "actual datasource", expectedExceptions = {DeviceTypeDeployerPayloadException.class}, + expectedExceptionsMessageRegExp = "Error while looking up the data source.*") + public void testWithoutProperDataSource() { + new DeviceTypeManager(deviceTypeConfigIdentifier, androidDeviceTypeConfiguration); + } + + @Test(description = "This test case tests the behaviour of the DeviceTypeManager creation without having the " + + "actual datasource", expectedExceptions = {DeviceTypeDeployerPayloadException.class}, + expectedExceptionsMessageRegExp = "Error while looking up the data source.*") + public void testWithSetupParameters() { + System.setProperty("setup", "true"); + new DeviceTypeManager(deviceTypeConfigIdentifier, androidDeviceTypeConfiguration); + + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java index 286f21c931..f90d33bd34 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java @@ -124,7 +124,7 @@ public class DeviceTypeManagerServiceTest { operationMonitoringConfigs.set(rasberrypiDeviceTypeManagerService, new OperationMonitoringTaskConfig()); initialOperationConfig.set(rasberrypiDeviceTypeManagerService, new InitialOperationConfig()); - URL resourceUrl = classLoader.getResource("android.xml"); + URL resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "android.xml"); File androidConfiguration = null; if (resourceUrl != null) { @@ -132,7 +132,7 @@ public class DeviceTypeManagerServiceTest { } androidDeviceConfiguration = Utils.getDeviceTypeConfiguration(androidConfiguration); - resourceUrl = classLoader.getResource("raspberrypi.xml"); + resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "raspberrypi.xml"); File raspberrypiConfiguration = null; if (resourceUrl != null) { raspberrypiConfiguration = new File(resourceUrl.getFile()); @@ -304,7 +304,7 @@ public class DeviceTypeManagerServiceTest { throws RegistryException, IOException, SAXException, ParserConfigurationException, DeviceTypeConfigurationException, JAXBException { ClassLoader classLoader = getClass().getClassLoader(); - URL resourceUrl = classLoader.getResource("arduino.xml"); + URL resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "arduino.xml"); File arduinoConfiguration = null; if (resourceUrl != null) { arduinoConfiguration = new File(resourceUrl.getFile()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerTest.java index afdf2d560f..27ebd3f827 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerTest.java @@ -71,12 +71,13 @@ public class DeviceTypeManagerTest { private Field deviceTypePluginDAOField; private Field deviceTypeDAOHandlerField; private String[] customDeviceTypeProperties = {"custom_property", "custom_property2"}; + private final String SQL_FOLDER = "sql-files" + File.separator; @BeforeTest(description = "Mocking the classes for testing") public void setup() throws NoSuchFieldException, IllegalAccessException, IOException, SQLException, SAXException, ParserConfigurationException, DeviceTypeConfigurationException, JAXBException { ClassLoader classLoader = getClass().getClassLoader(); - URL resourceUrl = classLoader.getResource("android_h2.sql"); + URL resourceUrl = classLoader.getResource(SQL_FOLDER + "android_h2.sql"); androidDeviceType = "android"; File androidDatabaseScript = null; javax.sql.DataSource dataSource = null; @@ -85,7 +86,7 @@ public class DeviceTypeManagerTest { if (resourceUrl != null) { androidDatabaseScript = new File(resourceUrl.getFile()); } - resourceUrl = classLoader.getResource("android.xml"); + resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "android.xml"); if (resourceUrl != null) { androidConfiguration = new File(resourceUrl.getFile()); @@ -295,7 +296,7 @@ public class DeviceTypeManagerTest { private DeviceTypePluginDAOManager createPluginBasedDeviceTypeManager() throws IOException, SQLException, NoSuchFieldException, IllegalAccessException { ClassLoader classLoader = getClass().getClassLoader(); - URL resourceUrl = classLoader.getResource("h2.sql"); + URL resourceUrl = classLoader.getResource(SQL_FOLDER + "h2.sql"); File cdmDataScript = null; javax.sql.DataSource dataSource = null; if (resourceUrl != null) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java index 14e87a6703..7c4ff9ec2c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java @@ -24,6 +24,8 @@ 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.configuration.mgt.ConfigurationEntry; +import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; @@ -52,6 +54,7 @@ public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest { private HTTPDeviceTypeManagerService httpDeviceTypeManagerService; private DeviceTypeGeneratorServiceImpl deviceTypeGeneratorService; private String androidSenseDeviceType = "androidsense"; + private DeviceManagementService generatedDeviceManagementService; @BeforeTest public void setup() throws RegistryException, IOException, SAXException, ParserConfigurationException, @@ -83,12 +86,37 @@ public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest { @Test(description = "This test case tests the populate device management service method") public void testPopulateDeviceManagementService() { String sampleDeviceType = "sample"; - DeviceManagementService deviceManagementService = deviceTypeGeneratorService + generatedDeviceManagementService = deviceTypeGeneratorService .populateDeviceManagementService(sampleDeviceType, deviceTypeMetaDefinition); - Assert.assertEquals(deviceManagementService.getType(), sampleDeviceType, + Assert.assertEquals(generatedDeviceManagementService.getType(), sampleDeviceType, "DeviceTypeGeneration for the " + "sample device type failed"); } + @Test(description = "This test case tests the get configuration of the populated device management service though" + + " DeviceTypeGeneratorService", dependsOnMethods = {"testPopulateDeviceManagementService"}) + public void testGetConfiguration() throws DeviceManagementException, ClassNotFoundException, JAXBException { + PlatformConfiguration platformConfiguration = generatedDeviceManagementService.getDeviceManager() + .getConfiguration(); + Assert.assertNotNull(platformConfiguration, + "Default platform configuration is not added to sample device " + "type from the file system"); + + List configurationEntries = platformConfiguration.getConfiguration(); + Assert.assertNotNull(configurationEntries, + "Platform Configuration entries are not parsed and saved " + "correctly for device type sample"); + Assert.assertEquals(configurationEntries.size(), 1, + "Platform configuration is not saved correctly for " + "device type sample"); + + ConfigurationEntry configurationEntry = configurationEntries.get(0); + + Assert.assertEquals(configurationEntry.getName(), "test", + "Platform Configuration for device type " + "sample is not saved correctly"); + + String contentType = configurationEntry.getContentType(); + Assert.assertEquals(contentType, "String", + "Content type added in default platform configuration is different from the retrieved value"); + + } + @Test(description = "This test case tests the negative scenarios when saving the platform configurations", expectedExceptions = {DeviceManagementException.class}) @@ -126,7 +154,7 @@ public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest { throws SAXException, JAXBException, ParserConfigurationException, DeviceTypeConfigurationException, IOException { ClassLoader classLoader = getClass().getClassLoader(); - URL resourceUrl = classLoader.getResource("android_sense.xml"); + URL resourceUrl = classLoader.getResource(Utils.DEVICE_TYPE_FOLDER + "android_sense.xml"); File androidSenseConfiguration = null; if (resourceUrl != null) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceDAODefinitionNegativeTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceDAODefinitionNegativeTest.java new file mode 100644 index 0000000000..a96fb0d733 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceDAODefinitionNegativeTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.extensions.device.type.template.dao; + +import org.testng.annotations.Test; +import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Table; +import org.wso2.carbon.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException; + +/** + * This class tests the negative scenarios related with {@link DeviceDAODefinition} + */ +public class DeviceDAODefinitionNegativeTest { + private final String DEVICE_TABLE_NAME = "DEVICE_TABLE"; + + @Test(description = "This test case tests the behavior of the DeviceDAODefinition when the table is null", + expectedExceptions = { DeviceTypeDeployerPayloadException.class}, + expectedExceptionsMessageRegExp = "Table is null. Cannot create DeviceDAODefinition") + public void testWhenTableIsNull() { + new DeviceDAODefinition(null); + } + + @Test(description = "This test case tests the behavior of the DeviceDAODefinition when the table name is null", + expectedExceptions = { DeviceTypeDeployerPayloadException.class}, + expectedExceptionsMessageRegExp = "Missing deviceTableName") + public void testWhenTableNameIsNull() { + new DeviceDAODefinition(new Table()); + } + + @Test(description = "This test case tests the behavior of the DeviceDAODefinition when the primary key is null", + expectedExceptions = { DeviceTypeDeployerPayloadException.class}, + expectedExceptionsMessageRegExp = "Missing primaryKey for the table " + DEVICE_TABLE_NAME) + public void testWhenPrimaryKeyIsEmpty() { + Table deviceTable = new Table(); + deviceTable.setName(DEVICE_TABLE_NAME); + deviceTable.setPrimaryKey(""); + new DeviceDAODefinition(deviceTable); + } + + @Test(description = "This test case tests the behavior of the DeviceDAODefinition when the attributes is null", + expectedExceptions = { DeviceTypeDeployerPayloadException.class}, + expectedExceptionsMessageRegExp = "Table " + DEVICE_TABLE_NAME + " attributes are not specified. " + + "Cannot created DeviceDAODefinition") + public void testWhenAttributesIsNull() { + Table deviceTable = new Table(); + deviceTable.setName(DEVICE_TABLE_NAME); + deviceTable.setPrimaryKey("primaryKey"); + new DeviceDAODefinition(deviceTable); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java index 0e6c37cd1b..d35b8eba93 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java @@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.extensions.utils; import org.h2.jdbcx.JdbcDataSource; import org.w3c.dom.Document; -import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceDetails; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; @@ -56,16 +55,18 @@ import java.util.List; * This class handles the test utility tasks. */ public class Utils { + public static final String DEVICE_TYPE_FOLDER = "device-types" + File.separator; /** * To get the device type configuration based on the configuration file + * * @param configurationFile Relevant configuration file of a device type * @return the DeviceTypeConfiguration object of the relevant Device Type * @throws DeviceTypeConfigurationException DeviceType Configuration Exception - * @throws IOException IO Exception - * @throws SAXException SAX Exception - * @throws ParserConfigurationException Parser Configuration Exception - * @throws JAXBException JAXB Exception + * @throws IOException IO Exception + * @throws SAXException SAX Exception + * @throws ParserConfigurationException Parser Configuration Exception + * @throws JAXBException JAXB Exception */ public static DeviceTypeConfiguration getDeviceTypeConfiguration(File configurationFile) throws DeviceTypeConfigurationException, IOException, SAXException, ParserConfigurationException, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/UtilsTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/UtilsTest.java new file mode 100644 index 0000000000..01651d3b2c --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/UtilsTest.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.wso2.carbon.device.mgt.extensions.utils; + +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.device.mgt.common.license.mgt.License; +import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; +import org.wso2.carbon.device.mgt.extensions.device.type.template.util.DeviceSchemaInitializer; +import org.wso2.carbon.device.mgt.extensions.license.mgt.file.FileSystemBasedLicenseManager; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * This is a test case for testing common utilities used. + */ +public class UtilsTest { + private FileSystemBasedLicenseManager fileSystemBasedLicenseManager; + + @BeforeTest + public void setup() { + fileSystemBasedLicenseManager = new FileSystemBasedLicenseManager(); + } + + @Test(description = "This testcase tests the functionality of the DeviceSchemaInitializer") + public void testDeviceSchemaInitializer() + throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + String deviceType = "sample2"; + String expectedDBLocation = + System.getProperty("carbon.home") + File.separator + "dbscripts" + File.separator + "cdm" + + File.separator + "plugins" + File.separator + deviceType + File.separator + "h2.sql"; + DeviceSchemaInitializer deviceSchemaInitializer = new DeviceSchemaInitializer(null, deviceType, + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); + Method getDbScriptLocation = DeviceSchemaInitializer.class + .getDeclaredMethod("getDbScriptLocation", String.class); + getDbScriptLocation.setAccessible(true); + + String dbLocation = (String) getDbScriptLocation.invoke(deviceSchemaInitializer, "h2"); + Assert.assertEquals(dbLocation, expectedDBLocation, + "Expected DB location for the device type is not retrieved"); + } + + @Test(description = "This test case tests the getLicense method of the FileBasedLicenseManager") + public void testFileBasedLicenseManagerGetLicense() throws LicenseManagementException { + License fileBasedLicense = fileSystemBasedLicenseManager.getLicense("test","en_US"); + Assert.assertEquals(fileBasedLicense.getText(), "This is a file based license", + "FileBased License cannot " + "be retrieved by FileBasedLicenseManager"); + } + + @Test(description = "This test case tests the behaviour of file based license manager when the relevant license " + + "is missing in file system", expectedExceptions = {LicenseManagementException.class}, + expectedExceptionsMessageRegExp = "License file not found in the path for the device type test2") + public void testFileBasedLicenseManagerGetNonExistingLicense() throws LicenseManagementException { + fileSystemBasedLicenseManager.getLicense("test2","en_US"); + } + + @Test(description = "This test case make sure the File Based License cannot be added without adding directly to " + + "file system", expectedExceptions = {UnsupportedOperationException.class}, + expectedExceptionsMessageRegExp = "'addLicense' method is not supported in FileSystemBasedLicenseManager") + public void testFileBasedLicenseManagerAddLicense() throws LicenseManagementException { + fileSystemBasedLicenseManager.addLicense("test", null); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugin-configs/mobile/sample-default-platform-configuration.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugin-configs/mobile/sample-default-platform-configuration.xml new file mode 100644 index 0000000000..5c529cdfa9 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugin-configs/mobile/sample-default-platform-configuration.xml @@ -0,0 +1,28 @@ + + + + + + sample + + test + String + test + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugins/test/license.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugins/test/license.xml new file mode 100644 index 0000000000..7bf018734d --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/carbon-home/repository/conf/etc/device-mgt-plugins/test/license.xml @@ -0,0 +1,25 @@ + + + + + + en_US + 1.0.0 + This is a file based license + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android.xml similarity index 99% rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android.xml rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android.xml index 2cc394bde1..176469c329 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android.xml @@ -378,4 +378,4 @@ admin - \ No newline at end of file + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android_sense.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android_sense.xml similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android_sense.xml rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/android_sense.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/arduino.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/arduino.xml rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/arduino.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype.xml new file mode 100644 index 0000000000..965b0cebe2 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype.xml @@ -0,0 +1,45 @@ + + + + + + + + + Control Bulb + Control Bulb on Arduino Uno + + + state + + + + + + + true + + + + en_US + 1.0.0 + This is license text + + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype2.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype2.xml new file mode 100644 index 0000000000..0f1baff1c3 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/defective-devicetype2.xml @@ -0,0 +1,55 @@ + + + + + + + + + Control Bulb + Control Bulb on Arduino Uno + + + state + + + + + + + true + + + + en_US + 1.0.0 + This is license text + + + + + jdbc/MobileAndroidDM_DS + + +
+
+ + + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/license.rxt b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/license.rxt similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/license.rxt rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/license.rxt diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/raspberrypi.xml similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/raspberrypi.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sample.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/sample.xml similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sample.xml rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/device-types/sample.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android_h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/android_h2.sql similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android_h2.sql rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/android_h2.sql diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/h2.sql rename to components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml index bad5807be5..661e7dd0dd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml @@ -27,6 +27,9 @@ + + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index d616157b5b..c94355c05a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml index 55b9b413a0..44baf1e12a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 1447e59de1..8279ba84bb 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml index 9c8030a8a0..37334ce113 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml +++ b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt email-sender - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index 68fa5cfb1b..4c286a55a5 100644 --- a/components/email-sender/pom.xml +++ b/components/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 00ff564357..45f3f74bab 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt identity-extensions - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - OAuth Extensions http://wso2.org diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index 20b7f3d80b..b98507012b 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -21,7 +21,7 @@ identity-extensions org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT 4.0.0 diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index d94ac07588..a9708b0ca4 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt identity-extensions - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index f952379a24..7a3972043a 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml index 0d297c0d0d..a43f8297da 100644 --- a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml index 26d5ae38bd..a4c9c0030b 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml index 28ebbcf36d..16e0a82deb 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - Policy Information Point WSO2 Carbon - Policy Information Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml index f22cec1ec8..4001a47c83 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - Policy Management Common WSO2 Carbon - Policy Management Common diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index 09b34abf72..26fd5a1092 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - Policy Management Core WSO2 Carbon - Policy Management Core diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index d42f5e2a62..c5b76bd985 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Policy Management Component http://wso2.org diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index 58452b360a..3e8fc1f0a6 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -21,7 +21,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index b9afaa585d..bd1e715a90 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT bundle WSO2 Carbon - Web Application Authenticator Framework Bundle WSO2 Carbon - Web Application Authenticator Framework Bundle diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 6201086289..1c5a5bc71a 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml index bc7912ba3d..39f3e3479f 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - API Management Application Extension Feature http://wso2.org This feature contains an implementation of a api application registration, which takes care of subscription diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml index 77733405e0..894b0220ef 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Device Management - APIM handler Server Feature http://wso2.org This feature contains the handler for the api authentications diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml index e63b464f95..d148f95eb8 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client.feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - APIM Integration Client Feature http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml index 5f780a27b8..90f12d11d9 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - API Management Webapp Publisher Feature http://wso2.org This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index e12507cd7b..64a0d41f02 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - API Management Extensions Feature http://wso2.org diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml index a0a215c540..ce6f4b6892 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml index 334cf576ab..fa7cc6356f 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml index d52cb89081..a43a5c6c21 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Certificate Management Server Feature http://wso2.org This feature contains the core bundles required for back-end Certificate Management functionality diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 6962f9717a..7f223467b9 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Certificate Management Feature http://wso2.org diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml index 84729b9399..6bf05938df 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Device Type Deployer Feature http://wso2.org WSO2 Carbon - Device Type Deployer Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index a63a9e4244..e0089d0ba0 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - FCM Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index 628f7c59ee..9282df27a5 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 05a3dfefc8..02f8d3ef3b 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 228f9b0602..f865c25282 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - XMPP Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - XMPP Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 1b114594ff..90f7337b02 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml index ec0c7b1275..3cb996ea36 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml @@ -3,13 +3,13 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.dashboard.feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Device Management Dashboard Analytics Feature WSO2 Carbon - Device Management Dashboard Analytics Feature diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml index 793e87f256..47710df31d 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains bundles related to device analytics data publisher diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index a2b9f70824..2f25904970 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml index 2c23263529..a4845e313f 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml @@ -4,14 +4,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Device Management Extensions Feature http://wso2.org This feature contains common extensions used by key device management functionalities diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml index 83281047a8..c499f0412c 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index 8f8945c9c9..91be7223c1 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml index fe78ac9b6f..7e8c9277c7 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 2a1271ccae..d187192cc6 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml diff --git a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml index 4ba961f3ec..a2375ade50 100644 --- a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml +++ b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt email-sender-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Email Sender Feature http://wso2.org This feature contains the core bundles required for email sender related functionality diff --git a/features/email-sender/pom.xml b/features/email-sender/pom.xml index 626af78f98..55053ea96f 100644 --- a/features/email-sender/pom.xml +++ b/features/email-sender/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Email Sender Feature http://wso2.org diff --git a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml index 0c9f4ba403..ca45a07d2e 100644 --- a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt jwt-client-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - JWT Client Feature http://wso2.org This feature contains jwt client implementation from which we can get a access token using the jwt diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index f6c78fe577..47651391bd 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - JWT Client Extension Feature http://wso2.org diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index 31d8442fd5..da49df8ef1 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt oauth-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Device Mgt OAuth Extensions Feature http://wso2.org This feature contains devicemgt related OAuth extensions diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml index 6357534bac..94fc7aa6b5 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Device Management OAuth Extensions Feature http://wso2.org diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml index 90dcde94de..fe9757029b 100644 --- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt policy-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Policy Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 025bee5168..cfabc157e2 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Policy Management Feature http://wso2.org diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml index 7833d95537..61e9b404e0 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Webapp Authenticator Framework Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 59b8d17ec6..15080cb002 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 9e717e6e2c..2707c9fc48 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1851,7 +1851,7 @@ 1.2.11.wso2v10 - 3.0.124-SNAPSHOT + 3.0.131-SNAPSHOT 4.4.8