Merge branch 'wso2-master' into origin-wso2-master

revert-70aa11f8
sinthuja 7 years ago
commit 50eea6f804

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Annotations</name>
<description>WSO2 Carbon - API Management Custom Annotation Module</description>

@ -21,12 +21,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId>
<packaging>war</packaging>
<name>WSO2 Carbon - API Application Management API</name>

@ -22,12 +22,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Application Management</name>

@ -21,13 +21,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handlers</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Security Handler Component</name>
<description>WSO2 Carbon - API Management Security Handler Module</description>

@ -13,13 +13,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Client</name>
<description>WSO2 Carbon - API Management Integration Client</description>

@ -13,13 +13,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.generated.client</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Generated Client</name>
<description>WSO2 Carbon - API Management Integration Client</description>

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apimgt-extensions</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Certificate Management Core</name>
<description>WSO2 Carbon - Certificate Management Core</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,7 +21,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -229,10 +229,7 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
@ -359,6 +356,10 @@
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
</dependency>
</dependencies>
</project>

@ -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());

@ -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";

@ -1741,6 +1741,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
if (requireDeviceInfo) {
this.getAllDeviceInfo(userDevices);
}
devices.addAll(userDevices);
}
return devices;
}

@ -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();

@ -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);

@ -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<GeoFence> 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<GeoFence> 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!");
}
}
}

@ -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<Device> 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();
}
}

@ -42,6 +42,7 @@
<class name="org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderServiceTest"/>
<class name="org.wso2.carbon.device.mgt.core.service.GroupManagementProviderServiceTest"/>
<class name="org.wso2.carbon.device.mgt.core.operation.OperationManagementTests"/>
<class name="org.wso2.carbon.device.mgt.core.geo.service.GeoLocationProviderServiceTest"/>
<class name="org.wso2.carbon.device.mgt.core.operation.ScheduledTaskOperationTests"/>
<class name="org.wso2.carbon.device.mgt.core.permission.mgt.PermissionManagerServiceTest" />
<class name="org.wso2.carbon.device.mgt.core.notification.mgt.NotificationManagementServiceImplTests"/>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -96,6 +96,12 @@
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.registry.extensions</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>
@ -106,6 +112,14 @@
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

@ -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<Table> tables = deviceTypeConfiguration.getDataSource().getTableConfig().getTable();
Table deviceDefinitionTable = null;
for (Table table : tables) {

@ -22,32 +22,9 @@ 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);
}
}

@ -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);
}
}

@ -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<String> 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<String> attributes = table.getAttributes().getAttribute();
if (attributes == null || attributes.size() == 0) {
throw new DeviceTypeDeployerPayloadException("Missing Attributes ");
}

@ -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);
}
}

@ -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);
}
}

@ -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);

@ -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) {

@ -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);
}
}

@ -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());

@ -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) {

@ -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<ConfigurationEntry> 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) {

@ -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);
}
}

@ -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,9 +55,11 @@ 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

@ -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);
}
}

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<PlatformConfiguration>
<type>sample</type>
<configuration>
<name>test</name>
<contentType>String</contentType>
<value>test</value>
</configuration>
</PlatformConfiguration>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<License>
<Language>en_US</Language>
<Version>1.0.0</Version>
<Text>This is a file based license</Text>
</License>

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<DeviceTypeConfiguration name="defective-devicetype">
<DeviceDetails table-id="DEFECTIVE_DEVICE"/>
<Features>
<Feature code="bulb">
<Name>Control Bulb</Name>
<Description>Control Bulb on Arduino Uno</Description>
<Operation context="/arduino/device/{deviceId}/bulb" method="POST">
<QueryParameters>
<Parameter>state</Parameter>
</QueryParameters>
</Operation>
</Feature>
</Features>
<ProvisioningConfig>
<SharedWithAllTenants>true</SharedWithAllTenants>
</ProvisioningConfig>
<License>
<Language>en_US</Language>
<Version>1.0.0</Version>
<Text>This is license text</Text>
</License>
</DeviceTypeConfiguration>

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<DeviceTypeConfiguration name="defective-devicetype">
<DeviceDetails table-id="DEFECTIVE_DEVICE"/>
<Features>
<Feature code="bulb">
<Name>Control Bulb</Name>
<Description>Control Bulb on Arduino Uno</Description>
<Operation context="/arduino/device/{deviceId}/bulb" method="POST">
<QueryParameters>
<Parameter>state</Parameter>
</QueryParameters>
</Operation>
</Feature>
</Features>
<ProvisioningConfig>
<SharedWithAllTenants>true</SharedWithAllTenants>
</ProvisioningConfig>
<License>
<Language>en_US</Language>
<Version>1.0.0</Version>
<Text>This is license text</Text>
</License>
<DataSource>
<JndiConfig>
<Name>jdbc/MobileAndroidDM_DS</Name>
</JndiConfig>
<TableConfig>
<Table name="AD_DEVICE">
</Table>
</TableConfig>
</DataSource>
</DeviceTypeConfiguration>

@ -27,6 +27,9 @@
<class name="org.wso2.carbon.device.mgt.extensions.device.type.template.DeviceTypeManagerServiceTest"/>
<class name="org.wso2.carbon.device.mgt.extensions.device.type.template.DeviceTypeManagerTest"/>
<class name="org.wso2.carbon.device.mgt.extensions.device.type.template.HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest"/>
<class name="org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceDAODefinitionNegativeTest"/>
<class name="org.wso2.carbon.device.mgt.extensions.device.type.template.DeviceTypeManagerNegativeTest" />
<class name="org.wso2.carbon.device.mgt.extensions.utils.UtilsTest" />
</classes>
</test>
</suite>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -23,7 +23,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - OAuth Extensions</name>
<url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent>
<artifactId>identity-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,14 +3,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.decision.point</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Information Point</name>
<description>WSO2 Carbon - Policy Information Point</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Common</name>
<description>WSO2 Carbon - Policy Management Common</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Core</name>
<description>WSO2 Carbon - Policy Management Core</description>

@ -23,13 +23,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>policy-mgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Component</name>
<url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Web Application Authenticator Framework Bundle</name>
<description>WSO2 Carbon - Web Application Authenticator Framework Bundle</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Webapp Authenticator Framework</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.application.extension.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Application Extension Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a api application registration, which takes care of subscription

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handler.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management - APIM handler Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the handler for the api authentications

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client.feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - APIM Integration Client Feature</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Webapp Publisher Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Feature</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - Certificate Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for back-end Certificate Management functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - Device Type Deployer Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - Device Type Deployer Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - FCM Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - XMPP Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - XMPP Based Push Notification Provider Feature</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -3,13 +3,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.dashboard.feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Device Management Dashboard Analytics Feature</name>
<description>WSO2 Carbon - Device Management Dashboard Analytics Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains bundles related to device analytics data publisher</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -4,14 +4,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains common extensions used by key device management functionalities

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.124-SNAPSHOT</version>
<version>3.0.131-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save