Resolving conflicts

merge-requests/1/head
Ace 7 years ago
commit 367a285d62

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -63,7 +63,8 @@ public interface OperationManager {
* @throws OperationManagementException If some unusual behaviour is observed while fetching the * @throws OperationManagementException If some unusual behaviour is observed while fetching the
* operation list. * operation list.
*/ */
PaginationResult getOperations(DeviceIdentifier deviceId, PaginationRequest request) throws OperationManagementException; PaginationResult getOperations(DeviceIdentifier deviceId, PaginationRequest request)
throws OperationManagementException;
/** /**
* Method to retrieve the list of available operations to a device. * Method to retrieve the list of available operations to a device.
@ -73,15 +74,12 @@ public interface OperationManager {
* @throws OperationManagementException If some unusual behaviour is observed while fetching the * @throws OperationManagementException If some unusual behaviour is observed while fetching the
* operation list. * operation list.
*/ */
List<? extends Operation> getPendingOperations( List<? extends Operation> getPendingOperations(DeviceIdentifier deviceId) throws OperationManagementException;
DeviceIdentifier deviceId) throws OperationManagementException;
Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException; Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException;
void updateOperation(DeviceIdentifier deviceId, Operation operation) throws OperationManagementException; void updateOperation(DeviceIdentifier deviceId, Operation operation) throws OperationManagementException;
void deleteOperation(int operationId) throws OperationManagementException;
Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId, int operationId) Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId, int operationId)
throws OperationManagementException; throws OperationManagementException;
@ -93,9 +91,8 @@ public interface OperationManager {
Activity getOperationByActivityId(String activity) throws OperationManagementException; Activity getOperationByActivityId(String activity) throws OperationManagementException;
Activity getOperationByActivityIdAndDevice(String activity, DeviceIdentifier deviceId) throws OperationManagementException; Activity getOperationByActivityIdAndDevice(String activity, DeviceIdentifier deviceId)
throws OperationManagementException;
List<Operation> getOperationUpdatedAfter(long timestamp) throws OperationManagementException;
List<Activity> getActivitiesUpdatedAfter(long timestamp) throws OperationManagementException; List<Activity> getActivitiesUpdatedAfter(long timestamp) throws OperationManagementException;
@ -103,12 +100,6 @@ public interface OperationManager {
int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementException; int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementException;
/**
* Operation manger implementation can have a push notification stratergy
* @param notificationStrategy eg: mqtt/xmpp
*/
void setNotificationStrategy(NotificationStrategy notificationStrategy);
/** /**
* retrive the push notification strategy. * retrive the push notification strategy.
* @return NotificationStrategy * @return NotificationStrategy

@ -22,7 +22,7 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<version>3.0.115-SNAPSHOT</version> <version>3.0.118-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -221,6 +221,14 @@
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.core</artifactId> <artifactId>org.wso2.carbon.user.core</artifactId>

@ -50,11 +50,9 @@ public class NotificationManagementServiceImpl implements NotificationManagement
private static final Log log = LogFactory.getLog(NotificationManagementServiceImpl.class); private static final Log log = LogFactory.getLog(NotificationManagementServiceImpl.class);
private NotificationDAO notificationDAO; private NotificationDAO notificationDAO;
private DeviceDAO deviceDAO;
public NotificationManagementServiceImpl() { public NotificationManagementServiceImpl() {
this.notificationDAO = NotificationManagementDAOFactory.getNotificationDAO(); this.notificationDAO = NotificationManagementDAOFactory.getNotificationDAO();
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
} }
@Override @Override

@ -1,22 +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.core.operation.mgt;
public interface OperationManagementServiceProvider {
}

@ -105,10 +105,6 @@ public class OperationManagerImpl implements OperationManager {
return notificationStrategy; return notificationStrategy;
} }
public void setNotificationStrategy(NotificationStrategy notificationStrategy) {
this.notificationStrategy = notificationStrategy;
}
public OperationManagerImpl(String deviceType, NotificationStrategy notificationStrategy) { public OperationManagerImpl(String deviceType, NotificationStrategy notificationStrategy) {
this(deviceType); this(deviceType);
this.notificationStrategy = notificationStrategy; this.notificationStrategy = notificationStrategy;
@ -122,7 +118,7 @@ public class OperationManagerImpl implements OperationManager {
log.debug("operation:[" + operation.toString() + "]"); log.debug("operation:[" + operation.toString() + "]");
for (DeviceIdentifier deviceIdentifier : deviceIds) { for (DeviceIdentifier deviceIdentifier : deviceIds) {
log.debug("device identifier id:[" + deviceIdentifier.getId() + "] type:[" + log.debug("device identifier id:[" + deviceIdentifier.getId() + "] type:[" +
deviceIdentifier.getType() + "]"); deviceIdentifier.getType() + "]");
} }
} }
try { try {
@ -137,7 +133,7 @@ public class OperationManagerImpl implements OperationManager {
//Send the operation statuses only for admin triggered operations //Send the operation statuses only for admin triggered operations
String deviceType = validDeviceIds.get(0).getType(); String deviceType = validDeviceIds.get(0).getType();
activity.setActivityStatus(this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult, activity.setActivityStatus(this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult,
deviceType)); deviceType));
return activity; return activity;
} }
@ -160,7 +156,7 @@ public class OperationManagerImpl implements OperationManager {
boolean hasExistingTaskOperation; boolean hasExistingTaskOperation;
int enrolmentId; int enrolmentId;
if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT == operationDto. if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT == operationDto.
getControl()) { getControl()) {
isNotRepeated = true; isNotRepeated = true;
} }
@ -177,10 +173,10 @@ public class OperationManagerImpl implements OperationManager {
} }
} else if (isNotRepeated) { } else if (isNotRepeated) {
operationDAO.updateEnrollmentOperationsStatus(enrolmentId, operationCode, operationDAO.updateEnrollmentOperationsStatus(enrolmentId, operationCode,
org.wso2.carbon.device.mgt.core.dto.operation.mgt. org.wso2.carbon.device.mgt.core.dto.operation.mgt.
Operation.Status.PENDING, Operation.Status.PENDING,
org.wso2.carbon.device.mgt.core.dto.operation.mgt. org.wso2.carbon.device.mgt.core.dto.operation.mgt.
Operation.Status.REPEATED); Operation.Status.REPEATED);
operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled); operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
} else { } else {
operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled); operationMappingDAO.addOperationMapping(operationId, enrolmentId, isScheduled);
@ -200,8 +196,8 @@ public class OperationManagerImpl implements OperationManager {
operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.COMPLETED); operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.COMPLETED);
} catch (PushNotificationExecutionFailedException e) { } catch (PushNotificationExecutionFailedException e) {
log.error("Error occurred while sending push notifications to " + log.error("Error occurred while sending push notifications to " +
deviceId.getType() + " device carrying id '" + deviceId.getType() + " device carrying id '" +
deviceId + "'", e); deviceId + "'", e);
// Reschedule if push notification failed. // Reschedule if push notification failed.
operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED); operationMappingDAO.updateOperationMapping(operationId, enrolmentId, org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED);
} }
@ -219,7 +215,7 @@ public class OperationManagerImpl implements OperationManager {
//Get the device-type from 1st valid DeviceIdentifier. We know the 1st element is definitely there. //Get the device-type from 1st valid DeviceIdentifier. We know the 1st element is definitely there.
String deviceType = validDeviceIds.get(0).getType(); String deviceType = validDeviceIds.get(0).getType();
activity.setActivityStatus(this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult, activity.setActivityStatus(this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult,
deviceType)); deviceType));
} }
return activity; return activity;
} else { } else {
@ -242,7 +238,7 @@ public class OperationManagerImpl implements OperationManager {
//Add the invalid DeviceIds //Add the invalid DeviceIds
for (String id : deviceIdValidationResult.getErrorDeviceIdList()) { for (String id : deviceIdValidationResult.getErrorDeviceIdList()) {
activityStatus = new ActivityStatus(); activityStatus = new ActivityStatus();
activityStatus.setDeviceIdentifier(new DeviceIdentifier(id,deviceType)); activityStatus.setDeviceIdentifier(new DeviceIdentifier(id, deviceType));
activityStatus.setStatus(ActivityStatus.Status.INVALID); activityStatus.setStatus(ActivityStatus.Status.INVALID);
activityStatuses.add(activityStatus); activityStatuses.add(activityStatus);
} }
@ -288,7 +284,7 @@ public class OperationManagerImpl implements OperationManager {
} }
} catch (DeviceAccessAuthorizationException e) { } catch (DeviceAccessAuthorizationException e) {
throw new OperationManagementException("Error occurred while authorizing access to the devices for user :" + throw new OperationManagementException("Error occurred while authorizing access to the devices for user :" +
this.getUser(), e); this.getUser(), e);
} }
deviceIDHolder.setValidDeviceIDList(authorizedDeviceList); deviceIDHolder.setValidDeviceIDList(authorizedDeviceList);
deviceIDHolder.setErrorDeviceIdList(unAuthorizedDeviceList); deviceIDHolder.setErrorDeviceIdList(unAuthorizedDeviceList);
@ -310,8 +306,8 @@ public class OperationManagerImpl implements OperationManager {
if (!isActionAuthorized(deviceId)) { if (!isActionAuthorized(deviceId)) {
throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" + throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" +
deviceId.getType() + "' device, which carries the identifier '" + deviceId.getType() + "' device, which carries the identifier '" +
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
@ -331,8 +327,8 @@ public class OperationManagerImpl implements OperationManager {
} }
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the list of " + throw new OperationManagementException("Error occurred while retrieving the list of " +
"operations assigned for '" + deviceId.getType() + "operations assigned for '" + deviceId.getType() +
"' device '" + deviceId.getId() + "'", e); "' device '" + deviceId.getId() + "'", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException( throw new OperationManagementException(
"Error occurred while opening a connection to the data source", e); "Error occurred while opening a connection to the data source", e);
@ -350,15 +346,15 @@ public class OperationManagerImpl implements OperationManager {
String owner = request.getOwner(); String owner = request.getOwner();
if (!isActionAuthorized(deviceId)) { if (!isActionAuthorized(deviceId)) {
throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" + throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" +
deviceId.getType() + "' device, which carries the identifier '" + deviceId.getType() + "' device, which carries the identifier '" +
deviceId.getId() + "' of owner '" + owner + "'" ); deviceId.getId() + "' of owner '" + owner + "'");
} }
EnrolmentInfo enrolmentInfo = this.getEnrolmentInfo(deviceId, owner); EnrolmentInfo enrolmentInfo = this.getEnrolmentInfo(deviceId, owner);
if (enrolmentInfo == null) { if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for given device " + throw new OperationManagementException("Device not found for given device " +
"Identifier:" + deviceId.getId() + " and given type" + "Identifier:" + deviceId.getId() + " and given type" +
deviceId.getType()); deviceId.getType());
} }
int enrolmentId = enrolmentInfo.getId(); int enrolmentId = enrolmentInfo.getId();
try { try {
@ -376,8 +372,8 @@ public class OperationManagerImpl implements OperationManager {
paginationResult.setRecordsFiltered(count); paginationResult.setRecordsFiltered(count);
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the list of " + throw new OperationManagementException("Error occurred while retrieving the list of " +
"operations assigned for '" + deviceId.getType() + "operations assigned for '" + deviceId.getType() +
"' device '" + deviceId.getId() + "'", e); "' device '" + deviceId.getId() + "'", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException( throw new OperationManagementException(
"Error occurred while opening a connection to the data source", e); "Error occurred while opening a connection to the data source", e);
@ -390,7 +386,7 @@ public class OperationManagerImpl implements OperationManager {
@Override @Override
public List<? extends Operation> getPendingOperations(DeviceIdentifier deviceId) throws public List<? extends Operation> getPendingOperations(DeviceIdentifier deviceId) throws
OperationManagementException { OperationManagementException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Device identifier id:[" + deviceId.getId() + "] type:[" + deviceId.getType() + "]"); log.debug("Device identifier id:[" + deviceId.getId() + "] type:[" + deviceId.getType() + "]");
} }
@ -399,16 +395,16 @@ public class OperationManagerImpl implements OperationManager {
if (!isActionAuthorized(deviceId)) { if (!isActionAuthorized(deviceId)) {
throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" + throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" +
deviceId.getType() + "' device, which carries the identifier '" + deviceId.getType() + "' device, which carries the identifier '" +
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
// //
EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentInfo == null) { if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for the given device Identifier:" + throw new OperationManagementException("Device not found for the given device Identifier:" +
deviceId.getId() + " and given type:" + deviceId.getId() + " and given type:" +
deviceId.getType()); deviceId.getType());
} }
int enrolmentId = enrolmentInfo.getId(); int enrolmentId = enrolmentInfo.getId();
//Changing the enrollment status & attempt count if the device is marked as inactive or unreachable //Changing the enrollment status & attempt count if the device is marked as inactive or unreachable
@ -437,8 +433,8 @@ public class OperationManagerImpl implements OperationManager {
Collections.sort(operations, new OperationCreateTimeComparator()); Collections.sort(operations, new OperationCreateTimeComparator());
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the list of " + throw new OperationManagementException("Error occurred while retrieving the list of " +
"pending operations assigned for '" + deviceId.getType() + "pending operations assigned for '" + deviceId.getType() +
"' device '" + deviceId.getId() + "'", e); "' device '" + deviceId.getId() + "'", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException( throw new OperationManagementException(
"Error occurred while opening a connection to the data source", e); "Error occurred while opening a connection to the data source", e);
@ -457,15 +453,15 @@ public class OperationManagerImpl implements OperationManager {
if (!isActionAuthorized(deviceId)) { if (!isActionAuthorized(deviceId)) {
throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" + throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" +
deviceId.getType() + "' device, which carries the identifier '" + deviceId.getType() + "' device, which carries the identifier '" +
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentInfo == null) { if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for given device " + throw new OperationManagementException("Device not found for given device " +
"Identifier:" + deviceId.getId() + " and given type" + "Identifier:" + deviceId.getId() + " and given type" +
deviceId.getType()); deviceId.getType());
} }
int enrolmentId = enrolmentInfo.getId(); int enrolmentId = enrolmentInfo.getId();
//Changing the enrollment status & attempt count if the device is marked as inactive or unreachable //Changing the enrollment status & attempt count if the device is marked as inactive or unreachable
@ -479,23 +475,23 @@ public class OperationManagerImpl implements OperationManager {
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.getNextOperation( org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.getNextOperation(
enrolmentInfo.getId()); enrolmentInfo.getId());
if (dtoOperation != null) { if (dtoOperation != null) {
if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND.equals(dtoOperation.getType() if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND.equals(dtoOperation.getType()
)) { )) {
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
commandOperation = commandOperation =
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. (org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
getOperation(dtoOperation.getId()); getOperation(dtoOperation.getId());
dtoOperation.setEnabled(commandOperation.isEnabled()); dtoOperation.setEnabled(commandOperation.isEnabled());
} else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG.equals(dtoOperation. } else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG.equals(dtoOperation.
getType())) { getType())) {
dtoOperation = configOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = configOperationDAO.getOperation(dtoOperation.getId());
} else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE.equals(dtoOperation. } else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE.equals(dtoOperation.
getType())) { getType())) {
dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId());
} else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY.equals(dtoOperation. } else if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY.equals(dtoOperation.
getType())) { getType())) {
dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId());
} }
operation = OperationDAOUtil.convertOperation(dtoOperation); operation = OperationDAOUtil.convertOperation(dtoOperation);
@ -520,15 +516,15 @@ public class OperationManagerImpl implements OperationManager {
if (!isActionAuthorized(deviceId)) { if (!isActionAuthorized(deviceId)) {
throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" + throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" +
deviceId.getType() + "' device, which carries the identifier '" + deviceId.getType() + "' device, which carries the identifier '" +
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentInfo == null) { if (enrolmentInfo == null) {
throw new OperationManagementException( throw new OperationManagementException(
"Device not found for device id:" + deviceId.getId() + " " + "type:" + "Device not found for device id:" + deviceId.getId() + " " + "type:" +
deviceId.getType()); deviceId.getType());
} }
try { try {
@ -537,9 +533,9 @@ public class OperationManagerImpl implements OperationManager {
boolean isUpdated = false; boolean isUpdated = false;
if (operation.getStatus() != null) { if (operation.getStatus() != null) {
isUpdated = operationDAO.updateOperationStatus(enrolmentId, operationId, isUpdated = operationDAO.updateOperationStatus(enrolmentId, operationId,
org.wso2.carbon.device.mgt.core.dto.operation.mgt. org.wso2.carbon.device.mgt.core.dto.operation.mgt.
Operation.Status.valueOf(operation.getStatus(). Operation.Status.valueOf(operation.getStatus().
toString())); toString()));
} }
if (operation.getOperationResponse() != null) { if (operation.getOperationResponse() != null) {
operationDAO.addOperationResponse(enrolmentId, operationId, operation.getOperationResponse()); operationDAO.addOperationResponse(enrolmentId, operationId, operation.getOperationResponse());
@ -549,28 +545,7 @@ public class OperationManagerImpl implements OperationManager {
OperationManagementDAOFactory.rollbackTransaction(); OperationManagementDAOFactory.rollbackTransaction();
throw new OperationManagementException( throw new OperationManagementException(
"Error occurred while updating the operation: " + operationId + " status:" + "Error occurred while updating the operation: " + operationId + " status:" +
operation.getStatus(), e); operation.getStatus(), e);
} catch (TransactionManagementException e) {
throw new OperationManagementException("Error occurred while initiating a transaction", e);
} finally {
OperationManagementDAOFactory.closeConnection();
}
}
@Override
public void deleteOperation(int operationId) throws OperationManagementException {
try {
OperationManagementDAOFactory.beginTransaction();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operation =
operationDAO.getOperation(operationId);
if (operation == null) {
throw new OperationManagementException("Operation not found for operation id : " + operationId);
}
lookupOperationDAO(operation).deleteOperation(operationId);
OperationManagementDAOFactory.commitTransaction();
} catch (OperationManagementDAOException e) {
OperationManagementDAOFactory.rollbackTransaction();
throw new OperationManagementException("Error occurred while deleting the operation: " + operationId, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
throw new OperationManagementException("Error occurred while initiating a transaction", e); throw new OperationManagementException("Error occurred while initiating a transaction", e);
} finally { } finally {
@ -584,56 +559,57 @@ public class OperationManagerImpl implements OperationManager {
Operation operation = null; Operation operation = null;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Operation Id: " + operationId + " Device Type: " + deviceId.getType() + " Device Identifier: " + log.debug("Operation Id: " + operationId + " Device Type: " + deviceId.getType() + " Device Identifier: " +
deviceId.getId()); deviceId.getId());
} }
if (!isActionAuthorized(deviceId)) { if (!isActionAuthorized(deviceId)) {
throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" + throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" +
deviceId.getType() + "' device, which carries the identifier '" + deviceId.getType() + "' device, which carries the identifier '" +
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentInfo == null) { if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for given device identifier: " + throw new OperationManagementException("Device not found for given device identifier: " +
deviceId.getId() + " type: " + deviceId.getType()); deviceId.getId() + " type: " + deviceId.getType());
} }
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO. org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation deviceSpecificOperation = operationDAO.
getOperationByDeviceAndId(enrolmentInfo.getId(), getOperationByDeviceAndId(enrolmentInfo.getId(),
operationId); operationId);
if (dtoOperation.getType(). org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = deviceSpecificOperation;
if (deviceSpecificOperation.getType().
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) { equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
commandOperation = commandOperation =
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. (org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
getOperation(dtoOperation.getId()); getOperation(deviceSpecificOperation.getId());
dtoOperation.setEnabled(commandOperation.isEnabled()); dtoOperation.setEnabled(commandOperation.isEnabled());
} else if (dtoOperation.getType(). } else if (deviceSpecificOperation.getType().
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) { equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
dtoOperation = configOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = configOperationDAO.getOperation(deviceSpecificOperation.getId());
} else if (dtoOperation.getType().equals( } else if (deviceSpecificOperation.getType().equals(
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE)) { org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE)) {
dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = profileOperationDAO.getOperation(deviceSpecificOperation.getId());
} else if (dtoOperation.getType().equals( } else if (deviceSpecificOperation.getType().equals(
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY)) { org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY)) {
dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = policyOperationDAO.getOperation(deviceSpecificOperation.getId());
} }
if (dtoOperation == null) { if (dtoOperation == null) {
throw new OperationManagementException("Operation not found for operation Id:" + operationId + throw new OperationManagementException("Operation not found for operation Id:" + operationId +
" device id:" + deviceId.getId()); " device id:" + deviceId.getId());
} }
operation = OperationDAOUtil.convertOperation(dtoOperation); dtoOperation.setStatus(deviceSpecificOperation.getStatus());
operation = OperationDAOUtil.convertOperation(deviceSpecificOperation);
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the list of " + throw new OperationManagementException("Error occurred while retrieving the list of " +
"operations assigned for '" + deviceId.getType() + "operations assigned for '" + deviceId.getType() +
"' device '" + deviceId.getId() + "'", e); "' device '" + deviceId.getId() + "'", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException("Error occurred while opening connection to the data source", throw new OperationManagementException("Error occurred while opening connection to the data source",
e); e);
} finally { } finally {
OperationManagementDAOFactory.closeConnection(); OperationManagementDAOFactory.closeConnection();
} }
@ -649,15 +625,15 @@ public class OperationManagerImpl implements OperationManager {
if (!isActionAuthorized(deviceId)) { if (!isActionAuthorized(deviceId)) {
throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" + throw new OperationManagementException("User '" + getUser() + "' is not authorized to access the '" +
deviceId.getType() + "' device, which carries the identifier '" + deviceId.getType() + "' device, which carries the identifier '" +
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentInfo == null) { if (enrolmentInfo == null) {
throw new OperationManagementException( throw new OperationManagementException(
"Device not found for device id:" + deviceId.getId() + " " + "type:" + "Device not found for device id:" + deviceId.getId() + " " + "type:" +
deviceId.getType()); deviceId.getType());
} }
try { try {
@ -667,14 +643,14 @@ public class OperationManagerImpl implements OperationManager {
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.valueOf(status.toString()); org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.valueOf(status.toString());
dtoOperationList.addAll(commandOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOpStatus)); dtoOperationList.addAll(commandOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOpStatus));
dtoOperationList.addAll(configOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOperationList.addAll(configOperationDAO.getOperationsByDeviceAndStatus(enrolmentId,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation. org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.
Status.PENDING)); Status.PENDING));
dtoOperationList.addAll(profileOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOperationList.addAll(profileOperationDAO.getOperationsByDeviceAndStatus(enrolmentId,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation. org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.
Status.PENDING)); Status.PENDING));
dtoOperationList.addAll(policyOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOperationList.addAll(policyOperationDAO.getOperationsByDeviceAndStatus(enrolmentId,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation. org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.
Status.PENDING)); Status.PENDING));
Operation operation; Operation operation;
@ -685,9 +661,9 @@ public class OperationManagerImpl implements OperationManager {
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the list of " + throw new OperationManagementException("Error occurred while retrieving the list of " +
"operations assigned for '" + deviceId.getType() + "operations assigned for '" + deviceId.getType() +
"' device '" + "' device '" +
deviceId.getId() + "' and status:" + status.toString(), e); deviceId.getId() + "' and status:" + status.toString(), e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException( throw new OperationManagementException(
"Error occurred while opening a connection to the data source", e); "Error occurred while opening a connection to the data source", e);
@ -703,32 +679,32 @@ public class OperationManagerImpl implements OperationManager {
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.getOperation( org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.getOperation(
operationId); operationId);
if (dtoOperation == null) { if (dtoOperation == null) {
throw new OperationManagementException("Operation not found for given Id:" + operationId); throw new OperationManagementException("Operation not found for given Id:" + operationId);
} }
if (dtoOperation.getType() if (dtoOperation.getType()
.equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) { .equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
commandOperation = commandOperation =
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. (org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
getOperation(dtoOperation.getId()); getOperation(dtoOperation.getId());
dtoOperation.setEnabled(commandOperation.isEnabled()); dtoOperation.setEnabled(commandOperation.isEnabled());
} else if (dtoOperation.getType(). } else if (dtoOperation.getType().
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) { equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
dtoOperation = configOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = configOperationDAO.getOperation(dtoOperation.getId());
} else if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type. } else if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.
PROFILE)) { PROFILE)) {
dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId());
} else if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type. } else if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.
POLICY)) { POLICY)) {
dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId()); dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId());
} }
operation = OperationDAOUtil.convertOperation(dtoOperation); operation = OperationDAOUtil.convertOperation(dtoOperation);
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the operation with operation Id '" + throw new OperationManagementException("Error occurred while retrieving the operation with operation Id '" +
operationId, e); operationId, e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException("Error occurred while opening a connection to the data source", e); throw new OperationManagementException("Error occurred while opening a connection to the data source", e);
} finally { } finally {
@ -737,62 +713,6 @@ public class OperationManagerImpl implements OperationManager {
return operation; return operation;
} }
// @Override
// public Operation getOperationByActivityId(String activity) throws OperationManagementException {
// // This parses the operation id from activity id (ex : ACTIVITY_23) and converts to the integer.
// Operation operation;
// int enrollmentOpMappingId = Integer.parseInt(
// activity.replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, ""));
// if (enrollmentOpMappingId == 0) {
// throw new IllegalArgumentException("Operation ID cannot be null or zero (0).");
// }
// try {
// OperationManagementDAOFactory.openConnection();
// org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation =
// operationDAO.getOperationFromEnrollment(enrollmentOpMappingId);
//
// if (dtoOperation == null) {
// throw new OperationManagementException("Operation not found for given activity Id:" + activity);
// }
// org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status status = dtoOperation.getStatus();
// if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
// org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
// commandOperation =
// (org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
// getOperation(dtoOperation.getId());
// dtoOperation.setEnabled(commandOperation.isEnabled());
// } else if (dtoOperation.getType().
// equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
// dtoOperation = configOperationDAO.getOperation(dtoOperation.getId());
// } else if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.
// PROFILE)) {
// dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId());
// } else if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.
// POLICY)) {
// dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId());
// }
// operation = OperationDAOUtil.convertOperation(dtoOperation);
// int enrolmentId = operationDAO.getEnrolmentIdFromMappingId(enrollmentOpMappingId);
// if (enrolmentId != 0) {
// operation.setResponses(operationDAO.getOperationResponses(enrolmentId, operation.getId()));
// }
//
// operation.setStatus(Operation.Status.valueOf(status.toString()));
// operation.setActivityId(activity);
//
// } catch (SQLException e) {
// throw new OperationManagementException("Error occurred while opening a connection to the data source", e);
// } catch (OperationManagementDAOException e) {
// throw new OperationManagementException("Error occurred while retrieving the operation with activity Id '" +
// activity, e);
// } finally {
// OperationManagementDAOFactory.closeConnection();
// }
//
// // return this.getOperation(operationId);
// return operation;
// }
@Override @Override
public Activity getOperationByActivityId(String activity) throws OperationManagementException { public Activity getOperationByActivityId(String activity) throws OperationManagementException {
// This parses the operation id from activity id (ex : ACTIVITY_23) and converts to the integer. // This parses the operation id from activity id (ex : ACTIVITY_23) and converts to the integer.
@ -808,7 +728,7 @@ public class OperationManagerImpl implements OperationManager {
throw new OperationManagementException("Error occurred while opening a connection to the data source.", e); throw new OperationManagementException("Error occurred while opening a connection to the data source.", e);
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the operation with activity Id '" + throw new OperationManagementException("Error occurred while retrieving the operation with activity Id '" +
activity, e); activity, e);
} finally { } finally {
OperationManagementDAOFactory.closeConnection(); OperationManagementDAOFactory.closeConnection();
} }
@ -836,11 +756,6 @@ public class OperationManagerImpl implements OperationManager {
} }
} }
@Override
public List<Operation> getOperationUpdatedAfter(long timestamp) throws OperationManagementException {
return null;
}
@Override @Override
public List<Activity> getActivitiesUpdatedAfter(long timestamp) throws OperationManagementException { public List<Activity> getActivitiesUpdatedAfter(long timestamp) throws OperationManagementException {
try { try {
@ -850,7 +765,7 @@ public class OperationManagerImpl implements OperationManager {
throw new OperationManagementException("Error occurred while opening a connection to the data source.", e); throw new OperationManagementException("Error occurred while opening a connection to the data source.", e);
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while getting the activity list changed after a " + throw new OperationManagementException("Error occurred while getting the activity list changed after a " +
"given time.", e); "given time.", e);
} finally { } finally {
OperationManagementDAOFactory.closeConnection(); OperationManagementDAOFactory.closeConnection();
} }
@ -866,7 +781,7 @@ public class OperationManagerImpl implements OperationManager {
throw new OperationManagementException("Error occurred while opening a connection to the data source.", e); throw new OperationManagementException("Error occurred while opening a connection to the data source.", e);
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while getting the activity list changed after a " + throw new OperationManagementException("Error occurred while getting the activity list changed after a " +
"given time.", e); "given time.", e);
} finally { } finally {
OperationManagementDAOFactory.closeConnection(); OperationManagementDAOFactory.closeConnection();
} }
@ -881,7 +796,7 @@ public class OperationManagerImpl implements OperationManager {
throw new OperationManagementException("Error occurred while opening a connection to the data source.", e); throw new OperationManagementException("Error occurred while opening a connection to the data source.", e);
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while getting the activity count changed after a " + throw new OperationManagementException("Error occurred while getting the activity count changed after a " +
"given time.", e); "given time.", e);
} finally { } finally {
OperationManagementDAOFactory.closeConnection(); OperationManagementDAOFactory.closeConnection();
} }
@ -904,12 +819,18 @@ public class OperationManagerImpl implements OperationManager {
private OperationDAO lookupOperationDAO(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operation) { private OperationDAO lookupOperationDAO(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operation) {
if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) { if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation ||
operation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
return commandOperationDAO; return commandOperationDAO;
} else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.ProfileOperation) { } else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.ProfileOperation ||
operation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE)) {
return profileOperationDAO; return profileOperationDAO;
} else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.ConfigOperation) { } else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.ConfigOperation ||
operation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
return configOperationDAO; return configOperationDAO;
} else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.PolicyOperation ||
operation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY)) {
return policyOperationDAO;
} else { } else {
return operationDAO; return operationDAO;
} }
@ -966,8 +887,8 @@ public class OperationManagerImpl implements OperationManager {
enrolmentId = deviceDAO.getEnrolmentByStatus(deviceId, status, tenantId); enrolmentId = deviceDAO.getEnrolmentByStatus(deviceId, status, tenantId);
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving metadata of '" + throw new OperationManagementException("Error occurred while retrieving metadata of '" +
deviceId.getType() + "' device carrying the identifier '" + deviceId.getType() + "' device carrying the identifier '" +
deviceId.getId() + "'", e); deviceId.getId() + "'", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException( throw new OperationManagementException(
"Error occurred while opening a connection to the data source", e); "Error occurred while opening a connection to the data source", e);
@ -995,15 +916,15 @@ public class OperationManagerImpl implements OperationManager {
} }
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving enrollment data of '" + throw new OperationManagementException("Error occurred while retrieving enrollment data of '" +
deviceId.getType() + "' device carrying the identifier '" + deviceId.getType() + "' device carrying the identifier '" +
deviceId.getId() + "' of owner '" + owner + "'", e); deviceId.getId() + "' of owner '" + owner + "'", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException( throw new OperationManagementException(
"Error occurred while opening a connection to the data source", e); "Error occurred while opening a connection to the data source", e);
} catch (DeviceAccessAuthorizationException e) { } catch (DeviceAccessAuthorizationException e) {
throw new OperationManagementException("Error occurred while checking the device access permissions for '" + throw new OperationManagementException("Error occurred while checking the device access permissions for '" +
deviceId.getType() + "' device carrying the identifier '" + deviceId.getType() + "' device carrying the identifier '" +
deviceId.getId() + "' of owner '" + owner + "'", e); deviceId.getId() + "' of owner '" + owner + "'", e);
} finally { } finally {
DeviceManagementDAOFactory.closeConnection(); DeviceManagementDAOFactory.closeConnection();
} }
@ -1018,8 +939,8 @@ public class OperationManagerImpl implements OperationManager {
enrolmentInfo = deviceDAO.getActiveEnrolment(deviceId, tenantId); enrolmentInfo = deviceDAO.getActiveEnrolment(deviceId, tenantId);
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving enrollment data of '" + throw new OperationManagementException("Error occurred while retrieving enrollment data of '" +
deviceId.getType() + "' device carrying the identifier '" + deviceId.getType() + "' device carrying the identifier '" +
deviceId.getId() + "'", e); deviceId.getId() + "'", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new OperationManagementException( throw new OperationManagementException(
"Error occurred while opening a connection to the data source", e); "Error occurred while opening a connection to the data source", e);
@ -1040,7 +961,7 @@ public class OperationManagerImpl implements OperationManager {
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction(); DeviceManagementDAOFactory.rollbackTransaction();
throw new OperationManagementException("Error occurred while updating enrollment status of device of " + throw new OperationManagementException("Error occurred while updating enrollment status of device of " +
"enrolment-id '" + enrolmentId + "'", e); "enrolment-id '" + enrolmentId + "'", e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
throw new OperationManagementException("Error occurred while initiating a transaction", e); throw new OperationManagementException("Error occurred while initiating a transaction", e);
} finally { } finally {
@ -1055,7 +976,7 @@ public class OperationManagerImpl implements OperationManager {
List<MonitoringOperation> monitoringOperations = deviceManagementProviderService.getMonitoringOperationList(deviceType);//Get task list from each device type List<MonitoringOperation> monitoringOperations = deviceManagementProviderService.getMonitoringOperationList(deviceType);//Get task list from each device type
for(MonitoringOperation op : monitoringOperations){ for (MonitoringOperation op : monitoringOperations) {
if (operation.getCode().equals(op.getTaskName())) { if (operation.getCode().equals(op.getTaskName())) {
return true; return true;
} }

@ -26,8 +26,6 @@ public class OperationMgtConstants {
} }
public static final String DEVICE_ID_NOT_FOUND = "Device not found for device id: %s"; public static final String DEVICE_ID_NOT_FOUND = "Device not found for device id: %s";
public static final String DEVICE_ID_SERVICE_NOT_FOUND =
"Issue in retrieving device management service instance for device found at %s";
} }
public final class OperationCodes { public final class OperationCodes {

@ -33,12 +33,8 @@ public interface OperationDAO {
void updateOperation(Operation operation) throws OperationManagementDAOException; void updateOperation(Operation operation) throws OperationManagementDAOException;
void deleteOperation(int operationId) throws OperationManagementDAOException;
Operation getOperation(int operationId) throws OperationManagementDAOException; Operation getOperation(int operationId) throws OperationManagementDAOException;
Operation getOperationFromEnrollment(int enrollmentOpMappingId) throws OperationManagementDAOException;
Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException; Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException;
List<? extends Operation> getOperationsByDeviceAndStatus(int enrolmentId, Operation.Status status) List<? extends Operation> getOperationsByDeviceAndStatus(int enrolmentId, Operation.Status status)
@ -66,24 +62,16 @@ public interface OperationDAO {
void addOperationResponse(int enrolmentId, int operationId, Object operationResponse) void addOperationResponse(int enrolmentId, int operationId, Object operationResponse)
throws OperationManagementDAOException; throws OperationManagementDAOException;
List<OperationResponse> getOperationResponses(int enrolmentId, int operationId) throws OperationManagementDAOException;
Activity getActivity(int operationId) throws OperationManagementDAOException; Activity getActivity(int operationId) throws OperationManagementDAOException;
Activity getActivityByDevice(int operationId, int deviceId) throws OperationManagementDAOException; Activity getActivityByDevice(int operationId, int deviceId) throws OperationManagementDAOException;
int getEnrolmentIdFromMappingId(int enrollmentOpMappingId) throws OperationManagementDAOException;
List<Operation> getOperationsUpdatedAfter(long timestamp) throws OperationManagementDAOException;
List<Activity> getActivitiesUpdatedAfter(long timestamp) throws OperationManagementDAOException; List<Activity> getActivitiesUpdatedAfter(long timestamp) throws OperationManagementDAOException;
List<Activity> getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementDAOException; List<Activity> getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementDAOException;
int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementDAOException; int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementDAOException;
boolean resetAttemptCount(int enrolmentId) throws OperationManagementDAOException;
/** /**
* This method provides operation mappings for given status * This method provides operation mappings for given status
* @param opStatus Operation status * @param opStatus Operation status

@ -18,6 +18,7 @@
*/ */
package org.wso2.carbon.device.mgt.core.operation.mgt.dao; package org.wso2.carbon.device.mgt.core.operation.mgt.dao;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation; import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationEnrolmentMapping; import org.wso2.carbon.device.mgt.core.operation.mgt.OperationEnrolmentMapping;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMapping; import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMapping;

@ -70,22 +70,6 @@ public class CommandOperationDAOImpl extends GenericOperationDAOImpl {
} }
} }
@Override
public void deleteOperation(int id) throws OperationManagementDAOException {
PreparedStatement stmt = null;
try {
super.deleteOperation(id);
Connection connection = OperationManagementDAOFactory.getConnection();
stmt = connection.prepareStatement("DELETE FROM DM_COMMAND_OPERATION WHERE OPERATION_ID = ?");
stmt.setInt(1, id);
stmt.executeUpdate();
} catch (SQLException e) {
throw new OperationManagementDAOException("Error occurred while deleting operation metadata", e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt);
}
}
public CommandOperation getOperation(int id) throws OperationManagementDAOException { public CommandOperation getOperation(int id) throws OperationManagementDAOException {
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;

@ -58,22 +58,6 @@ public class ConfigOperationDAOImpl extends GenericOperationDAOImpl {
return operationId; return operationId;
} }
@Override
public void deleteOperation(int id) throws OperationManagementDAOException {
PreparedStatement stmt = null;
try {
super.deleteOperation(id);
Connection connection = OperationManagementDAOFactory.getConnection();
stmt = connection.prepareStatement("DELETE FROM DM_CONFIG_OPERATION WHERE OPERATION_ID = ?") ;
stmt.setInt(1, id);
stmt.executeUpdate();
} catch (SQLException e) {
throw new OperationManagementDAOException("Error occurred while deleting operation metadata", e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt);
}
}
@Override @Override
public void updateOperation(Operation operation) throws OperationManagementDAOException { public void updateOperation(Operation operation) throws OperationManagementDAOException {
PreparedStatement stmt = null; PreparedStatement stmt = null;

@ -249,68 +249,6 @@ public class GenericOperationDAOImpl implements OperationDAO {
} }
} }
@Override
public List<OperationResponse> getOperationResponses(int enrolmentId, int operationId) throws
OperationManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
List<OperationResponse> responces = new ArrayList<>();
try {
Connection conn = OperationManagementDAOFactory.getConnection();
String sql = "SELECT * FROM DM_DEVICE_OPERATION_RESPONSE WHERE ENROLMENT_ID = ? AND OPERATION_ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, enrolmentId);
stmt.setInt(2, operationId);
rs = stmt.executeQuery();
while (rs.next()) {
OperationResponse response = new OperationResponse();
response.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
byte[] contentBytes;
try {
contentBytes = (byte[]) rs.getBytes("OPERATION_RESPONSE");
bais = new ByteArrayInputStream(contentBytes);
ois = new ObjectInputStream(bais);
response.setResponse(ois.readObject().toString());
} finally {
if (bais != null) {
try {
bais.close();
} catch (IOException e) {
log.warn("Error occurred while closing ByteArrayOutputStream", e);
}
}
if (ois != null) {
try {
ois.close();
} catch (IOException e) {
log.warn("Error occurred while closing ObjectOutputStream", e);
}
}
}
responces.add(response);
}
} catch (SQLException e) {
throw new OperationManagementDAOException("SQL Error occurred while retrieving the operation responses for " +
"operation id " + operationId + " and enrolment id " + enrolmentId, e);
} catch (ClassNotFoundException e) {
throw new OperationManagementDAOException("Error occurred while converting the operation responses to string" +
" for operation id " + operationId + " and enrolment id " + enrolmentId, e);
} catch (IOException e) {
throw new OperationManagementDAOException("Error occurred while converting the operation responses to string" +
" for operation id " + operationId + " and enrolment id " + enrolmentId, e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt, rs);
}
return responces;
}
@Override @Override
public Activity getActivity(int operationId) throws OperationManagementDAOException { public Activity getActivity(int operationId) throws OperationManagementDAOException {
@ -674,80 +612,6 @@ public class GenericOperationDAOImpl implements OperationDAO {
return 0; return 0;
} }
@Override
public int getEnrolmentIdFromMappingId(int enrollmentOpMappingId) throws OperationManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
try {
Connection conn = OperationManagementDAOFactory.getConnection();
String sql = "SELECT * FROM DM_ENROLMENT_OP_MAPPING WHERE ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, enrollmentOpMappingId);
rs = stmt.executeQuery();
if (rs.next()) {
return rs.getInt("ENROLMENT_ID");
}
} catch (SQLException e) {
throw new OperationManagementDAOException("SQL Error occurred while retrieving the enrolment id " +
" for the mapping id '" + enrollmentOpMappingId, e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt, rs);
}
return -1;
}
@Override
public List<Operation> getOperationsUpdatedAfter(long timestamp) throws OperationManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
List<Operation> operations = new ArrayList<>();
try {
Connection conn = OperationManagementDAOFactory.getConnection();
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, OPERATION_CODE " +
"FROM DM_OPERATION AS o \n" +
"INNER JOIN DM_ENROLMENT_OP_MAPPING AS eom ON eom.OPERATION_ID=o.ID WHERE eom.UPDATED_TIMESTAMP = ?";
stmt = conn.prepareStatement(sql);
stmt.setLong(1, timestamp);
rs = stmt.executeQuery();
if (rs.next()) {
Operation operation = new Operation();
operation.setId(rs.getInt("ID"));
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
operation.setCode(rs.getString("OPERATION_CODE"));
operations.add(operation);
}
} catch (SQLException e) {
throw new OperationManagementDAOException("Error occurred while retrieving the operations updated " +
"after a given time", e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt, rs);
}
return operations;
}
@Override
public void deleteOperation(int id) throws OperationManagementDAOException {
PreparedStatement stmt = null;
try {
Connection connection = OperationManagementDAOFactory.getConnection();
stmt = connection.prepareStatement("DELETE FROM DM_OPERATION WHERE ID = ?");
stmt.setInt(1, id);
stmt.executeUpdate();
} catch (SQLException e) {
throw new OperationManagementDAOException("Error occurred while deleting operation metadata", e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt);
}
}
@Override @Override
public Operation getOperation(int id) throws OperationManagementDAOException { public Operation getOperation(int id) throws OperationManagementDAOException {
PreparedStatement stmt = null; PreparedStatement stmt = null;
@ -783,49 +647,6 @@ public class GenericOperationDAOImpl implements OperationDAO {
return operation; return operation;
} }
@Override
public Operation getOperationFromEnrollment(int enrollmentOpMappingId) throws OperationManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
Operation operation = null;
try {
Connection conn = OperationManagementDAOFactory.getConnection();
String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, OPERATION_CODE, \n" +
" om.STATUS, om.UPDATED_TIMESTAMP FROM DM_OPERATION o \n" +
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm WHERE dm.ID = ? ) om \n" +
"ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC ";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, enrollmentOpMappingId);
rs = stmt.executeQuery();
if (rs.next()) {
operation = new Operation();
operation.setId(rs.getInt("ID"));
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
// if (rs.getTimestamp("RECEIVED_TIMESTAMP") == null) {
// operation.setReceivedTimeStamp("");
// } else {
// operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
// }
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
operation.setReceivedTimeStamp("");
} else {
operation.setReceivedTimeStamp(
new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
}
operation.setCode(rs.getString("OPERATION_CODE"));
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
}
} catch (SQLException e) {
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation .", e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt, rs);
}
return operation;
}
@Override @Override
public Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException { public Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException {
PreparedStatement stmt = null; PreparedStatement stmt = null;
@ -833,9 +654,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
Operation operation = null; Operation operation = null;
try { try {
Connection conn = OperationManagementDAOFactory.getConnection(); Connection conn = OperationManagementDAOFactory.getConnection();
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE, " + String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, om.STATUS, o.OPERATION_CODE, " +
"om.ID AS OM_MAPPING_ID, " + "om.ID AS OM_MAPPING_ID, " +
"om.UPDATED_TIMESTAMP FROM (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS," + "om.UPDATED_TIMESTAMP FROM (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP," +
"OPERATION_CODE FROM DM_OPERATION WHERE id = ?) o INNER JOIN (SELECT * FROM " + "OPERATION_CODE FROM DM_OPERATION WHERE id = ?) o INNER JOIN (SELECT * FROM " +
"DM_ENROLMENT_OP_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " + "DM_ENROLMENT_OP_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " +
"ON o.ID = om.OPERATION_ID "; "ON o.ID = om.OPERATION_ID ";
@ -850,6 +671,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
operation.setId(rs.getInt("ID")); operation.setId(rs.getInt("ID"));
operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString()); operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
// if (rs.getTimestamp("RECEIVED_TIMESTAMP") == null) { // if (rs.getTimestamp("RECEIVED_TIMESTAMP") == null) {
// operation.setReceivedTimeStamp(""); // operation.setReceivedTimeStamp("");
// } else { // } else {
@ -1176,31 +998,6 @@ public class GenericOperationDAOImpl implements OperationDAO {
return operations; return operations;
} }
@Override
public boolean resetAttemptCount(int enrolmentId) throws OperationManagementDAOException {
boolean status = false;
Connection conn;
PreparedStatement stmt = null;
Timestamp currentTimestamp = new Timestamp(Calendar.getInstance().getTime().getTime());
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
try {
conn = OperationManagementDAOFactory.getConnection();
String query = "UPDATE DM_POLICY_COMPLIANCE_STATUS SET ATTEMPTS = 0, LAST_REQUESTED_TIME = ? " +
"WHERE ENROLMENT_ID = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(query);
stmt.setTimestamp(1, currentTimestamp);
stmt.setInt(2, enrolmentId);
stmt.setInt(3, tenantId);
stmt.executeUpdate();
status = true;
} catch (SQLException e) {
throw new OperationManagementDAOException("Unable to reset the attempt count in database.", e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt, null);
}
return status;
}
@Override @Override
public Map<Integer, List<OperationMapping>> getOperationMappingsByStatus(Operation.Status opStatus, Operation.PushNotificationStatus pushNotificationStatus, public Map<Integer, List<OperationMapping>> getOperationMappingsByStatus(Operation.Status opStatus, Operation.PushNotificationStatus pushNotificationStatus,
int limit) throws OperationManagementDAOException { int limit) throws OperationManagementDAOException {

@ -122,22 +122,6 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl {
} }
} }
@Override
public void deleteOperation(int operationId) throws OperationManagementDAOException {
PreparedStatement stmt = null;
try {
super.deleteOperation(operationId);
Connection connection = OperationManagementDAOFactory.getConnection();
stmt = connection.prepareStatement("DELETE FROM DM_POLICY_OPERATION WHERE OPERATION_ID=?");
stmt.setInt(1, operationId);
stmt.executeUpdate();
} catch (SQLException e) {
throw new OperationManagementDAOException("Error occurred while deleting operation metadata", e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt);
}
}
@Override @Override
public Operation getOperation(int operationId) throws OperationManagementDAOException { public Operation getOperation(int operationId) throws OperationManagementDAOException {
PreparedStatement stmt = null; PreparedStatement stmt = null;

@ -123,22 +123,6 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl {
} }
} }
@Override
public void deleteOperation(int id) throws OperationManagementDAOException {
PreparedStatement stmt = null;
try {
super.deleteOperation(id);
Connection connection = OperationManagementDAOFactory.getConnection();
stmt = connection.prepareStatement("DELETE FROM DM_PROFILE_OPERATION WHERE OPERATION_ID=?");
stmt.setInt(1, id);
stmt.executeUpdate();
} catch (SQLException e) {
throw new OperationManagementDAOException("Error occurred while deleting operation metadata", e);
} finally {
OperationManagementDAOUtil.cleanupResources(stmt);
}
}
public Operation getOperation(int id) throws OperationManagementDAOException { public Operation getOperation(int id) throws OperationManagementDAOException {
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;

@ -1,154 +0,0 @@
/*
* Copyright (c) 2016, 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.push.notification.mgt;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationContext;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationExecutionFailedException;
import java.util.List;
public class PushNotificationBasedOperationManager implements OperationManager {
private OperationManager operationManager;
private NotificationStrategy notificationProvider;
public PushNotificationBasedOperationManager(
OperationManager operationManager, NotificationStrategy notificationProvider) {
this.operationManager = operationManager;
this.notificationProvider = notificationProvider;
}
@Override
public Activity addOperation(Operation operation,
List<DeviceIdentifier> devices) throws OperationManagementException, InvalidDeviceException {
Activity activity = this.operationManager.addOperation(operation, devices);
for (DeviceIdentifier deviceId : devices) {
try {
this.notificationProvider.execute(new NotificationContext(deviceId, operation));
} catch (PushNotificationExecutionFailedException e) {
throw new OperationManagementException("Error occurred while sending push notification to device", e);
}
}
return activity;
}
@Override
public List<? extends Operation> getOperations(
DeviceIdentifier deviceId) throws OperationManagementException {
return this.operationManager.getOperations(deviceId);
}
@Override
public PaginationResult getOperations(DeviceIdentifier deviceId,
PaginationRequest request) throws OperationManagementException {
return this.operationManager.getOperations(deviceId, request);
}
@Override
public List<? extends Operation> getPendingOperations(
DeviceIdentifier deviceId) throws OperationManagementException {
return this.operationManager.getPendingOperations(deviceId);
}
@Override
public Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException {
return this.operationManager.getNextPendingOperation(deviceId);
}
@Override
public void updateOperation(DeviceIdentifier deviceId,
Operation operation) throws OperationManagementException {
this.operationManager.updateOperation(deviceId, operation);
}
@Override
public void deleteOperation(int operationId) throws OperationManagementException {
this.operationManager.deleteOperation(operationId);
}
@Override
public Operation getOperationByDeviceAndOperationId(
DeviceIdentifier deviceId, int operationId) throws OperationManagementException {
return this.operationManager.getOperationByDeviceAndOperationId(deviceId, operationId);
}
@Override
public List<? extends Operation> getOperationsByDeviceAndStatus(
DeviceIdentifier deviceId,
Operation.Status status) throws OperationManagementException {
try {
return this.operationManager.getOperationsByDeviceAndStatus(deviceId, status);
} catch (DeviceManagementException e) {
throw new OperationManagementException("Error occurred while retrieving the list of operations by " +
"device and status", e);
}
}
@Override
public Operation getOperation(int operationId) throws OperationManagementException {
return this.operationManager.getOperation(operationId);
}
@Override
public Activity getOperationByActivityId(String activity) throws OperationManagementException {
return this.operationManager.getOperationByActivityId(activity);
}
@Override
public Activity getOperationByActivityIdAndDevice(String activity, DeviceIdentifier deviceId) throws OperationManagementException {
return this.operationManager.getOperationByActivityIdAndDevice(activity, deviceId);
}
@Override
public List<Operation> getOperationUpdatedAfter(long timestamp) throws OperationManagementException {
return this.operationManager.getOperationUpdatedAfter(timestamp);
}
@Override
public List<Activity> getActivitiesUpdatedAfter(long timestamp) throws OperationManagementException {
return this.operationManager.getActivitiesUpdatedAfter(timestamp);
}
@Override
public List<Activity> getActivitiesUpdatedAfter(long timestamp, int limit, int offset) throws OperationManagementException {
return this.operationManager.getActivitiesUpdatedAfter(timestamp, limit, offset);
}
@Override
public int getActivityCountUpdatedAfter(long timestamp) throws OperationManagementException {
return this.operationManager.getActivityCountUpdatedAfter(timestamp);
}
@Override
public void setNotificationStrategy(NotificationStrategy notificationStrategy) {
}
@Override
public NotificationStrategy getNotificationStrategy() {
return notificationProvider;
}
}

@ -553,8 +553,6 @@ public interface DeviceManagementProviderService {
void updateOperation(DeviceIdentifier deviceId, Operation operation) throws OperationManagementException; void updateOperation(DeviceIdentifier deviceId, Operation operation) throws OperationManagementException;
void deleteOperation(String type, int operationId) throws OperationManagementException;
Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId, int operationId) Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId, int operationId)
throws OperationManagementException; throws OperationManagementException;

@ -1429,11 +1429,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
.updateOperation(deviceId, operation); .updateOperation(deviceId, operation);
} }
@Override
public void deleteOperation(String type, int operationId) throws OperationManagementException {
pluginRepository.getOperationManager(type, this.getTenantId()).deleteOperation(operationId);
}
@Override @Override
public Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId, public Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId,
int operationId) throws OperationManagementException { int operationId) throws OperationManagementException {

@ -259,7 +259,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Get groups"); log.debug("Get groups");
} }
List<DeviceGroup> deviceGroups = new ArrayList<>(); List<DeviceGroup> deviceGroups;
try { try {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
GroupManagementDAOFactory.openConnection(); GroupManagementDAOFactory.openConnection();
@ -293,7 +293,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
log.debug("Get groups with pagination " + request.toString()); log.debug("Get groups with pagination " + request.toString());
} }
request = DeviceManagerUtil.validateGroupListPageSize(request); request = DeviceManagerUtil.validateGroupListPageSize(request);
List<DeviceGroup> deviceGroups = new ArrayList<>(); List<DeviceGroup> deviceGroups;
try { try {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
GroupManagementDAOFactory.openConnection(); GroupManagementDAOFactory.openConnection();
@ -345,14 +345,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
for (DeviceGroup deviceGroup : deviceGroups) { for (DeviceGroup deviceGroup : deviceGroups) {
groups.put(deviceGroup.getGroupId(), deviceGroup); groups.put(deviceGroup.getGroupId(), deviceGroup);
} }
// } catch (UserStoreException e) {
// String msg = "Error occurred while getting user store manager.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while retrieving all groups accessible to user.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (UserStoreException | SQLException | GroupManagementDAOException e) { } catch (UserStoreException | SQLException | GroupManagementDAOException e) {
String msg = "Error occurred while retrieving all groups accessible to user."; String msg = "Error occurred while retrieving all groups accessible to user.";
log.error(msg, e); log.error(msg, e);
@ -368,16 +360,11 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
} }
private List<Integer> getGroupIds(String username) throws GroupManagementException { private List<Integer> getGroupIds(String username) throws GroupManagementException {
if (username == null || username.isEmpty()) {
String msg = "Received empty user name for getGroupIds";
log.error(msg);
throw new GroupManagementException(msg);
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Get groups Ids of owner '" + username + "'"); log.debug("Get groups Ids of owner '" + username + "'");
} }
UserStoreManager userStoreManager; UserStoreManager userStoreManager;
List<Integer> deviceGroupIds = new ArrayList<>(); List<Integer> deviceGroupIds;
try { try {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
userStoreManager = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId) userStoreManager = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId)
@ -386,14 +373,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
GroupManagementDAOFactory.openConnection(); GroupManagementDAOFactory.openConnection();
deviceGroupIds = this.groupDAO.getOwnGroupIds(username, tenantId); deviceGroupIds = this.groupDAO.getOwnGroupIds(username, tenantId);
deviceGroupIds.addAll(this.groupDAO.getGroupIds(roleList, tenantId)); deviceGroupIds.addAll(this.groupDAO.getGroupIds(roleList, tenantId));
// } catch (UserStoreException e) {
// String msg = "Error occurred while getting user store manager.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while retrieving all groups accessible to user.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (UserStoreException | SQLException | GroupManagementDAOException e) { } catch (UserStoreException | SQLException | GroupManagementDAOException e) {
String msg = "Error occurred while retrieving all groups accessible to user."; String msg = "Error occurred while retrieving all groups accessible to user.";
log.error(msg, e); log.error(msg, e);
@ -421,7 +400,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
} }
request = DeviceManagerUtil.validateGroupListPageSize(request); request = DeviceManagerUtil.validateGroupListPageSize(request);
List<Integer> allDeviceGroupIdsOfUser = getGroupIds(currentUser); List<Integer> allDeviceGroupIdsOfUser = getGroupIds(currentUser);
List<DeviceGroup> allMatchingGroups = new ArrayList<>(); List<DeviceGroup> allMatchingGroups;
try { try {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
GroupManagementDAOFactory.openConnection(); GroupManagementDAOFactory.openConnection();
@ -430,10 +409,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
String msg = "Error occurred while retrieving all groups in tenant"; String msg = "Error occurred while retrieving all groups in tenant";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while opening a connection to the data source.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Error occurred in getGroups"; String msg = "Error occurred in getGroups";
log.error(msg, e); log.error(msg, e);
@ -460,10 +435,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
String msg = "Error occurred while retrieving all groups in tenant"; String msg = "Error occurred while retrieving all groups in tenant";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while opening a connection to the data source.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Error occurred"; String msg = "Error occurred";
log.error(msg, e); log.error(msg, e);
@ -490,10 +461,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
String msg = "Error occurred while retrieving all groups in tenant"; String msg = "Error occurred while retrieving all groups in tenant";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while opening a connection to the data source.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Error occurred in getGroupCount"; String msg = "Error occurred in getGroupCount";
log.error(msg, e); log.error(msg, e);
@ -527,18 +494,10 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
count = groupDAO.getOwnGroupsCount(username, tenantId); count = groupDAO.getOwnGroupsCount(username, tenantId);
count += groupDAO.getGroupsCount(roleList, tenantId); count += groupDAO.getGroupsCount(roleList, tenantId);
return count; return count;
// } catch (UserStoreException e) {
// String msg = "Error occurred while getting user store manager.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (UserStoreException | GroupManagementDAOException | SQLException e) { } catch (UserStoreException | GroupManagementDAOException | SQLException e) {
String msg = "Error occurred while retrieving group count of user '" + username + "'"; String msg = "Error occurred while retrieving group count of user '" + username + "'";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while opening a connection to the data source.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Error occurred in getGroupCount for username '" + username + "'"; String msg = "Error occurred in getGroupCount for username '" + username + "'";
log.error(msg, e); log.error(msg, e);
@ -619,10 +578,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
String msg = "Error occurred while retrieving all groups in tenant"; String msg = "Error occurred while retrieving all groups in tenant";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while opening a connection to the data source.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Error occurred in getRoles for groupId: " + groupId; String msg = "Error occurred in getRoles for groupId: " + groupId;
log.error(msg, e); log.error(msg, e);
@ -651,14 +606,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
String msg = "Error occurred while getting devices in group."; String msg = "Error occurred while getting devices in group.";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while opening a connection to the data source.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
// } catch (DeviceManagementException e) {
// String msg = "Error occurred while validating the limit of the devices to be returned";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Error occurred in getDevices for groupId: " + groupId; String msg = "Error occurred in getDevices for groupId: " + groupId;
log.error(msg, e); log.error(msg, e);
@ -684,10 +631,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
String msg = "Error occurred while retrieving all groups in tenant"; String msg = "Error occurred while retrieving all groups in tenant";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while opening a connection to the data source.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Error occurred in getDeviceCount for groupId: " + groupId; String msg = "Error occurred in getDeviceCount for groupId: " + groupId;
log.error(msg, e); log.error(msg, e);
@ -838,18 +781,10 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
GroupManagementDAOFactory.openConnection(); GroupManagementDAOFactory.openConnection();
return groupDAO.getGroups(device.getId(), return groupDAO.getGroups(device.getId(),
PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
// } catch (DeviceManagementException e) {
// String msg = "Error occurred while retrieving the device details.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (DeviceManagementException | GroupManagementDAOException | SQLException e) { } catch (DeviceManagementException | GroupManagementDAOException | SQLException e) {
String msg = "Error occurred while retrieving device groups."; String msg = "Error occurred while retrieving device groups.";
log.error(msg, e); log.error(msg, e);
throw new GroupManagementException(msg, e); throw new GroupManagementException(msg, e);
// } catch (SQLException e) {
// String msg = "Error occurred while opening database connection.";
// log.error(msg, e);
// throw new GroupManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Error occurred in getGroups"; String msg = "Error occurred in getGroups";
log.error(msg, e); log.error(msg, e);

@ -32,6 +32,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.TestUtils; import org.wso2.carbon.device.mgt.core.TestUtils;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.GroupManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
@ -62,6 +63,7 @@ public abstract class BaseDeviceManagementTest {
DeviceManagementDAOFactory.init(dataSource); DeviceManagementDAOFactory.init(dataSource);
GroupManagementDAOFactory.init(dataSource); GroupManagementDAOFactory.init(dataSource);
OperationManagementDAOFactory.init(dataSource); OperationManagementDAOFactory.init(dataSource);
NotificationManagementDAOFactory.init(dataSource);
} }
@BeforeClass @BeforeClass
@ -131,7 +133,7 @@ public abstract class BaseDeviceManagementTest {
try { try {
conn = getDataSource().getConnection(); conn = getDataSource().getConnection();
conn.setAutoCommit(false); conn.setAutoCommit(false);
String[] cleanupTables = new String[]{"DM_DEVICE_OPERATION_RESPONSE","DM_ENROLMENT_OP_MAPPING", "DM_CONFIG_OPERATION", String[] cleanupTables = new String[]{"DM_NOTIFICATION","DM_DEVICE_OPERATION_RESPONSE","DM_ENROLMENT_OP_MAPPING", "DM_CONFIG_OPERATION",
"DM_POLICY_OPERATION", "DM_COMMAND_OPERATION", "DM_PROFILE_OPERATION", "DM_DEVICE_GROUP_MAP", "DM_POLICY_OPERATION", "DM_COMMAND_OPERATION", "DM_PROFILE_OPERATION", "DM_DEVICE_GROUP_MAP",
"DM_GROUP", "DM_ENROLMENT", "DM_DEVICE_APPLICATION_MAPPING", "DM_GROUP", "DM_ENROLMENT", "DM_DEVICE_APPLICATION_MAPPING",
"DM_APPLICATION", "DM_DEVICE", "DM_DEVICE_TYPE"}; "DM_APPLICATION", "DM_DEVICE", "DM_DEVICE_TYPE"};

@ -20,6 +20,8 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; 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;
import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import java.util.ArrayList; import java.util.ArrayList;
@ -52,6 +54,20 @@ public class TestDataHolder {
return device; return device;
} }
public static Notification getNotification(int notificationId, String status, String deviceId,
String description, String deviceName, int operationId,
String deviceType) {
Notification notification = new Notification();
notification.setNotificationId(notificationId);
notification.setStatus(status);
notification.setDeviceIdentifier(deviceId);
notification.setDescription(description);
notification.setDeviceName(deviceName);
notification.setOperationId(operationId);
notification.setDeviceType(deviceType);
return notification;
}
public static Device generateDummyDeviceData(String deviceIdentifier, String deviceType, public static Device generateDummyDeviceData(String deviceIdentifier, String deviceType,
EnrolmentInfo enrolmentInfo) { EnrolmentInfo enrolmentInfo) {
Device device = new Device(); Device device = new Device();

@ -0,0 +1,174 @@
/*
* 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.notification.mgt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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.EntityDoesNotExistException;
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
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.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.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.core.service.RealmService;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* This is the test class for {@link NotificationManagementServiceImpl}
*/
public class NotificationManagementServiceImplTests {
private static final Log log = LogFactory.getLog(NotificationManagementServiceImplTests.class);
private static final String DEVICE_TYPE = "NOTIFICATION_TEST_DEVICE";
private static final String DEVICE_ID_PREFIX = "NOTIFICATION-TEST-DEVICE-ID-";
private static final int NO_OF_DEVICES = 10;
private static final int NO_OF_NOTIFICATIONS = 10;
private List<DeviceIdentifier> deviceIds = new ArrayList<>();
private NotificationManagementServiceImpl notificationManagementService;
private static final String TEST_NOTIFICATION_DESCRIPTION = "test notification";
private static final int NOTIFICATION_OPERATION_ID = 1;
@BeforeClass
public void init() throws Exception {
DeviceConfigurationManager.getInstance().initConfig();
log.info("Initializing");
for (int i = 1; i <= NO_OF_DEVICES; i++) {
deviceIds.add(new DeviceIdentifier(DEVICE_ID_PREFIX + i, DEVICE_TYPE));
}
List<Device> devices = TestDataHolder.generateDummyDeviceData(this.deviceIds);
DeviceManagementProviderService deviceMgtService = new DeviceManagementProviderServiceImpl();
DeviceManagementServiceComponent.notifyStartupListeners();
DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceMgtService);
DeviceManagementDataHolder.getInstance().setRegistryService(getRegistryService());
DeviceManagementDataHolder.getInstance().setDeviceAccessAuthorizationService(new DeviceAccessAuthorizationServiceImpl());
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<Device> 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!");
}
}
notificationManagementService = new NotificationManagementServiceImpl();
}
private RegistryService getRegistryService() throws RegistryException {
RealmService realmService = new InMemoryRealmService();
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();
}
@Test(description = "Add notifications using addNotification method and check whether it returns true.")
public void addNotification() throws NotificationManagementException {
for (int i = 1; i <= NO_OF_DEVICES; i++) {
DeviceIdentifier testDeviceIdentifier = new DeviceIdentifier(DEVICE_ID_PREFIX + i, DEVICE_TYPE);
Notification notification = TestDataHolder.getNotification(i, Notification.Status.NEW.toString(),
testDeviceIdentifier.toString(), TEST_NOTIFICATION_DESCRIPTION, DEVICE_ID_PREFIX + i,
NOTIFICATION_OPERATION_ID, DEVICE_TYPE);
Assert.assertTrue(notificationManagementService.addNotification(testDeviceIdentifier, notification));
}
}
@Test(expectedExceptions = EntityDoesNotExistException.class, description = "AddNotification method is checked" +
" whether it returns EntityDoesNotExistException when the device not registered is added notification")
public void addNotificationExceptions() throws NotificationManagementException {
DeviceIdentifier testDeviceIdentifier = new DeviceIdentifier(DEVICE_ID_PREFIX + 123, DEVICE_TYPE);
Notification notification = TestDataHolder.getNotification(1, Notification.Status.NEW.toString(),
testDeviceIdentifier.toString(), TEST_NOTIFICATION_DESCRIPTION, DEVICE_ID_PREFIX + 123,
NOTIFICATION_OPERATION_ID, DEVICE_TYPE);
notificationManagementService.addNotification(new DeviceIdentifier(DEVICE_ID_PREFIX + 123,
DEVICE_TYPE), notification);
}
@Test(dependsOnMethods = "addNotification", description = "This tests the updateNotification Method" +
" and check whether it returns true ( got updated )")
public void updateNotification() throws NotificationManagementException {
for (int i = 1; i <= NO_OF_DEVICES; i++) {
DeviceIdentifier testDeviceIdentifier = new DeviceIdentifier(DEVICE_ID_PREFIX + i, DEVICE_TYPE);
Notification notification = TestDataHolder.getNotification(i, Notification.Status.CHECKED.toString(),
testDeviceIdentifier.toString(), TEST_NOTIFICATION_DESCRIPTION, DEVICE_ID_PREFIX + i, NOTIFICATION_OPERATION_ID,
DEVICE_TYPE);
Assert.assertTrue(notificationManagementService.updateNotification(notification));
}
}
@Test(dependsOnMethods = "updateNotification", description = "This method update notification status " +
"and check whether it got updated")
public void updateNotificationStatus() throws NotificationManagementException {
for (int i = 1; i <= NO_OF_DEVICES; i++) {
Assert.assertTrue(notificationManagementService.updateNotificationStatus(i, Notification.Status.CHECKED));
}
}
@Test(dependsOnMethods = "addNotification", description = "this tests getAllNotifications" +
" method by listing down all the notifications.")
public void getAllNotifications() throws NotificationManagementException {
List<Notification> returnedNotifications = notificationManagementService.getAllNotifications();
Assert.assertEquals(returnedNotifications.size(), NO_OF_DEVICES);
}
@Test(dependsOnMethods = "updateNotificationStatus", description = "this method retries notification by id" +
" and checks it")
public void getNotification() throws NotificationManagementException {
for (int i = 1; i <= NO_OF_DEVICES; i++) {
Notification returnedNotification = notificationManagementService.getNotification(i);
Assert.assertEquals(returnedNotification.getNotificationId(), i);
Assert.assertEquals(returnedNotification.getStatus(), Notification.Status.CHECKED);
Assert.assertEquals(returnedNotification.getDescription(), TEST_NOTIFICATION_DESCRIPTION);
Assert.assertEquals(returnedNotification.getOperationId(), NOTIFICATION_OPERATION_ID);
}
}
@Test(dependsOnMethods = "updateNotificationStatus", description = "this method gets all notification by status checked")
public void getNotificationsByStatus() throws NotificationManagementException {
List<Notification> returnedNotifications = notificationManagementService.getNotificationsByStatus(Notification.Status.CHECKED);
Assert.assertEquals(returnedNotifications.size(), NO_OF_NOTIFICATIONS);
}
}

@ -18,8 +18,6 @@
package org.wso2.carbon.device.mgt.core.operation; package org.wso2.carbon.device.mgt.core.operation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -35,9 +33,10 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.ActivityStatus;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.TestDeviceManagementService; import org.wso2.carbon.device.mgt.core.TestDeviceManagementService;
import org.wso2.carbon.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; 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.common.TestDataHolder;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; 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.DeviceManagementDataHolder;
@ -59,13 +58,17 @@ import org.wso2.carbon.user.core.service.RealmService;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import java.io.InputStream; import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone;
public class OperationManagementTests{ /**
private static final Log log = LogFactory.getLog(OperationManagementTests.class); * This is the testcase which covers the methods from {@link OperationManager}
*/
public class OperationManagementTests {
private static final String DEVICE_TYPE = "OP_TEST_TYPE"; private static final String DEVICE_TYPE = "OP_TEST_TYPE";
private static final String DEVICE_ID_PREFIX = "OP-TEST-DEVICE-ID-"; private static final String DEVICE_ID_PREFIX = "OP-TEST-DEVICE-ID-";
@ -80,11 +83,11 @@ public class OperationManagementTests{
private List<DeviceIdentifier> deviceIds = new ArrayList<>(); private List<DeviceIdentifier> deviceIds = new ArrayList<>();
private OperationManager operationMgtService; private OperationManager operationMgtService;
private Activity commandActivity;
@BeforeClass @BeforeClass
public void init() throws Exception { public void init() throws Exception {
DeviceConfigurationManager.getInstance().initConfig(); DeviceConfigurationManager.getInstance().initConfig();
log.info("Initializing");
for (int i = 0; i < NO_OF_DEVICES; i++) { for (int i = 0; i < NO_OF_DEVICES; i++) {
deviceIds.add(new DeviceIdentifier(DEVICE_ID_PREFIX + i, DEVICE_TYPE)); deviceIds.add(new DeviceIdentifier(DEVICE_ID_PREFIX + i, DEVICE_TYPE));
} }
@ -107,7 +110,8 @@ public class OperationManagementTests{
throw new Exception("Incorrect device with ID - " + device.getDeviceIdentifier() + " returned!"); throw new Exception("Incorrect device with ID - " + device.getDeviceIdentifier() + " returned!");
} }
} }
this.operationMgtService = new OperationManagerImpl(DEVICE_TYPE); NotificationStrategy notificationStrategy = new TestNotificationStrategy();
this.operationMgtService = new OperationManagerImpl(DEVICE_TYPE, notificationStrategy);
} }
private RegistryService getRegistryService() throws RegistryException { private RegistryService getRegistryService() throws RegistryException {
@ -122,30 +126,57 @@ public class OperationManagementTests{
@Test @Test
public void addCommandOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { public void addCommandOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
Activity activity = this.operationMgtService.addOperation(getOperation(new CommandOperation(), Operation.Type.COMMAND, COMMAND_OPERATON_CODE), this.commandActivity = this.operationMgtService.addOperation(getOperation(new CommandOperation(), Operation.Type.COMMAND, COMMAND_OPERATON_CODE),
this.deviceIds); this.deviceIds);
validateOperationResponse(activity); validateOperationResponse(this.commandActivity, ActivityStatus.Status.PENDING);
}
@Test(expectedExceptions = InvalidDeviceException.class)
public void addEmptyDevicesCommandOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
this.operationMgtService.addOperation(getOperation(new CommandOperation(), Operation.Type.COMMAND, COMMAND_OPERATON_CODE),
new ArrayList<>());
}
@Test(expectedExceptions = InvalidDeviceException.class)
public void addNonInitializedDevicesCommandOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();
deviceIdentifiers.add(deviceIdentifier);
this.operationMgtService.addOperation(getOperation(new CommandOperation(), Operation.Type.COMMAND, COMMAND_OPERATON_CODE),
deviceIdentifiers);
}
@Test
public void addNonAdminUserDevicesCommandOperation() throws DeviceManagementException, OperationManagementException,
InvalidDeviceException {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID, true);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(NON_ADMIN_USER);
Activity activity = this.operationMgtService.addOperation(getOperation(new CommandOperation(), Operation.Type.COMMAND, COMMAND_OPERATON_CODE),
deviceIds);
PrivilegedCarbonContext.endTenantFlow();
validateOperationResponse(activity, ActivityStatus.Status.UNAUTHORIZED);
} }
@Test(dependsOnMethods = "addCommandOperation") @Test(dependsOnMethods = "addCommandOperation")
public void addPolicyOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { public void addPolicyOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
Activity activity = this.operationMgtService.addOperation(getOperation(new PolicyOperation(), Operation.Type.POLICY, POLICY_OPERATION_CODE), Activity activity = this.operationMgtService.addOperation(getOperation(new PolicyOperation(), Operation.Type.POLICY, POLICY_OPERATION_CODE),
this.deviceIds); this.deviceIds);
validateOperationResponse(activity); validateOperationResponse(activity, ActivityStatus.Status.PENDING);
} }
@Test(dependsOnMethods = "addPolicyOperation") @Test(dependsOnMethods = "addPolicyOperation")
public void addConfigOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { public void addConfigOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
Activity activity = this.operationMgtService.addOperation(getOperation(new ConfigOperation(), Operation.Type.CONFIG, CONFIG_OPERATION_CODE), Activity activity = this.operationMgtService.addOperation(getOperation(new ConfigOperation(), Operation.Type.CONFIG, CONFIG_OPERATION_CODE),
this.deviceIds); this.deviceIds);
validateOperationResponse(activity); validateOperationResponse(activity, ActivityStatus.Status.PENDING);
} }
@Test(dependsOnMethods = "addConfigOperation") @Test(dependsOnMethods = "addConfigOperation")
public void addProfileOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { public void addProfileOperation() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
Activity activity = this.operationMgtService.addOperation(getOperation(new ProfileOperation(), Operation.Type.PROFILE, PROFILE_OPERATION_CODE), Activity activity = this.operationMgtService.addOperation(getOperation(new ProfileOperation(), Operation.Type.PROFILE, PROFILE_OPERATION_CODE),
this.deviceIds); this.deviceIds);
validateOperationResponse(activity); validateOperationResponse(activity, ActivityStatus.Status.PENDING);
} }
private Operation getOperation(Operation operation, Operation.Type type, String code) { private Operation getOperation(Operation operation, Operation.Type type, String code) {
@ -156,11 +187,11 @@ public class OperationManagementTests{
return operation; return operation;
} }
private void validateOperationResponse(Activity activity) { private void validateOperationResponse(Activity activity, ActivityStatus.Status expectedStatus) {
Assert.assertEquals(activity.getActivityStatus().size(), NO_OF_DEVICES, "The operation reponse for add operation only have - " + Assert.assertEquals(activity.getActivityStatus().size(), NO_OF_DEVICES, "The operation reponse for add operation only have - " +
activity.getActivityStatus().size()); activity.getActivityStatus().size());
for (ActivityStatus status : activity.getActivityStatus()) { for (ActivityStatus status : activity.getActivityStatus()) {
Assert.assertEquals(status.getStatus(), ActivityStatus.Status.PENDING); Assert.assertEquals(status.getStatus(), expectedStatus);
} }
} }
@ -209,7 +240,7 @@ public class OperationManagementTests{
try { try {
this.operationMgtService.getOperations(deviceIdentifier, request); this.operationMgtService.getOperations(deviceIdentifier, request);
} catch (OperationManagementException ex) { } catch (OperationManagementException ex) {
if (ex.getMessage() == null){ if (ex.getMessage() == null) {
Assert.assertTrue(ex.getMessage().contains("User '" + NON_ADMIN_USER + "' is not authorized")); Assert.assertTrue(ex.getMessage().contains("User '" + NON_ADMIN_USER + "' is not authorized"));
} }
} }
@ -219,9 +250,14 @@ public class OperationManagementTests{
@Test(dependsOnMethods = "getPaginatedRequestAsAdmin") @Test(dependsOnMethods = "getPaginatedRequestAsAdmin")
public void updateOperation() throws OperationManagementException { public void updateOperation() throws OperationManagementException {
//This is required to introduce a delay for the update operation of the device.
try {
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
DeviceIdentifier deviceIdentifier = this.deviceIds.get(0); DeviceIdentifier deviceIdentifier = this.deviceIds.get(0);
List operations = this.operationMgtService.getPendingOperations(deviceIdentifier); List operations = this.operationMgtService.getPendingOperations(deviceIdentifier);
Assert.assertTrue(operations!= null && operations.size()==4); Assert.assertTrue(operations != null && operations.size() == 4);
Operation operation = (Operation) operations.get(0); Operation operation = (Operation) operations.get(0);
operation.setStatus(Operation.Status.COMPLETED); operation.setStatus(Operation.Status.COMPLETED);
operation.setOperationResponse("The operation is successfully completed"); operation.setOperationResponse("The operation is successfully completed");
@ -229,4 +265,110 @@ public class OperationManagementTests{
List pendingOperations = this.operationMgtService.getPendingOperations(deviceIdentifier); List pendingOperations = this.operationMgtService.getPendingOperations(deviceIdentifier);
Assert.assertEquals(pendingOperations.size(), 3); Assert.assertEquals(pendingOperations.size(), 3);
} }
@Test(dependsOnMethods = "updateOperation")
public void getNextPendingOperation() throws OperationManagementException {
DeviceIdentifier deviceIdentifier = this.deviceIds.get(0);
Operation operation = this.operationMgtService.getNextPendingOperation(deviceIdentifier);
Assert.assertTrue(operation.getType().equals(Operation.Type.POLICY));
}
@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));
Assert.assertTrue(operation.getStatus().equals(Operation.Status.COMPLETED));
Assert.assertTrue(operation.getType().equals(Operation.Type.COMMAND));
}
@Test(dependsOnMethods = "getOperationByDeviceAndOperationId")
public void getOperationsByDeviceAndStatus() throws OperationManagementException, DeviceManagementException {
DeviceIdentifier deviceIdentifier = this.deviceIds.get(0);
List operation = this.operationMgtService.getOperationsByDeviceAndStatus(deviceIdentifier, Operation.Status.PENDING);
Assert.assertEquals(operation.size(), 3);
}
@Test(dependsOnMethods = "getOperationsByDeviceAndStatus")
public void getOperation() throws OperationManagementException, DeviceManagementException {
String operationId = this.commandActivity.getActivityId().
replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, "");
Operation operation = this.operationMgtService.getOperation(Integer.parseInt(operationId));
Assert.assertEquals(operation.getType(), Operation.Type.COMMAND);
}
@Test(dependsOnMethods = "getOperation")
public void getOperationActivity() throws OperationManagementException {
Activity activity = this.operationMgtService.getOperationByActivityId(commandActivity.getActivityId());
Assert.assertEquals(activity.getType(), Activity.Type.COMMAND);
Assert.assertEquals(activity.getActivityStatus().size(), this.deviceIds.size());
Assert.assertEquals(activity.getActivityStatus().get(0).getStatus(), ActivityStatus.Status.COMPLETED);
for (int i = 1; i < this.deviceIds.size(); i++) {
Assert.assertEquals(activity.getActivityStatus().get(i).getStatus(), ActivityStatus.Status.PENDING);
}
}
@Test(dependsOnMethods = "getOperationActivity")
public void getOperationByActivityIdAndDevice() throws OperationManagementException {
Activity activity = this.operationMgtService.
getOperationByActivityIdAndDevice(this.commandActivity.getActivityId(), this.deviceIds.get(0));
Assert.assertEquals(activity.getType(), Activity.Type.COMMAND);
Assert.assertEquals(activity.getActivityStatus().size(), 1);
Assert.assertEquals(activity.getActivityStatus().get(0).getStatus(), ActivityStatus.Status.COMPLETED);
}
@Test(dependsOnMethods = "updateOperation")
public void getOperationUpdatedAfterWithLimitAndOffet() throws OperationManagementException, ParseException {
String timestamp = this.commandActivity.getCreatedTimeStamp();
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd hh:mm:ss Z yyyy");
dateFormat.setTimeZone(TimeZone.getTimeZone("IST"));
Date date = dateFormat.parse(timestamp);
List<Activity> operations = this.operationMgtService.getActivitiesUpdatedAfter(date.getTime() / 1000, 10, 0);
Assert.assertTrue(operations != null && operations.size() == 1,
"The operations updated after the created should be 1");
Activity operation = operations.get(0);
Assert.assertTrue(operation.getActivityStatus() != null && operation.getActivityStatus().size() == 1,
"The operation should be having the activity status of atleast one device");
Assert.assertEquals(operation.getActivityStatus().get(0).getDeviceIdentifier().getId(),
deviceIds.get(0).getId());
Assert.assertEquals(operation.getActivityStatus().get(0).getDeviceIdentifier().getType(),
deviceIds.get(0).getType());
}
@Test(dependsOnMethods = "updateOperation")
public void getOperationUpdatedAfter() throws OperationManagementException, ParseException {
String timestamp = this.commandActivity.getCreatedTimeStamp();
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd hh:mm:ss Z yyyy");
dateFormat.setTimeZone(TimeZone.getTimeZone("IST"));
Date date = dateFormat.parse(timestamp);
List<Activity> operations = this.operationMgtService.getActivitiesUpdatedAfter(date.getTime() / 1000);
Assert.assertTrue(operations != null && operations.size() == 1,
"The operations updated after the created should be 1");
Activity operation = operations.get(0);
Assert.assertTrue(operation.getActivityStatus() != null && operation.getActivityStatus().size() == 1,
"The operation should be having the activity status of atleast one device");
Assert.assertEquals(operation.getActivityStatus().get(0).getDeviceIdentifier().getId(),
deviceIds.get(0).getId());
Assert.assertEquals(operation.getActivityStatus().get(0).getDeviceIdentifier().getType(),
deviceIds.get(0).getType());
}
@Test(dependsOnMethods = "getOperationUpdatedAfter")
public void getActivityCountUpdatedAfter() throws OperationManagementException, ParseException {
String timestamp = this.commandActivity.getCreatedTimeStamp();
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd hh:mm:ss Z yyyy");
dateFormat.setTimeZone(TimeZone.getTimeZone("IST"));
Date date = dateFormat.parse(timestamp);
int activityCount = this.operationMgtService.getActivityCountUpdatedAfter(date.getTime() / 1000);
Assert.assertTrue(activityCount == 1,
"The activities updated after the created should be 1");
}
@Test
public void getNotificationStrategy() {
Assert.assertTrue(this.operationMgtService.getNotificationStrategy() != null);
}
} }

@ -0,0 +1,51 @@
/*
* 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.operation;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationContext;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationExecutionFailedException;
public class TestNotificationStrategy implements NotificationStrategy {
@Override
public void init() {
}
@Override
public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException {
}
@Override
public NotificationContext buildContext() {
return null;
}
@Override
public void undeploy() {
}
@Override
public PushNotificationConfig getConfig() {
return null;
}
}

@ -0,0 +1,121 @@
/*
* 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.permission.mgt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.testng.Assert;
import org.testng.IObjectFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.ObjectFactory;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.common.permission.mgt.Permission;
import org.wso2.carbon.device.mgt.common.permission.mgt.PermissionManagementException;
import org.wso2.carbon.device.mgt.common.permission.mgt.PermissionManagerService;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import java.util.Properties;
import static org.mockito.MockitoAnnotations.initMocks;
@PrepareForTest(PermissionUtils.class)
public class PermissionManagerServiceTest {
private static final Log log = LogFactory.getLog(PermissionManagerServiceTest.class);;
private static final String PERMISSION_URL = "permission/admin/device-mgt/test/testPermission";
private static final String PERMISSION_PATH = "permission/admin/device-mgt/test/testPermission";
private static final String PERMISSION_METHOD = "ui.execute";
private static final String PERMISSION_NAME = "Test Permission";
//For create properties to retrieve permission.
private static final String HTTP_METHOD = "HTTP_METHOD";
private static final String URL = "URL";
private Permission permission;
private PermissionManagerService permissionManagerService;
@ObjectFactory
public IObjectFactory getObjectFactory() {
return new org.powermock.modules.testng.PowerMockObjectFactory();
}
@BeforeClass
public void init() throws RegistryException {
initMocks(this);
permissionManagerService = PermissionManagerServiceImpl.getInstance();
this.permission = new Permission();
permission.setName(PERMISSION_NAME);
permission.setPath(PERMISSION_PATH);
permission.setMethod(PERMISSION_METHOD);
permission.setUrl(PERMISSION_URL);
}
@Test (description = "Create a new permission in the permission tree.")
public void testCreatePermission() {
try {
PowerMockito.mockStatic(PermissionUtils.class);
PowerMockito.when(PermissionUtils.putPermission(permission)).thenReturn(true);
Assert.assertTrue(permissionManagerService.addPermission(permission));
} catch (PermissionManagementException e) {
log.error("Error creating permission " + e.getErrorMessage());
}
}
@Test (dependsOnMethods = {"testCreatePermission"}, description = "Test for retrieving the created permission " +
"from the permission tree.")
public void testGetPermission() throws PermissionManagementException {
Permission permission = permissionManagerService.getPermission(createProperties());
Assert.assertEquals(permission.getMethod(), PERMISSION_METHOD);
Assert.assertEquals(permission.getName(), PERMISSION_NAME);
Assert.assertEquals(permission.getPath(), PERMISSION_PATH);
Assert.assertEquals(permission.getUrl(), PERMISSION_URL);
}
@Test (dependsOnMethods = {"testCreatePermission"},
expectedExceptions = {PermissionManagementException.class},
expectedExceptionsMessageRegExp = "Resource URI/HTTP method is empty")
public void testGetPermissionError() throws PermissionManagementException {
Permission permission = permissionManagerService.getPermission(createErrorProperty());
}
/**
* Create a Property object which will be passed to getPermission method to retrieve a permission.
* @return : Property object which contains permission url and method.
* */
private Properties createProperties() {
Properties properties = new Properties();
properties.setProperty(URL, PERMISSION_URL);
properties.setProperty(HTTP_METHOD, PERMISSION_METHOD);
return properties;
}
/**
* Creates property object with empty properties.
* @return : Properties object with empty set of properties.
* */
private Properties createErrorProperty() {
Properties properties = new Properties();
properties.setProperty(URL, "");
properties.setProperty(HTTP_METHOD, "");
return properties;
}
}

@ -42,7 +42,7 @@ import java.util.List;
public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest { public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest {
GroupManagementProviderService groupManagementProviderService; private GroupManagementProviderService groupManagementProviderService;
private static final String DEFAULT_ADMIN_ROLE = "admin"; private static final String DEFAULT_ADMIN_ROLE = "admin";
private static final String[] DEFAULT_ADMIN_PERMISSIONS = {"/permission/device-mgt/admin/groups", private static final String[] DEFAULT_ADMIN_PERMISSIONS = {"/permission/device-mgt/admin/groups",
"/permission/device-mgt/user/groups"}; "/permission/device-mgt/user/groups"};
@ -54,6 +54,7 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest
RealmService realmService = new InMemoryRealmService(); RealmService realmService = new InMemoryRealmService();
DeviceManagementDataHolder.getInstance().setRealmService(realmService); DeviceManagementDataHolder.getInstance().setRealmService(realmService);
realmService.getTenantManager().getSuperTenantDomain(); realmService.getTenantManager().getSuperTenantDomain();
DeviceConfigurationManager.getInstance().initConfig();
} }
@Test(expectedExceptions = {GroupManagementException.class, GroupAlreadyExistException.class}) @Test(expectedExceptions = {GroupManagementException.class, GroupAlreadyExistException.class})
@ -71,24 +72,32 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest
@Test @Test
public void createGroup() throws GroupManagementException, GroupAlreadyExistException { public void createGroup() throws GroupManagementException, GroupAlreadyExistException {
groupManagementProviderService.createGroup(TestUtils.createDeviceGroup1(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS); groupManagementProviderService.createGroup(TestUtils.createDeviceGroup1(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
groupManagementProviderService.createGroup(TestUtils.createDeviceGroup2(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS); groupManagementProviderService.createGroup(TestUtils.createDeviceGroup2(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
groupManagementProviderService.createGroup(TestUtils.createDeviceGroup3(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS); groupManagementProviderService.createGroup(TestUtils.createDeviceGroup3(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
groupManagementProviderService.createGroup(TestUtils.createDeviceGroup4(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS); groupManagementProviderService.createGroup(TestUtils.createDeviceGroup4(), DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS);
} }
@Test(dependsOnMethods = ("createGroup")) @Test(dependsOnMethods = ("createGroup"))
public void updateGroup() throws GroupManagementException, GroupNotExistException { public void updateGroup() throws GroupManagementException, GroupNotExistException {
DeviceGroup deviceGroup = groupManagementProviderService.getGroup(TestUtils.createDeviceGroup1().getName()); DeviceGroup deviceGroup = groupManagementProviderService.getGroup(TestUtils.createDeviceGroup1().getName());
deviceGroup.setName(deviceGroup.getName() + "_UPDATED"); deviceGroup.setName(deviceGroup.getName() + "_UPDATED");
groupManagementProviderService.updateGroup(deviceGroup, deviceGroup.getGroupId()); groupManagementProviderService.updateGroup(deviceGroup, deviceGroup.getGroupId());
} }
@Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class})
public void getGroupNull() throws GroupManagementException, GroupNotExistException {
groupManagementProviderService.getGroup(null);
}
// Rename again to use in different place.
@Test(dependsOnMethods = ("updateGroup"))
public void updateGroupSecondTime() throws GroupManagementException, GroupNotExistException {
DeviceGroup deviceGroup = groupManagementProviderService.getGroup(TestUtils.createDeviceGroup1().getName() + "_UPDATED");
deviceGroup.setName(TestUtils.createDeviceGroup1().getName());
groupManagementProviderService.updateGroup(deviceGroup, deviceGroup.getGroupId());
}
@Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class, GroupNotExistException.class}) @Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class, GroupNotExistException.class})
public void updateGroupError() throws GroupManagementException, GroupNotExistException { public void updateGroupError() throws GroupManagementException, GroupNotExistException {
groupManagementProviderService.updateGroup(null, 1); groupManagementProviderService.updateGroup(null, 1);
@ -96,7 +105,6 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest
@Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class, GroupNotExistException.class}) @Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class, GroupNotExistException.class})
public void updateGroupErrorNotExist() throws GroupManagementException, GroupNotExistException { public void updateGroupErrorNotExist() throws GroupManagementException, GroupNotExistException {
DeviceGroup deviceGroup = groupManagementProviderService.getGroup(TestUtils.createDeviceGroup2().getName()); DeviceGroup deviceGroup = groupManagementProviderService.getGroup(TestUtils.createDeviceGroup2().getName());
deviceGroup.setName(deviceGroup.getName() + "_UPDATED"); deviceGroup.setName(deviceGroup.getName() + "_UPDATED");
groupManagementProviderService.updateGroup(deviceGroup, 6); groupManagementProviderService.updateGroup(deviceGroup, 6);
@ -141,8 +149,7 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest
@Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class}) @Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class})
public void getGroupsByUsernameError() throws GroupManagementException { public void getGroupsByUsernameError() throws GroupManagementException {
String username = null; groupManagementProviderService.getGroups((String) null);
groupManagementProviderService.getGroups(username);
} }
@Test(dependsOnMethods = ("createGroup")) @Test(dependsOnMethods = ("createGroup"))
@ -158,12 +165,19 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest
} }
@Test(dependsOnMethods = ("createGroup")) @Test(dependsOnMethods = ("createGroup"))
public void getGroupsByUsernameAndPagination(String username, GroupPaginationRequest paginationRequest) public void getGroupsByUsernameAndPagination()
throws GroupManagementException { throws GroupManagementException {
PaginationResult result = groupManagementProviderService.getGroups(username, paginationRequest); PaginationResult result = groupManagementProviderService.getGroups("admin", TestUtils.createPaginationRequest());
Assert.assertNotNull(result); Assert.assertNotNull(result);
} }
@Test(dependsOnMethods = ("createGroup"), expectedExceptions = {GroupManagementException.class})
public void getGroupsByUsernameAndPaginationError()
throws GroupManagementException {
groupManagementProviderService.getGroups(null, TestUtils.createPaginationRequest());
}
@Test(dependsOnMethods = ("createGroup")) @Test(dependsOnMethods = ("createGroup"))
public void getGroupCount() throws GroupManagementException { public void getGroupCount() throws GroupManagementException {
int x = groupManagementProviderService.getGroupCount(); int x = groupManagementProviderService.getGroupCount();
@ -176,27 +190,28 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest
Assert.assertNotNull(x); Assert.assertNotNull(x);
} }
// @Test @Test(dependsOnMethods = ("updateGroupSecondTime"))
// public void manageGroupSharing() throws GroupManagementException, RoleDoesNotExistException, UserStoreException { public void manageGroupSharing() throws GroupManagementException, RoleDoesNotExistException, UserStoreException {
// groupManagementProviderService.manageGroupSharing(0, null); groupManagementProviderService.manageGroupSharing(0, null);
// List<String> newRoles = new ArrayList<>(); List<String> newRoles = new ArrayList<>();
// newRoles.add("TEST_ROLE_1"); newRoles.add("TEST_ROLE_1");
// newRoles.add("TEST_ROLE_2"); newRoles.add("TEST_ROLE_2");
// newRoles.add("TEST_ROLE_3"); newRoles.add("TEST_ROLE_3");
//
// UserStoreManager userStoreManager = UserStoreManager userStoreManager =
// DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm( DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(
// -1234).getUserStoreManager(); -1234).getUserStoreManager();
// Permission[] permissions = new Permission[1]; Permission[] permissions = new Permission[1];
// Permission perm = new Permission("/admin/test/perm", "add"); Permission perm = new Permission("/admin/test/perm", "add");
//// perm.setAction("execute.ui"); permissions[0] = perm;
//// perm.setResourceId("/admin/test/perm");
// permissions[0] = perm; userStoreManager.addRole("TEST_ROLE_1", null, permissions);
// userStoreManager.addRole("TEST_ROLE_2", null, permissions);
// userStoreManager.addRole("TEST_ROLE_1", null, permissions); userStoreManager.addRole("TEST_ROLE_3", null, permissions);
//
// groupManagementProviderService.manageGroupSharing(1, newRoles); groupManagementProviderService.manageGroupSharing(groupManagementProviderService.getGroup(
// } TestUtils.createDeviceGroup1().getName()).getGroupId(), newRoles);
}
@Test(dependsOnMethods = ("createGroup")) @Test(dependsOnMethods = ("createGroup"))
public void getRoles() throws GroupManagementException { public void getRoles() throws GroupManagementException {
@ -216,26 +231,30 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest
Assert.assertEquals(0, x); Assert.assertEquals(0, x);
} }
// @Test(dependsOnMethods = ("createGroup")) @Test(dependsOnMethods = ("createGroup"))
// public void addDevices() throws GroupManagementException, DeviceNotFoundException { public void addDevices() throws GroupManagementException, DeviceNotFoundException {
//
// DeviceCacheConfiguration configuration = new DeviceCacheConfiguration(); DeviceCacheConfiguration configuration = new DeviceCacheConfiguration();
// configuration.setEnabled(false); configuration.setEnabled(false);
//
// DeviceConfigurationManager.getInstance().getDeviceManagementConfig().setDeviceCacheConfiguration(configuration); DeviceConfigurationManager.getInstance().getDeviceManagementConfig().setDeviceCacheConfiguration(configuration);
// List<DeviceIdentifier> list = TestUtils.getDeviceIdentifiersList();
// List<DeviceIdentifier> list = TestUtils.getDeviceIdentifiersList(); groupManagementProviderService.addDevices(groupManagementProviderService.getGroup(
// groupManagementProviderService.addDevices(1, list); TestUtils.createDeviceGroup1().getName()).getGroupId(), list);
// groupManagementProviderService.addDevices(2, list); groupManagementProviderService.addDevices(groupManagementProviderService.getGroup(
// groupManagementProviderService.addDevices(3, list); TestUtils.createDeviceGroup2().getName()).getGroupId(), list);
// } groupManagementProviderService.addDevices(groupManagementProviderService.getGroup(
// TestUtils.createDeviceGroup3().getName()).getGroupId(), list);
// @Test(dependsOnMethods = ("addDevices")) }
// public void removeDevice() throws GroupManagementException, DeviceNotFoundException {
// List<DeviceIdentifier> list = TestUtils.getDeviceIdentifiersList(); @Test(dependsOnMethods = ("addDevices"))
// groupManagementProviderService.removeDevice(2, list); public void removeDevice() throws GroupManagementException, DeviceNotFoundException {
// groupManagementProviderService.removeDevice(3, list); List<DeviceIdentifier> list = TestUtils.getDeviceIdentifiersList();
// } groupManagementProviderService.removeDevice(groupManagementProviderService.getGroup(
TestUtils.createDeviceGroup2().getName()).getGroupId(), list);
groupManagementProviderService.removeDevice(groupManagementProviderService.getGroup(
TestUtils.createDeviceGroup3().getName()).getGroupId(), list);
}
@Test(dependsOnMethods = ("createGroup")) @Test(dependsOnMethods = ("createGroup"))
public void getGroupsByUsernameAndPermissions() throws GroupManagementException { public void getGroupsByUsernameAndPermissions() throws GroupManagementException {
@ -243,18 +262,24 @@ public class GroupManagementProviderServiceTest extends BaseDeviceManagementTest
Assert.assertNotNull(groups); Assert.assertNotNull(groups);
} }
// @Test(dependsOnMethods = ("addDevices")) @Test(dependsOnMethods = ("addDevices"))
// public void getGroupsByDeviceIdentifier() throws GroupManagementException { public void getGroupsByDeviceIdentifier() throws GroupManagementException {
// DeviceIdentifier identifier = new DeviceIdentifier(); DeviceIdentifier identifier = new DeviceIdentifier();
// identifier.setId("12345"); identifier.setId("12345");
// identifier.setType("Test"); identifier.setType("Test");
// List<DeviceGroup> groups = groupManagementProviderService.getGroups(identifier); List<DeviceGroup> groups = groupManagementProviderService.getGroups(identifier);
// Assert.assertNull(groups); Assert.assertNotNull(groups);
// } }
@Test @Test
public void createDefaultGroup() throws GroupManagementException { public void createDefaultGroup() throws GroupManagementException {
groupManagementProviderService.createDefaultGroup("BYOD"); groupManagementProviderService.createDefaultGroup("BYOD");
} }
@Test(dependsOnMethods = ("createDefaultGroup"))
public void createDefaultGroupTwice() throws GroupManagementException {
groupManagementProviderService.createDefaultGroup("BYOD");
}
} }

@ -42,6 +42,8 @@
<class name="org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderServiceTest"/> <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.service.GroupManagementProviderServiceTest"/>
<class name="org.wso2.carbon.device.mgt.core.operation.OperationManagementTests"/> <class name="org.wso2.carbon.device.mgt.core.operation.OperationManagementTests"/>
<class name="org.wso2.carbon.device.mgt.core.permission.mgt.PermissionManagerServiceTest" />
<class name="org.wso2.carbon.device.mgt.core.notification.mgt.NotificationManagementServiceImplTests"/>
</classes> </classes>
</test> </test>
</suite> </suite>

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.115-SNAPSHOT</version> <version>3.0.118-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -77,7 +77,37 @@
<artifactId>org.wso2.carbon.device.mgt.extensions.pull.notification</artifactId> <artifactId>org.wso2.carbon.device.mgt.extensions.pull.notification</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp.wso2</groupId>
<artifactId>commons-dbcp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-pool.wso2</groupId>
<artifactId>commons-pool</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.registry.extensions</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>
<artifactId>org.wso2.carbon.registry.indexing</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -433,8 +433,11 @@ public class DeviceTypeManager implements DeviceManager {
if (propertiesExist) { if (propertiesExist) {
boolean status; boolean status;
Device existingDevice = this.getDevice(deviceIdentifier); Device existingDevice = this.getDevice(deviceIdentifier);
existingDevice.setProperties(device.getProperties());
if (existingDevice == null) {
return false;
}
existingDevice.setProperties(device.getProperties());
try { try {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug( log.debug(

@ -252,21 +252,24 @@ public class DeviceTypePluginDAOImpl implements PluginDAO {
} }
private void initializeDbQueries() { private void initializeDbQueries() {
selectDBQueryForGetDevice = "SELECT " + getDeviceTableColumnNames() + " FROM " + selectDBQueryForGetDevice =
deviceDAODefinition.getDeviceTableName() + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?"; "SELECT " + getDeviceTableColumnNames() + " FROM " + deviceDAODefinition.getDeviceTableName()
+ " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?";
createDBqueryForAddDevice = "INSERT INTO " + deviceDAODefinition.getDeviceTableName() + "(" createDBqueryForAddDevice =
+ deviceDAODefinition.getPrimaryKey() + " , " + getDeviceTableColumnNames() + ") VALUES (" "INSERT INTO " + deviceDAODefinition.getDeviceTableName() + "(" + deviceDAODefinition.getPrimaryKey()
+ getPreparedInputString(deviceDAODefinition.getColumnNames().size() + 1) + ")"; + " , " + getDeviceTableColumnNames() + ") VALUES (" + getPreparedInputString(
deviceDAODefinition.getColumnNames().size() + 1) + ")";
updateDBQueryForUpdateDevice = "UPDATE " + deviceDAODefinition.getDeviceTableName() + " SET " updateDBQueryForUpdateDevice = "UPDATE " + deviceDAODefinition.getDeviceTableName() + " SET "
+ getDeviceTableColumnNamesForUpdateQuery() + " WHERE " + deviceDAODefinition.getPrimaryKey() + getDeviceTableColumnNamesForUpdateQuery() + " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?";
+ " = ?";
deleteDBQueryToRemoveDevicd = "DELETE FROM " + deviceDAODefinition.getDeviceTableName() deleteDBQueryToRemoveDevicd =
+ " WHERE " + deviceDAODefinition.getPrimaryKey() + " = ?"; "DELETE FROM " + deviceDAODefinition.getDeviceTableName() + " WHERE " + deviceDAODefinition
.getPrimaryKey() + " = ?";
selectDBQueryToGetAllDevice = "SELECT " + getDeviceTableColumnNames() + " FROM " selectDBQueryToGetAllDevice =
+ deviceDAODefinition.getDeviceTableName(); "SELECT " + getDeviceTableColumnNames() + "," + deviceDAODefinition.getPrimaryKey() + " FROM "
+ deviceDAODefinition.getDeviceTableName();
} }
} }

@ -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.device.type.template;
import org.testng.annotations.BeforeSuite;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.context.RegistryType;
import org.wso2.carbon.context.internal.OSGiDataHolder;
import org.wso2.carbon.device.mgt.extensions.internal.DeviceTypeExtensionDataHolder;
import org.wso2.carbon.device.mgt.extensions.utils.Utils;
import org.wso2.carbon.governance.api.util.GovernanceArtifactConfiguration;
import org.wso2.carbon.governance.api.util.GovernanceUtils;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.registry.core.session.UserRegistry;
import org.wso2.carbon.utils.FileUtil;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import static org.wso2.carbon.governance.api.util.GovernanceUtils.getGovernanceArtifactConfiguration;
/**
* This class handles all the setup that need to be done before starting to run the test cases.
*/
public class BaseExtensionsTest {
@BeforeSuite
public void init() throws RegistryException, IOException {
ClassLoader classLoader = getClass().getClassLoader();
URL resourceUrl = classLoader.getResource("license.rxt");
String rxt = null;
File carbonHome;
if (resourceUrl != null) {
rxt = FileUtil.readFileToString(resourceUrl.getFile());
}
resourceUrl = classLoader.getResource("carbon-home");
if (resourceUrl != null) {
carbonHome = new File(resourceUrl.getFile());
System.setProperty("carbon.home", carbonHome.getAbsolutePath());
}
PrivilegedCarbonContext.getThreadLocalCarbonContext()
.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID);
RegistryService registryService = Utils.getRegistryService();
OSGiDataHolder.getInstance().setRegistryService(registryService);
UserRegistry systemRegistry =
registryService.getRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME);
GovernanceArtifactConfiguration configuration = getGovernanceArtifactConfiguration(rxt);
List<GovernanceArtifactConfiguration> configurations = new ArrayList<>();
configurations.add(configuration);
GovernanceUtils.loadGovernanceArtifacts(systemRegistry, configurations);
Registry governanceSystemRegistry = registryService.getConfigSystemRegistry();
DeviceTypeExtensionDataHolder.getInstance().setRegistryService(registryService);
PrivilegedCarbonContext.getThreadLocalCarbonContext()
.setRegistry(RegistryType.SYSTEM_CONFIGURATION, governanceSystemRegistry);
}
}

@ -31,6 +31,8 @@ import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; 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.configuration.mgt.PlatformConfiguration;
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.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceStatusTaskConfiguration; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceStatusTaskConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration;
@ -40,6 +42,7 @@ import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PushNot
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.TaskConfiguration; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.TaskConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException;
import org.wso2.carbon.device.mgt.extensions.utils.Utils; import org.wso2.carbon.device.mgt.extensions.utils.Utils;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
@ -63,6 +66,8 @@ public class DeviceTypeManagerServiceTest {
private DeviceTypeConfiguration androidDeviceConfiguration; private DeviceTypeConfiguration androidDeviceConfiguration;
private DeviceTypeManagerService rasberrypiDeviceTypeManagerService; private DeviceTypeManagerService rasberrypiDeviceTypeManagerService;
private DeviceTypeConfiguration rasberrypiDeviceConfiguration; private DeviceTypeConfiguration rasberrypiDeviceConfiguration;
private DeviceTypeManagerService arduinoDeviceTypeManagerService;
private DeviceTypeConfiguration arduinoDeviceTypeConfiguration;
private Method setProvisioningConfig; private Method setProvisioningConfig;
private Method setOperationMonitoringConfig; private Method setOperationMonitoringConfig;
private Method setDeviceStatusTaskPluginConfig; private Method setDeviceStatusTaskPluginConfig;
@ -73,7 +78,9 @@ public class DeviceTypeManagerServiceTest {
@BeforeTest @BeforeTest
public void setup() throws NoSuchMethodException, SAXException, JAXBException, ParserConfigurationException, public void setup() throws NoSuchMethodException, SAXException, JAXBException, ParserConfigurationException,
DeviceTypeConfigurationException, IOException, NoSuchFieldException, IllegalAccessException, DeviceTypeConfigurationException, IOException, NoSuchFieldException, IllegalAccessException,
DeviceManagementException { DeviceManagementException, RegistryException {
ClassLoader classLoader = getClass().getClassLoader();
setProvisioningConfig = DeviceTypeManagerService.class setProvisioningConfig = DeviceTypeManagerService.class
.getDeclaredMethod("setProvisioningConfig", String.class, DeviceTypeConfiguration.class); .getDeclaredMethod("setProvisioningConfig", String.class, DeviceTypeConfiguration.class);
setProvisioningConfig.setAccessible(true); setProvisioningConfig.setAccessible(true);
@ -117,7 +124,6 @@ public class DeviceTypeManagerServiceTest {
operationMonitoringConfigs.set(rasberrypiDeviceTypeManagerService, new OperationMonitoringTaskConfig()); operationMonitoringConfigs.set(rasberrypiDeviceTypeManagerService, new OperationMonitoringTaskConfig());
initialOperationConfig.set(rasberrypiDeviceTypeManagerService, new InitialOperationConfig()); initialOperationConfig.set(rasberrypiDeviceTypeManagerService, new InitialOperationConfig());
ClassLoader classLoader = getClass().getClassLoader();
URL resourceUrl = classLoader.getResource("android.xml"); URL resourceUrl = classLoader.getResource("android.xml");
File androidConfiguration = null; File androidConfiguration = null;
@ -143,14 +149,10 @@ public class DeviceTypeManagerServiceTest {
configurationEntries.add(configurationEntry); configurationEntries.add(configurationEntry);
platformConfiguration.setConfiguration(configurationEntries); platformConfiguration.setConfiguration(configurationEntries);
if (androidConfiguration != null) {
// This is needed for DeviceTypeManager Initialization
System.setProperty("carbon.home", androidConfiguration.getAbsolutePath());
}
DeviceTypeManager deviceTypeManager = Mockito.mock(DeviceTypeManager.class); DeviceTypeManager deviceTypeManager = Mockito.mock(DeviceTypeManager.class);
when(deviceTypeManager.getConfiguration()).thenReturn(platformConfiguration); when(deviceTypeManager.getConfiguration()).thenReturn(platformConfiguration);
deviceManager.set(androidDeviceTypeManagerService, deviceTypeManager); deviceManager.set(androidDeviceTypeManagerService, deviceTypeManager);
setupArduinoDeviceType();
} }
@Test(description = "This test cases tests the retrieval of provisioning config after providing the configurations " @Test(description = "This test cases tests the retrieval of provisioning config after providing the configurations "
@ -164,7 +166,7 @@ public class DeviceTypeManagerServiceTest {
ProvisioningConfig provisioningConfig = androidDeviceTypeManagerService.getProvisioningConfig(); ProvisioningConfig provisioningConfig = androidDeviceTypeManagerService.getProvisioningConfig();
Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(),
androidDeviceConfiguration.getProvisioningConfig().isSharedWithAllTenants(), androidDeviceConfiguration.getProvisioningConfig().isSharedWithAllTenants(),
"Provisioning configs " + "are not correctly set as per the configuration file provided"); "Provisioning configs are not correctly set as per the configuration file provided");
setProvisioningConfig.invoke(rasberrypiDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, setProvisioningConfig.invoke(rasberrypiDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME,
rasberrypiDeviceConfiguration); rasberrypiDeviceConfiguration);
@ -273,4 +275,42 @@ public class DeviceTypeManagerServiceTest {
rasberrypiDeviceConfiguration.getPullNotificationSubscriberConfig() != null); rasberrypiDeviceConfiguration.getPullNotificationSubscriberConfig() != null);
} }
@Test (description = "This test case tests the addition and retrieval of the license")
public void testGetLicense () throws LicenseManagementException {
License license = arduinoDeviceTypeManagerService.getDeviceManager().getLicense("en_Us");
Assert.assertEquals(license.getText(), arduinoDeviceTypeConfiguration.getLicense().getText(),
"The retrieved" + " license is different from added license");
license.setLanguage("eu");
license.setText("This is a EU License");
arduinoDeviceTypeManagerService.getDeviceManager().addLicense(license);
License newLicense = arduinoDeviceTypeManagerService.getDeviceManager().getLicense("eu");
Assert.assertEquals(newLicense.getText(), license.getText(),
"The retrieved license is different from added license");
Assert.assertNull(arduinoDeviceTypeManagerService.getDeviceManager().getLicense("tn"),
"License is retrieved for a non-existing language code");
}
/**
* Setting the Arduino Device Type
* @throws RegistryException Registry Exception
* @throws IOException IO Exception
* @throws SAXException SAX Exception
* @throws ParserConfigurationException Parser Configuration Exception
* @throws DeviceTypeConfigurationException Device Type Configuration Exception
* @throws JAXBException JAXB Exception
*/
private void setupArduinoDeviceType()
throws RegistryException, IOException, SAXException, ParserConfigurationException,
DeviceTypeConfigurationException, JAXBException {
ClassLoader classLoader = getClass().getClassLoader();
URL resourceUrl = classLoader.getResource("arduino.xml");
File raspberrypiConfiguration = null;
if (resourceUrl != null) {
raspberrypiConfiguration = new File(resourceUrl.getFile());
}
arduinoDeviceTypeConfiguration = Utils.getDeviceTypeConfiguration(raspberrypiConfiguration);
arduinoDeviceTypeManagerService = new DeviceTypeManagerService(new
DeviceTypeConfigIdentifier("arduino", "carbon.super"), arduinoDeviceTypeConfiguration);
}
} }

@ -0,0 +1,228 @@
/*
* 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.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
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.PlatformConfiguration;
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.dao.DeviceDAODefinition;
import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceTypeDAOHandler;
import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOImpl;
import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOManager;
import org.wso2.carbon.device.mgt.extensions.utils.Utils;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
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.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* This class tests the {@link DeviceTypeManager}
*/
public class DeviceTypeManagerTest {
private DeviceTypeManager androidDeviceTypeManager;
private DeviceIdentifier nonExistingDeviceIdentifier;
private Device sampleDevice1;
private Device sampleDevice2;
private String androidDeviceType;
@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");
androidDeviceType = "android";
File androidDatabaseScript = null;
javax.sql.DataSource dataSource = null;
File carbonHome = new File("src/test/resources/carbon-home");
if (resourceUrl != null) {
androidDatabaseScript = new File(resourceUrl.getFile());
}
if (carbonHome.exists()) {
System.setProperty("carbon.home", carbonHome.getAbsolutePath());
}
resourceUrl = classLoader.getResource("android.xml");
File androidConfiguration = null;
if (resourceUrl != null) {
androidConfiguration = new File(resourceUrl.getFile());
}
DeviceTypeConfiguration androidDeviceConfiguration = Utils.getDeviceTypeConfiguration(androidConfiguration);
androidDeviceTypeManager = Mockito.mock(DeviceTypeManager.class, Mockito.CALLS_REAL_METHODS);
if (androidDatabaseScript != null) {
dataSource = Utils.createDataTables("deviceType", androidDatabaseScript.getAbsolutePath());
}
DeviceTypePluginDAOManager deviceTypePluginDAOManager = createMockDeviceTypePluginDAOManager(dataSource,
androidDeviceConfiguration);
Field deviceTypePluginDAOManagerField = DeviceTypeManager.class.getDeclaredField("deviceTypePluginDAOManager");
deviceTypePluginDAOManagerField.setAccessible(true);
deviceTypePluginDAOManagerField.set(androidDeviceTypeManager, deviceTypePluginDAOManager);
Field propertiesExist = DeviceTypeManager.class.getDeclaredField("propertiesExist");
propertiesExist.setAccessible(true);
Field deviceType = DeviceTypeManager.class.getDeclaredField("deviceType");
deviceType.setAccessible(true);
deviceType.set(androidDeviceTypeManager, androidDeviceType);
propertiesExist.set(androidDeviceTypeManager, true);
createDevice();
}
@Test(description = "This test case tests IsEnrolled method of the DeviceTypeManager",
dependsOnMethods = {"testEnrollDevice"})
public void testIsEnrolled() throws DeviceManagementException {
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(sampleDevice2.getDeviceIdentifier(),
sampleDevice2.getType());
Assert.assertTrue(!androidDeviceTypeManager.isEnrolled(nonExistingDeviceIdentifier),
"Device with " + "NON-Existing ID is not enrolled, but this shows as enrolled");
Assert.assertTrue(androidDeviceTypeManager.isEnrolled(deviceIdentifier),
"Enrolled device is shown as un-enrolled");
}
@Test(description = "This test case tests the getDevcie method of the DeviceTypeManager", dependsOnMethods =
{"testEnrollDevice"})
public void testGetDevice() throws DeviceManagementException {
DeviceIdentifier existingDeviceIdntifier = new DeviceIdentifier(sampleDevice2.getDeviceIdentifier(),
androidDeviceType);
Assert.assertNull(androidDeviceTypeManager.getDevice(nonExistingDeviceIdentifier),
"Non existing sampleDevice was retrieved");
Assert.assertNotNull(androidDeviceTypeManager.getDevice(existingDeviceIdntifier),
"Existing sampleDevice was retrieved");
}
@Test(description = "This test case tests the enrollment of the device")
public void testEnrollDevice() throws DeviceManagementException {
Assert.assertTrue(androidDeviceTypeManager.enrollDevice(sampleDevice1));
Assert.assertTrue(!androidDeviceTypeManager.enrollDevice(sampleDevice2));
}
@Test(description = "This test case tests the get all devices method of the DeviceTypeManager", dependsOnMethods
= {"testEnrollDevice"})
public void testGetAllDevices() throws DeviceManagementException {
Assert.assertEquals(androidDeviceTypeManager.getAllDevices().size(), 1,
"All the added devices are not fetched " + "from the database");
}
@Test(description = "This test case tests the addition of platform configuration and retrieval of the same")
public void testAddPlatformConfiguration() throws RegistryException, DeviceManagementException {
PlatformConfiguration platformConfiguration = new PlatformConfiguration();
platformConfiguration.setType(androidDeviceType);
androidDeviceTypeManager.saveConfiguration(platformConfiguration);
androidDeviceTypeManager.getConfiguration();
PlatformConfiguration actualPlatformConfiguration = androidDeviceTypeManager.getConfiguration();
Assert.assertNotNull(actualPlatformConfiguration,
"Platform Configuration saved and retrieved correctly in " + "DeviceType Manager");
Assert.assertEquals(actualPlatformConfiguration.getType(), androidDeviceType,
"Platform Configuration saved and " + "retrieved correctly in DeviceType Manager");
}
@Test (description = "This test case tests the getDefaultConfiguration method")
public void testGetDefaultConfiguration()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Method getDefaultConfiguration = DeviceTypeManager.class.getDeclaredMethod("getDefaultConfiguration");
getDefaultConfiguration.setAccessible(true);
Assert.assertNull(getDefaultConfiguration.invoke(androidDeviceTypeManager), "Default configuration file "
+ "retrieved even without adding the configuration for the device type android");
}
@Test (description = "This test case tests the updateDeviceInfo method")
public void testUpdateDeviceInfo() throws DeviceManagementException {
DeviceIdentifier existingDeviceIdentifier = new DeviceIdentifier(sampleDevice2.getDeviceIdentifier(),
androidDeviceType);
Assert.assertFalse(androidDeviceTypeManager.updateDeviceInfo(nonExistingDeviceIdentifier, sampleDevice1),
"Non-existing device was updated");
Assert.assertTrue(androidDeviceTypeManager.updateDeviceInfo(existingDeviceIdentifier, sampleDevice1),
"Existing device update failed");
}
/**
* To create a sample sampleDevice to add to DAO Layer.
*/
private void createDevice() {
nonExistingDeviceIdentifier = new DeviceIdentifier("NON-EXISTING", androidDeviceType);
List<Device.Property> list = new ArrayList<>();
String[] deviceTypeAttributes = { "FCM_TOKEN", "DEVICE_INFO", "IMEI", "IMSI", "OS_VERSION", "DEVICE_MODEL",
"VENDOR", "LATITUDE", "LONGITUDE", "SERIAL", "MAC_ADDRESS", "DEVICE_NAME", "DEVICE_NAME",
"OS_BUILD_DATE" };
for (String deviceTypeAttribute : deviceTypeAttributes) {
Device.Property property = new Device.Property();
property.setName(deviceTypeAttribute);
property.setValue(deviceTypeAttribute + "T");
list.add(property);
}
sampleDevice1 = new Device("testdevice", androidDeviceType, "test", "testdevice", null, null, list);
sampleDevice2 = new Device("testdevice1", androidDeviceType, "test", "testdevice", null, null, list);
}
/*
* To create a mock sampleDevice type plugin dao manager.
* @param dataSource DataSource for the DAO layer
* @param androidDeviceConfiguration Android Device Configuration
* @return Mock Device Type Plugin DAO Manager
* @throws NoSuchFieldException No Such Field Exception
* @throws IllegalAccessException Illegal Access Exception
*/
private DeviceTypePluginDAOManager createMockDeviceTypePluginDAOManager(javax.sql.DataSource dataSource,
DeviceTypeConfiguration androidDeviceConfiguration) throws NoSuchFieldException, IllegalAccessException {
Field datasourceField = DeviceTypeDAOHandler.class.getDeclaredField("dataSource");
datasourceField.setAccessible(true);
Field currentConnection = DeviceTypeDAOHandler.class.getDeclaredField("currentConnection");
currentConnection.setAccessible(true);
DeviceTypeDAOHandler deviceTypeDAOHandler = Mockito
.mock(DeviceTypeDAOHandler.class, Mockito.CALLS_REAL_METHODS);
datasourceField.set(deviceTypeDAOHandler, dataSource);
currentConnection.set(deviceTypeDAOHandler, new ThreadLocal<Connection>());
DeviceDAODefinition deviceDAODefinition = Utils.getDeviceDAODefinition(androidDeviceConfiguration);
DeviceTypePluginDAOImpl deviceTypePluginDAO = new DeviceTypePluginDAOImpl(deviceDAODefinition,
deviceTypeDAOHandler);
DeviceTypePluginDAOManager deviceTypePluginDAOManager = Mockito
.mock(DeviceTypePluginDAOManager.class, Mockito.CALLS_REAL_METHODS);
Field deviceTypePluginDAOField = DeviceTypePluginDAOManager.class.getDeclaredField("deviceTypePluginDAO");
deviceTypePluginDAOField.setAccessible(true);
Field deviceTypeDAOHandlerField = DeviceTypePluginDAOManager.class.getDeclaredField("deviceTypeDAOHandler");
deviceTypeDAOHandlerField.setAccessible(true);
deviceTypePluginDAOField.set(deviceTypePluginDAOManager, deviceTypePluginDAO);
deviceTypeDAOHandlerField.set(deviceTypePluginDAOManager, deviceTypeDAOHandler);
return deviceTypePluginDAOManager;
}
}

@ -0,0 +1,157 @@
/*
* 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.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.context.RegistryType;
import org.wso2.carbon.context.internal.OSGiDataHolder;
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.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;
import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeMetaDefinition;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Feature;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Operation;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PushNotificationProvider;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException;
import org.wso2.carbon.device.mgt.extensions.internal.DeviceTypeExtensionDataHolder;
import org.wso2.carbon.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager;
import org.wso2.carbon.device.mgt.extensions.utils.Utils;
import org.wso2.carbon.governance.api.util.GovernanceArtifactConfiguration;
import org.wso2.carbon.governance.api.util.GovernanceUtils;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.registry.core.session.UserRegistry;
import org.wso2.carbon.utils.FileUtil;
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;
import java.util.ArrayList;
import java.util.List;
import static org.wso2.carbon.governance.api.util.GovernanceUtils.getGovernanceArtifactConfiguration;
/**
* This test case contains the tests for {@link HTTPDeviceTypeManagerService} and {@link DeviceTypeGeneratorServiceImpl}
*/
public class HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest {
private DeviceTypeMetaDefinition deviceTypeMetaDefinition;
private HTTPDeviceTypeManagerService httpDeviceTypeManagerService;
private DeviceTypeGeneratorServiceImpl deviceTypeGeneratorService;
private String androidSenseDeviceType = "androidsense";
private String sampleDeviceType = "sample";
@BeforeTest
public void setup() throws RegistryException, IOException, SAXException, ParserConfigurationException,
DeviceTypeConfigurationException, JAXBException {
createSampleDeviceTypeMetaDefinition();
httpDeviceTypeManagerService = new HTTPDeviceTypeManagerService(androidSenseDeviceType,
deviceTypeMetaDefinition);
deviceTypeGeneratorService = new DeviceTypeGeneratorServiceImpl();
}
@Test(description = "This test case tests the get type method of the device type manager")
public void testGetType() {
Assert.assertEquals(httpDeviceTypeManagerService.getType(), androidSenseDeviceType,
"HttpDeviceTypeManagerService returns" + " a different device type than initially provided");
}
@Test(description = "This test case tests the enrollment of newly added device type")
public void testEnrollDevice() throws DeviceManagementException {
String deviceId = "testdevice1";
Device sampleDevice1 = new Device(deviceId, androidSenseDeviceType, "test", "testdevice", null, null, null);
Assert.assertTrue(httpDeviceTypeManagerService.getDeviceManager().enrollDevice(sampleDevice1),
"Enrollment of " + androidSenseDeviceType + " device failed");
Assert.assertTrue(httpDeviceTypeManagerService.getDeviceManager()
.isEnrolled(new DeviceIdentifier(deviceId, androidSenseDeviceType)),
"Enrollment of " + androidSenseDeviceType + " device " + "failed");
}
@Test(description = "This test case tests the populate device management service method")
public void testPopulateDeviceManagementService() {
DeviceManagementService deviceManagementService = deviceTypeGeneratorService
.populateDeviceManagementService(sampleDeviceType, deviceTypeMetaDefinition);
Assert.assertEquals(deviceManagementService.getType(), sampleDeviceType,
"DeviceTypeGeneration for the " + "sample device type failed");
}
/**
* To create a sample device type meta defintion.
* @throws SAXException SAX Exception.
* @throws JAXBException JAXB Exception.
* @throws ParserConfigurationException ParserConfiguration Exception.
* @throws DeviceTypeConfigurationException DeviceTypeConfiguration Exception.
* @throws IOException IO Exception.
*/
private void createSampleDeviceTypeMetaDefinition()
throws SAXException, JAXBException, ParserConfigurationException, DeviceTypeConfigurationException,
IOException {
ClassLoader classLoader = getClass().getClassLoader();
URL resourceUrl = classLoader.getResource("android_sense.xml");
File androidSenseConfiguration = null;
if (resourceUrl != null) {
androidSenseConfiguration = new File(resourceUrl.getFile());
}
DeviceTypeConfiguration androidSenseDeviceTypeConfiguration = Utils
.getDeviceTypeConfiguration(androidSenseConfiguration);
PushNotificationProvider pushNotificationProvider = androidSenseDeviceTypeConfiguration
.getPushNotificationProvider();
PushNotificationConfig pushNotificationConfig = new PushNotificationConfig(pushNotificationProvider.getType(),
pushNotificationProvider.isScheduled(), null);
org.wso2.carbon.device.mgt.extensions.device.type.template.config.License license =
androidSenseDeviceTypeConfiguration.getLicense();
License androidSenseLicense = new License();
androidSenseLicense.setText(license.getText());
androidSenseLicense.setLanguage(license.getLanguage());
List<Feature> configurationFeatues = androidSenseDeviceTypeConfiguration.getFeatures().getFeature();
List<org.wso2.carbon.device.mgt.common.Feature> features = new ArrayList<>();
for (Feature feature : configurationFeatues) {
org.wso2.carbon.device.mgt.common.Feature commonFeature = new org.wso2.carbon.device.mgt.common.Feature();
commonFeature.setCode(feature.getCode());
commonFeature.setDescription(feature.getDescription());
commonFeature.setName(feature.getName());
features.add(commonFeature);
}
deviceTypeMetaDefinition = new DeviceTypeMetaDefinition();
deviceTypeMetaDefinition.setPushNotificationConfig(pushNotificationConfig);
deviceTypeMetaDefinition.setDescription("This is android_sense");
deviceTypeMetaDefinition.setClaimable(true);
deviceTypeMetaDefinition.setLicense(androidSenseLicense);
deviceTypeMetaDefinition.setFeatures(features);
}
}

@ -19,12 +19,24 @@
package org.wso2.carbon.device.mgt.extensions.utils; package org.wso2.carbon.device.mgt.extensions.utils;
import org.h2.jdbcx.JdbcDataSource;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; 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; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Table;
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; import org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException;
import org.wso2.carbon.device.mgt.extensions.device.type.template.dao.DeviceDAODefinition;
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.core.service.RealmService;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import javax.sql.DataSource;
import javax.xml.XMLConstants; import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
@ -34,6 +46,11 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
/** /**
* This class handles the test utility tasks. * This class handles the test utility tasks.
@ -73,4 +90,83 @@ public class Utils {
DocumentBuilder docBuilder = factory.newDocumentBuilder(); DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file); return docBuilder.parse(file);
} }
/**
* To create the database tables for the particular device-type based on the scripts
*
* @param databaseName Name of the Database
* @param scriptFilePath Path of the SQL script File
* @throws IOException IO Exception
* @throws SQLException SQL Exception.
*/
public static DataSource createDataTables(String databaseName, String scriptFilePath) throws IOException,
SQLException {
JdbcDataSource dataSource = new JdbcDataSource();
dataSource.setURL("jdbc:h2:mem:" + databaseName + ";DB_CLOSE_DELAY=-1");
dataSource.setUser("sa");
dataSource.setPassword("sa");
File file = new File(scriptFilePath);
final String LOAD_DATA_QUERY = "RUNSCRIPT FROM '" + file.getCanonicalPath() + "'";
Connection connection = null;
try {
connection = dataSource.getConnection();
Statement statement = connection.createStatement();
statement.execute(LOAD_DATA_QUERY);
} finally {
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
}
}
}
return dataSource;
}
/**
* To get the DeviceDAO Definition from the DeviceTypeConfiguration.
*
* @param deviceTypeConfiguration Device Type Configuration which we need the DeviceDAO Definition
* @return DeviceDAO Definition of the particular devicetype
*/
public static DeviceDAODefinition getDeviceDAODefinition(DeviceTypeConfiguration deviceTypeConfiguration) {
DeviceDetails deviceDetails = deviceTypeConfiguration.getDeviceDetails();
DeviceDAODefinition deviceDAODefinition = null;
if (deviceDetails != null) {
String tableName = deviceTypeConfiguration.getDeviceDetails().getTableId();
if (tableName != null && !tableName.isEmpty()) {
List<Table> tables = deviceTypeConfiguration.getDataSource().getTableConfig().getTable();
Table deviceDefinitionTable = null;
for (Table table : tables) {
if (tableName.equals(table.getName())) {
deviceDefinitionTable = table;
break;
}
}
if (deviceDefinitionTable != null) {
deviceDAODefinition = new DeviceDAODefinition(deviceDefinitionTable);
}
}
}
return deviceDAODefinition;
}
/**
* To get the registry service.
* @return RegistryService
* @throws RegistryException Registry Exception
*/
public static RegistryService getRegistryService() throws RegistryException {
RealmService realmService = new InMemoryRealmService();
RegistryDataHolder.getInstance().setRealmService(realmService);
DeviceManagementDataHolder.getInstance().setRealmService(realmService);
InputStream is = Utils.class.getClassLoader().getResourceAsStream("carbon-home/repository/conf/registry.xml");
RegistryContext context = RegistryContext.getBaseInstance(is, realmService);
context.setSetup(true);
return context.getEmbeddedRegistryService();
}
} }

@ -0,0 +1,31 @@
-- -----------------------------------------------------
-- Table `AD_DEVICE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`DEVICE_ID` VARCHAR(45) NOT NULL,
`FCM_TOKEN` VARCHAR(1000) NULL DEFAULT NULL,
`DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL,
`IMEI` VARCHAR(45) NULL DEFAULT NULL,
`IMSI` VARCHAR(45) NULL DEFAULT NULL,
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL,
`DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL,
`VENDOR` VARCHAR(45) NULL DEFAULT NULL,
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
`SERIAL` VARCHAR(45) NULL DEFAULT NULL,
`MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
`OS_BUILD_DATE` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`DEVICE_ID`));
-- -----------------------------------------------------
-- Table `AD_FEATURE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_FEATURE` (
`ID` INT NOT NULL AUTO_INCREMENT,
`CODE` VARCHAR(45) NOT NULL,
`NAME` VARCHAR(100) NULL,
`DESCRIPTION` VARCHAR(200) NULL,
PRIMARY KEY (`ID`));

@ -0,0 +1,50 @@
<?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="android_sense">
<Features>
<Feature code="keywords">
<Name>Add Keywords</Name>
<Description>Send keywords to the device</Description>
</Feature>
<Feature code="threshold">
<Name>Add Threshold</Name>
<Description>Send Threshold to the device</Description>
</Feature>
<Feature code="remove_words">
<Name>Remove words</Name>
<Description>Remove Threshold from the device</Description>
</Feature>
</Features>
<ProvisioningConfig>
<SharedWithAllTenants>true</SharedWithAllTenants>
</ProvisioningConfig>
<PushNotificationProviderConfig type="MQTT">
<FileBasedProperties>true</FileBasedProperties>
</PushNotificationProviderConfig>
<License>
<Language>en_US</Language>
<Version>1.0.0</Version>
<Text>This is license text</Text>
</License>
</DeviceTypeConfiguration>

@ -0,0 +1,43 @@
<?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="arduino">
<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,429 @@
CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK (
REG_LOCK_NAME VARCHAR (20),
REG_LOCK_STATUS VARCHAR (20),
REG_LOCKED_TIME TIMESTAMP,
REG_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (REG_LOCK_NAME)
);
CREATE TABLE IF NOT EXISTS REG_LOG (
REG_LOG_ID INTEGER AUTO_INCREMENT,
REG_PATH VARCHAR (2000),
REG_USER_ID VARCHAR (31) NOT NULL,
REG_LOGGED_TIME TIMESTAMP NOT NULL,
REG_ACTION INTEGER NOT NULL,
REG_ACTION_DATA VARCHAR (500),
REG_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (REG_LOG_ID, REG_TENANT_ID)
);
CREATE INDEX IF NOT EXISTS REG_LOG_IND_BY_REG_LOGTIME ON REG_LOG(REG_LOGGED_TIME, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_PATH(
REG_PATH_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_PATH_VALUE VARCHAR(2000) NOT NULL,
REG_PATH_PARENT_ID INT,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_PATH PRIMARY KEY(REG_PATH_ID, REG_TENANT_ID)
);
CREATE INDEX IF NOT EXISTS REG_PATH_IND_BY_NAME ON REG_PATH(REG_PATH_VALUE, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_PATH_IND_BY_PARENT_ID ON REG_PATH(REG_PATH_PARENT_ID, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_CONTENT (
REG_CONTENT_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_CONTENT_DATA LONGBLOB,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_CONTENT PRIMARY KEY(REG_CONTENT_ID, REG_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS REG_CONTENT_HISTORY (
REG_CONTENT_ID INTEGER NOT NULL,
REG_CONTENT_DATA LONGBLOB,
REG_DELETED SMALLINT,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_CONTENT_HISTORY PRIMARY KEY(REG_CONTENT_ID, REG_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS REG_RESOURCE (
REG_PATH_ID INTEGER NOT NULL,
REG_NAME VARCHAR(256),
REG_VERSION INTEGER NOT NULL AUTO_INCREMENT,
REG_MEDIA_TYPE VARCHAR(500),
REG_CREATOR VARCHAR(31) NOT NULL,
REG_CREATED_TIME TIMESTAMP NOT NULL,
REG_LAST_UPDATOR VARCHAR(31),
REG_LAST_UPDATED_TIME TIMESTAMP NOT NULL,
REG_DESCRIPTION VARCHAR(1000),
REG_CONTENT_ID INTEGER,
REG_TENANT_ID INTEGER DEFAULT 0,
REG_UUID VARCHAR(100) NOT NULL,
CONSTRAINT PK_REG_RESOURCE PRIMARY KEY(REG_VERSION, REG_TENANT_ID)
);
ALTER TABLE REG_RESOURCE ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT (REG_CONTENT_ID, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_NAME ON REG_RESOURCE(REG_NAME, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_PATH_ID_NAME ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_UUID ON REG_RESOURCE(REG_UUID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TENANT ON REG_RESOURCE(REG_TENANT_ID, REG_UUID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TYPE ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE);
CREATE TABLE IF NOT EXISTS REG_RESOURCE_HISTORY (
REG_PATH_ID INTEGER NOT NULL,
REG_NAME VARCHAR(256),
REG_VERSION INTEGER NOT NULL,
REG_MEDIA_TYPE VARCHAR(500),
REG_CREATOR VARCHAR(31) NOT NULL,
REG_CREATED_TIME TIMESTAMP NOT NULL,
REG_LAST_UPDATOR VARCHAR(31),
REG_LAST_UPDATED_TIME TIMESTAMP NOT NULL,
REG_DESCRIPTION VARCHAR(1000),
REG_CONTENT_ID INTEGER,
REG_DELETED SMALLINT,
REG_TENANT_ID INTEGER DEFAULT 0,
REG_UUID VARCHAR(100) NOT NULL,
CONSTRAINT PK_REG_RESOURCE_HISTORY PRIMARY KEY(REG_VERSION, REG_TENANT_ID)
);
ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_HIST_FK_BY_PATHID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_HIST_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT_HISTORY (REG_CONTENT_ID, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_HISTORY_IND_BY_NAME ON REG_RESOURCE_HISTORY(REG_NAME, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_HISTORY_IND_BY_PATH_ID_NAME ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_COMMENT (
REG_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_COMMENT_TEXT VARCHAR(500) NOT NULL,
REG_USER_ID VARCHAR(31) NOT NULL,
REG_COMMENTED_TIME TIMESTAMP NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_COMMENT PRIMARY KEY(REG_ID, REG_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS REG_RESOURCE_COMMENT (
REG_COMMENT_ID INTEGER NOT NULL,
REG_VERSION INTEGER,
REG_PATH_ID INTEGER,
REG_RESOURCE_NAME VARCHAR(256),
REG_TENANT_ID INTEGER DEFAULT 0
);
ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_COMMENT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_COMMENT_FK_BY_COMMENT_ID FOREIGN KEY (REG_COMMENT_ID, REG_TENANT_ID) REFERENCES REG_COMMENT (REG_ID, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_COMMENT_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_COMMENT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_COMMENT_IND_BY_VERSION ON REG_RESOURCE_COMMENT(REG_VERSION, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_RATING (
REG_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_RATING INTEGER NOT NULL,
REG_USER_ID VARCHAR(31) NOT NULL,
REG_RATED_TIME TIMESTAMP NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_RATING PRIMARY KEY(REG_ID, REG_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS REG_RESOURCE_RATING (
REG_RATING_ID INTEGER NOT NULL,
REG_VERSION INTEGER,
REG_PATH_ID INTEGER,
REG_RESOURCE_NAME VARCHAR(256),
REG_TENANT_ID INTEGER DEFAULT 0
);
ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_RATING_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_RATING_FK_BY_RATING_ID FOREIGN KEY (REG_RATING_ID, REG_TENANT_ID) REFERENCES REG_RATING (REG_ID, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_RATING_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_RATING(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_RATING_IND_BY_VERSION ON REG_RESOURCE_RATING(REG_VERSION, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_TAG (
REG_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_TAG_NAME VARCHAR(500) NOT NULL,
REG_USER_ID VARCHAR(31) NOT NULL,
REG_TAGGED_TIME TIMESTAMP NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_TAG PRIMARY KEY(REG_ID, REG_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS REG_RESOURCE_TAG (
REG_TAG_ID INTEGER NOT NULL,
REG_VERSION INTEGER,
REG_PATH_ID INTEGER,
REG_RESOURCE_NAME VARCHAR(256),
REG_TENANT_ID INTEGER DEFAULT 0
);
ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_TAG_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_TAG_FK_BY_TAG_ID FOREIGN KEY (REG_TAG_ID, REG_TENANT_ID) REFERENCES REG_TAG (REG_ID, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_TAG_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_TAG(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_TAG_IND_BY_VERSION ON REG_RESOURCE_TAG(REG_VERSION, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_PROPERTY (
REG_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_NAME VARCHAR(100) NOT NULL,
REG_VALUE VARCHAR(1000),
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_PROPERTY PRIMARY KEY(REG_ID, REG_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS REG_RESOURCE_PROPERTY (
REG_PROPERTY_ID INTEGER NOT NULL,
REG_VERSION INTEGER,
REG_PATH_ID INTEGER,
REG_RESOURCE_NAME VARCHAR(256),
REG_TENANT_ID INTEGER DEFAULT 0
);
ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_PROPERTY_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT IF NOT EXISTS REG_RESOURCE_PROPERTY_FK_BY_TAG_ID FOREIGN KEY (REG_PROPERTY_ID, REG_TENANT_ID) REFERENCES REG_PROPERTY (REG_ID, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_PROPERTY_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_RESOURCE_PROPERTY(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_RESOURCE_PROPERTY_IND_BY_VERSION ON REG_RESOURCE_PROPERTY(REG_VERSION, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_ASSOCIATION (
REG_ASSOCIATION_ID INTEGER AUTO_INCREMENT,
REG_SOURCEPATH VARCHAR (2000) NOT NULL,
REG_TARGETPATH VARCHAR (2000) NOT NULL,
REG_ASSOCIATION_TYPE VARCHAR (2000) NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (REG_ASSOCIATION_ID, REG_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS REG_SNAPSHOT (
REG_SNAPSHOT_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_PATH_ID INTEGER NOT NULL,
REG_RESOURCE_NAME VARCHAR (256),
REG_RESOURCE_VIDS LONGBLOB NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_SNAPSHOT PRIMARY KEY(REG_SNAPSHOT_ID, REG_TENANT_ID)
);
ALTER TABLE REG_SNAPSHOT ADD CONSTRAINT IF NOT EXISTS REG_SNAPSHOT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
CREATE INDEX IF NOT EXISTS REG_SNAPSHOT_IND_BY_PATH_ID_AND_RESOURCE_NAME ON REG_SNAPSHOT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
-- ################################
-- USER MANAGER TABLES
-- ################################
CREATE TABLE IF NOT EXISTS UM_TENANT (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DOMAIN_NAME VARCHAR(255) NOT NULL,
UM_EMAIL VARCHAR(255),
UM_ACTIVE BOOLEAN DEFAULT FALSE,
UM_CREATED_DATE TIMESTAMP NOT NULL,
UM_USER_CONFIG LONGBLOB NOT NULL,
PRIMARY KEY (UM_ID),
UNIQUE(UM_DOMAIN_NAME));
CREATE TABLE IF NOT EXISTS UM_DOMAIN(
UM_DOMAIN_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DOMAIN_NAME VARCHAR(255),
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_DOMAIN_ID, UM_TENANT_ID)
);
CREATE INDEX IF NOT EXISTS INDEX_UM_TENANT_UM_DOMAIN_NAME ON UM_TENANT (UM_DOMAIN_NAME);
CREATE TABLE IF NOT EXISTS UM_USER (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_USER_PASSWORD VARCHAR(255) NOT NULL,
UM_SALT_VALUE VARCHAR(31),
UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE,
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID));
CREATE TABLE IF NOT EXISTS UM_SYSTEM_USER (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_USER_PASSWORD VARCHAR(255) NOT NULL,
UM_SALT_VALUE VARCHAR(31),
UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE,
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID));
CREATE TABLE IF NOT EXISTS UM_USER_ATTRIBUTE (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ATTR_NAME VARCHAR(255) NOT NULL,
UM_ATTR_VALUE VARCHAR(1024),
UM_PROFILE_ID VARCHAR(255),
UM_USER_ID INTEGER,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID));
CREATE INDEX IF NOT EXISTS UM_USER_ID_INDEX ON UM_USER_ATTRIBUTE(UM_USER_ID);
CREATE TABLE IF NOT EXISTS UM_ROLE (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ROLE_NAME VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_SHARED_ROLE BOOLEAN DEFAULT FALSE,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_ROLE_NAME, UM_TENANT_ID));
CREATE TABLE IF NOT EXISTS UM_MODULE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_MODULE_NAME VARCHAR(100),
UNIQUE(UM_MODULE_NAME),
PRIMARY KEY(UM_ID)
);
CREATE TABLE IF NOT EXISTS UM_MODULE_ACTIONS(
UM_ACTION VARCHAR(255) NOT NULL,
UM_MODULE_ID INTEGER NOT NULL,
PRIMARY KEY(UM_ACTION, UM_MODULE_ID),
FOREIGN KEY (UM_MODULE_ID) REFERENCES UM_MODULE(UM_ID) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS UM_PERMISSION (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_RESOURCE_ID VARCHAR(255) NOT NULL,
UM_ACTION VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_MODULE_ID INTEGER DEFAULT 0,
UNIQUE(UM_RESOURCE_ID,UM_ACTION, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID));
CREATE INDEX IF NOT EXISTS INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION ON UM_PERMISSION (UM_RESOURCE_ID, UM_ACTION, UM_TENANT_ID);
CREATE TABLE IF NOT EXISTS UM_ROLE_PERMISSION (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_PERMISSION_ID INTEGER NOT NULL,
UM_ROLE_NAME VARCHAR(255) NOT NULL,
UM_IS_ALLOWED SMALLINT NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_DOMAIN_ID INTEGER,
FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID));
CREATE TABLE IF NOT EXISTS UM_USER_PERMISSION (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_PERMISSION_ID INTEGER NOT NULL,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_IS_ALLOWED SMALLINT NOT NULL,
UNIQUE (UM_PERMISSION_ID, UM_USER_NAME, UM_TENANT_ID),
UM_TENANT_ID INTEGER DEFAULT 0,
FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID));
CREATE TABLE IF NOT EXISTS UM_USER_ROLE (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ROLE_ID INTEGER NOT NULL,
UM_USER_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE (UM_USER_ID, UM_ROLE_ID, UM_TENANT_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_ROLE(UM_ID, UM_TENANT_ID),
FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID));
CREATE TABLE IF NOT EXISTS UM_SHARED_USER_ROLE(
UM_ROLE_ID INTEGER NOT NULL,
UM_USER_ID INTEGER NOT NULL,
UM_USER_TENANT_ID INTEGER NOT NULL,
UM_ROLE_TENANT_ID INTEGER NOT NULL,
UNIQUE(UM_USER_ID,UM_ROLE_ID,UM_USER_TENANT_ID, UM_ROLE_TENANT_ID),
FOREIGN KEY(UM_ROLE_ID,UM_ROLE_TENANT_ID) REFERENCES UM_ROLE(UM_ID,UM_TENANT_ID) ON DELETE CASCADE ,
FOREIGN KEY(UM_USER_ID,UM_USER_TENANT_ID) REFERENCES UM_USER(UM_ID,UM_TENANT_ID) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS UM_ACCOUNT_MAPPING(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER NOT NULL,
UM_USER_STORE_DOMAIN VARCHAR(100),
UM_ACC_LINK_ID INTEGER NOT NULL,
UNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID),
FOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID)
);
CREATE TABLE IF NOT EXISTS UM_DIALECT(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DIALECT_URI VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE(UM_DIALECT_URI, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS UM_CLAIM(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DIALECT_ID INTEGER NOT NULL,
UM_CLAIM_URI VARCHAR(255) NOT NULL,
UM_DISPLAY_TAG VARCHAR(255),
UM_DESCRIPTION VARCHAR(255),
UM_MAPPED_ATTRIBUTE_DOMAIN VARCHAR(255),
UM_MAPPED_ATTRIBUTE VARCHAR(255),
UM_REG_EX VARCHAR(255),
UM_SUPPORTED SMALLINT,
UM_REQUIRED SMALLINT,
UM_DISPLAY_ORDER INTEGER,
UM_CHECKED_ATTRIBUTE SMALLINT,
UM_READ_ONLY SMALLINT,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE(UM_DIALECT_ID, UM_CLAIM_URI,UM_MAPPED_ATTRIBUTE_DOMAIN, UM_TENANT_ID),
FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS UM_PROFILE_CONFIG(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DIALECT_ID INTEGER,
UM_PROFILE_NAME VARCHAR(255),
UM_TENANT_ID INTEGER DEFAULT 0,
FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS UM_HYBRID_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ROLE_NAME VARCHAR(255),
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS UM_HYBRID_USER_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255),
UM_ROLE_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_DOMAIN_ID INTEGER,
UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID,UM_DOMAIN_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS UM_HYBRID_REMEMBER_ME (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_COOKIE_VALUE VARCHAR(1024),
UM_CREATED_TIME TIMESTAMP,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS UM_SYSTEM_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ROLE_NAME VARCHAR(255),
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
);
CREATE TABLE IF NOT EXISTS UM_SYSTEM_USER_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255),
UM_ROLE_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_SYSTEM_ROLE(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
);

@ -0,0 +1,656 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2017 WSO2 Inc. (http://wso2.com)
~
~ Licensed 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.
-->
<!--
This is the main server configuration file
${carbon.home} represents the carbon.home system property.
Other system properties can be specified in a similar manner.
-->
<Server xmlns="http://wso2.org/projects/carbon/carbon.xml">
<!--
Product Name
-->
<Name>${product.name}</Name>
<!--
machine readable unique key to identify each product
-->
<ServerKey>${product.key}</ServerKey>
<!--
Product Version
-->
<Version>${product.version}</Version>
<!--
Host name or IP address of the machine hosting this server
e.g. www.wso2.org, 192.168.1.10
This is will become part of the End Point Reference of the
services deployed on this server instance.
-->
<!--HostName>www.wso2.org</HostName-->
<!--
Host name to be used for the Carbon management console
-->
<!--MgtHostName>mgt.wso2.org</MgtHostName-->
<!--
The URL of the back end server. This is where the admin services are hosted and
will be used by the clients in the front end server.
This is required only for the Front-end server. This is used when seperating BE server from FE server
-->
<ServerURL>local:/${carbon.context}/services/</ServerURL>
<!--
<ServerURL>https://${carbon.local.ip}:${carbon.management.port}${carbon.context}/services/</ServerURL>
-->
<!--
The URL of the index page. This is where the user will be redirected after signing in to the
carbon server.
-->
<!-- IndexPageURL>/carbon/admin/index.jsp</IndexPageURL-->
<!--
For cApp deployment, we have to identify the roles that can be acted by the current server.
The following property is used for that purpose. Any number of roles can be defined here.
Regular expressions can be used in the role.
Ex : <Role>.*</Role> means this server can act any role
-->
<ServerRoles>
<Role>${default.server.role}</Role>
</ServerRoles>
<!-- uncommnet this line to subscribe to a bam instance automatically -->
<!--<BamServerURL>https://bamhost:bamport/services/</BamServerURL>-->
<!--
The fully qualified name of the server
-->
<Package>org.wso2.carbon</Package>
<!--
Webapp context root of WSO2 Carbon management console.
-->
<WebContextRoot>/</WebContextRoot>
<!--
Proxy context path is a useful parameter to add a proxy path when a Carbon server is fronted by reverse proxy. In addtion
to the proxy host and proxy port this parameter allows you add a path component to external URLs. e.g.
URL of the Carbon server -> https://10.100.1.1:9443/carbon
URL of the reverse proxy -> https://prod.abc.com/appserver/carbon
appserver - proxy context path. This specially required whenever you are generating URLs to displace in
Carbon UI components.
-->
<!--
<MgtProxyContextPath></MgtProxyContextPath>
<ProxyContextPath></ProxyContextPath>
-->
<!-- In-order to get the registry http Port from the back-end when the default http transport is not the same-->
<!--RegistryHttpPort>9763</RegistryHttpPort-->
<!--
Number of items to be displayed on a management console page. This is used at the
backend server for pagination of various items.
-->
<ItemsPerPage>15</ItemsPerPage>
<!-- The endpoint URL of the cloud instance management Web service -->
<!--<InstanceMgtWSEndpoint>https://ec2.amazonaws.com/</InstanceMgtWSEndpoint>-->
<!--
Ports used by this server
-->
<Ports>
<!-- Ports offset. This entry will set the value of the ports defined below to
the define value + Offset.
e.g. Offset=2 and HTTPS port=9443 will set the effective HTTPS port to 9445
-->
<Offset>0</Offset>
<!-- The JMX Ports -->
<JMX>
<!--The port RMI registry is exposed-->
<RMIRegistryPort>9999</RMIRegistryPort>
<!--The port RMI server should be exposed-->
<RMIServerPort>11111</RMIServerPort>
</JMX>
<!-- Embedded LDAP server specific ports -->
<EmbeddedLDAP>
<!-- Port which embedded LDAP server runs -->
<LDAPServerPort>10389</LDAPServerPort>
<!-- Port which KDC (Kerberos Key Distribution Center) server runs -->
<KDCServerPort>8000</KDCServerPort>
</EmbeddedLDAP>
<!--
Override datasources JNDIproviderPort defined in bps.xml and datasources.properties files
-->
<!--<JNDIProviderPort>2199</JNDIProviderPort>-->
<!--Override receive port of thrift based entitlement service.-->
<ThriftEntitlementReceivePort>10500</ThriftEntitlementReceivePort>
</Ports>
<!--
JNDI Configuration
-->
<JNDI>
<!--
The fully qualified name of the default initial context factory
-->
<DefaultInitialContextFactory>org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory</DefaultInitialContextFactory>
<!--
The restrictions that are done to various JNDI Contexts in a Multi-tenant environment
-->
<Restrictions>
<!--
Contexts that will be available only to the super-tenant
-->
<!-- <SuperTenantOnly>
<UrlContexts>
<UrlContext>
<Scheme>foo</Scheme>
</UrlContext>
<UrlContext>
<Scheme>bar</Scheme>
</UrlContext>
</UrlContexts>
</SuperTenantOnly> -->
<!--
Contexts that are common to all tenants
-->
<AllTenants>
<UrlContexts>
<UrlContext>
<Scheme>java</Scheme>
</UrlContext>
<!-- <UrlContext>
<Scheme>foo</Scheme>
</UrlContext> -->
</UrlContexts>
</AllTenants>
<!--
All other contexts not mentioned above will be available on a per-tenant basis
(i.e. will not be shared among tenants)
-->
</Restrictions>
</JNDI>
<!--
Property to determine if the server is running an a cloud deployment environment.
This property should only be used to determine deployment specific details that are
applicable only in a cloud deployment, i.e when the server deployed *-as-a-service.
-->
<IsCloudDeployment>false</IsCloudDeployment>
<!--
Property to determine whether usage data should be collected for metering purposes
-->
<EnableMetering>false</EnableMetering>
<!-- The Max time a thread should take for execution in seconds -->
<MaxThreadExecutionTime>600</MaxThreadExecutionTime>
<!--
A flag to enable or disable Ghost Deployer. By default this is set to false. That is
because the Ghost Deployer works only with the HTTP/S transports. If you are using
other transports, don't enable Ghost Deployer.
-->
<GhostDeployment>
<Enabled>false</Enabled>
</GhostDeployment>
<!--
Eager loading or lazy loading is a design pattern commonly used in computer programming which
will initialize an object upon creation or load on-demand. In carbon, lazy loading is used to
load tenant when a request is received only. Similarly Eager loading is used to enable load
existing tenants after carbon server starts up. Using this feature, you will be able to include
or exclude tenants which are to be loaded when server startup.
We can enable only one LoadingPolicy at a given time.
1. Tenant Lazy Loading
This is the default behaviour and enabled by default. With this policy, tenants are not loaded at
server startup, but loaded based on-demand (i.e when a request is received for a tenant).
The default tenant idle time is 30 minutes.
2. Tenant Eager Loading
This is by default not enabled. It can be be enabled by un-commenting the <EagerLoading> section.
The eager loading configurations supported are as below. These configurations can be given as the
value for <Include> element with eager loading.
(i)Load all tenants when server startup - *
(ii)Load all tenants except foo.com & bar.com - *,!foo.com,!bar.com
(iii)Load only foo.com & bar.com to be included - foo.com,bar.com
-->
<Tenant>
<LoadingPolicy>
<LazyLoading>
<IdleTime>30</IdleTime>
</LazyLoading>
<!-- <EagerLoading>
<Include>*,!foo.com,!bar.com</Include>
</EagerLoading>-->
</LoadingPolicy>
</Tenant>
<!--
Caching related configurations
-->
<Cache>
<!-- Default cache timeout in minutes -->
<DefaultCacheTimeout>15</DefaultCacheTimeout>
</Cache>
<!--
Axis2 related configurations
-->
<Axis2Config>
<!--
Location of the Axis2 Services & Modules repository
This can be a directory in the local file system, or a URL.
e.g.
1. /home/wso2wsas/repository/ - An absolute path
2. repository - In this case, the path is relative to CARBON_HOME
3. file:///home/wso2wsas/repository/
4. http://wso2wsas/repository/
-->
<RepositoryLocation>${carbon.home}/repository/deployment/server/</RepositoryLocation>
<!--
Deployment update interval in seconds. This is the interval between repository listener
executions.
-->
<DeploymentUpdateInterval>15</DeploymentUpdateInterval>
<!--
Location of the main Axis2 configuration descriptor file, a.k.a. axis2.xml file
This can be a file on the local file system, or a URL
e.g.
1. /home/repository/axis2.xml - An absolute path
2. conf/axis2.xml - In this case, the path is relative to CARBON_HOME
3. file:///home/carbon/repository/axis2.xml
4. http://repository/conf/axis2.xml
-->
<ConfigurationFile>${carbon.home}/repository/conf/axis2/axis2.xml</ConfigurationFile>
<!--
ServiceGroupContextIdleTime, which will be set in ConfigurationContex
for multiple clients which are going to access the same ServiceGroupContext
Default Value is 30 Sec.
-->
<ServiceGroupContextIdleTime>30000</ServiceGroupContextIdleTime>
<!--
This repository location is used to crete the client side configuration
context used by the server when calling admin services.
-->
<ClientRepositoryLocation>${carbon.home}/repository/deployment/client/</ClientRepositoryLocation>
<!-- This axis2 xml is used in createing the configuration context by the FE server
calling to BE server -->
<clientAxis2XmlLocation>${carbon.home}/repository/conf/axis2/axis2_client.xml</clientAxis2XmlLocation>
<!-- If this parameter is set, the ?wsdl on an admin service will not give the admin service wsdl. -->
<HideAdminServiceWSDLs>true</HideAdminServiceWSDLs>
<!--WARNING-Use With Care! Uncommenting bellow parameter would expose all AdminServices in HTTP transport.
With HTTP transport your credentials and data routed in public channels are vulnerable for sniffing attacks.
Use bellow parameter ONLY if your communication channels are confirmed to be secured by other means -->
<!--HttpAdminServices>*</HttpAdminServices-->
</Axis2Config>
<!--
The default user roles which will be created when the server
is started up for the first time.
-->
<ServiceUserRoles>
<Role>
<Name>admin</Name>
<Description>Default Administrator Role</Description>
</Role>
<Role>
<Name>user</Name>
<Description>Default User Role</Description>
</Role>
</ServiceUserRoles>
<!--
Enable following config to allow Emails as usernames.
-->
<!--EnableEmailUserName>true</EnableEmailUserName-->
<!--
Security configurations
-->
<Security>
<!--
KeyStore which will be used for encrypting/decrypting passwords
and other sensitive information.
-->
<KeyStore>
<!-- Keystore file location-->
<Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
<!-- Keystore type (JKS/PKCS12 etc.)-->
<Type>JKS</Type>
<!-- Keystore password-->
<Password>wso2carbon</Password>
<!-- Private Key alias-->
<KeyAlias>wso2carbon</KeyAlias>
<!-- Private Key password-->
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
<!--
System wide trust-store which is used to maintain the certificates of all
the trusted parties.
-->
<TrustStore>
<!-- trust-store file location -->
<Location>${carbon.home}/repository/resources/security/client-truststore.jks</Location>
<!-- trust-store type (JKS/PKCS12 etc.) -->
<Type>JKS</Type>
<!-- trust-store password -->
<Password>wso2carbon</Password>
</TrustStore>
<!--
The Authenticator configuration to be used at the JVM level. We extend the
java.net.Authenticator to make it possible to authenticate to given servers and
proxies.
-->
<NetworkAuthenticatorConfig>
<!--
Below is a sample configuration for a single authenticator. Please note that
all child elements are mandatory. Not having some child elements would lead to
exceptions at runtime.
-->
<!-- <Credential> -->
<!--
the pattern that would match a subset of URLs for which this authenticator
would be used
-->
<!-- <Pattern>regularExpression</Pattern> -->
<!--
the type of this authenticator. Allowed values are:
1. server
2. proxy
-->
<!-- <Type>proxy</Type> -->
<!-- the username used to log in to server/proxy -->
<!-- <Username>username</Username> -->
<!-- the password used to log in to server/proxy -->
<!-- <Password>password</Password> -->
<!-- </Credential> -->
</NetworkAuthenticatorConfig>
<!--
The Tomcat realm to be used for hosted Web applications. Allowed values are;
1. UserManager
2. Memory
If this is set to 'UserManager', the realm will pick users & roles from the system's
WSO2 User Manager. If it is set to 'memory', the realm will pick users & roles from
CARBON_HOME/repository/conf/tomcat/tomcat-users.xml
-->
<TomcatRealm>UserManager</TomcatRealm>
<!--Option to disable storing of tokens issued by STS-->
<DisableTokenStore>false</DisableTokenStore>
<!--
Security token store class name. If this is not set, default class will be
org.wso2.carbon.security.util.SecurityTokenStore
-->
<!--TokenStoreClassName>org.wso2.carbon.identity.sts.store.DBTokenStore</TokenStoreClassName-->
</Security>
<!--
The temporary work directory
-->
<WorkDirectory>${carbon.home}/tmp/work</WorkDirectory>
<!--
House-keeping configuration
-->
<HouseKeeping>
<!--
true - Start House-keeping thread on server startup
false - Do not start House-keeping thread on server startup.
The user will run it manually as and when he wishes.
-->
<AutoStart>true</AutoStart>
<!--
The interval in *minutes*, between house-keeping runs
-->
<Interval>10</Interval>
<!--
The maximum time in *minutes*, temp files are allowed to live
in the system. Files/directories which were modified more than
"MaxTempFileLifetime" minutes ago will be removed by the
house-keeping task
-->
<MaxTempFileLifetime>30</MaxTempFileLifetime>
</HouseKeeping>
<!--
Configuration for handling different types of file upload & other file uploading related
config parameters.
To map all actions to a particular FileUploadExecutor, use
<Action>*</Action>
-->
<FileUploadConfig>
<!--
The total file upload size limit in MB
-->
<TotalFileSizeLimit>100</TotalFileSizeLimit>
<Mapping>
<Actions>
<Action>keystore</Action>
<Action>certificate</Action>
<Action>*</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.AnyFileUploadExecutor</Class>
</Mapping>
<Mapping>
<Actions>
<Action>jarZip</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.JarZipUploadExecutor</Class>
</Mapping>
<Mapping>
<Actions>
<Action>dbs</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.DBSFileUploadExecutor</Class>
</Mapping>
<Mapping>
<Actions>
<Action>tools</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.ToolsFileUploadExecutor</Class>
</Mapping>
<Mapping>
<Actions>
<Action>toolsAny</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor</Class>
</Mapping>
</FileUploadConfig>
<!--
Processors which process special HTTP GET requests such as ?wsdl, ?policy etc.
In order to plug in a processor to handle a special request, simply add an entry to this
section.
The value of the Item element is the first parameter in the query string(e.g. ?wsdl)
which needs special processing
The value of the Class element is a class which implements
org.wso2.carbon.transport.HttpGetRequestProcessor
-->
<HttpGetRequestProcessors>
<Processor>
<Item>info</Item>
<Class>org.wso2.carbon.core.transports.util.InfoProcessor</Class>
</Processor>
<Processor>
<Item>wsdl</Item>
<Class>org.wso2.carbon.core.transports.util.Wsdl11Processor</Class>
</Processor>
<Processor>
<Item>wsdl2</Item>
<Class>org.wso2.carbon.core.transports.util.Wsdl20Processor</Class>
</Processor>
<Processor>
<Item>xsd</Item>
<Class>org.wso2.carbon.core.transports.util.XsdProcessor</Class>
</Processor>
</HttpGetRequestProcessors>
<!-- Deployment Synchronizer Configuration. t Enabled value to true when running with "svn based" dep sync.
In master nodes you need to set both AutoCommit and AutoCheckout to true
and in worker nodes set only AutoCheckout to true.
-->
<DeploymentSynchronizer>
<Enabled>false</Enabled>
<AutoCommit>false</AutoCommit>
<AutoCheckout>true</AutoCheckout>
<RepositoryType>svn</RepositoryType>
<SvnUrl>http://svnrepo.example.com/repos/</SvnUrl>
<SvnUser>username</SvnUser>
<SvnPassword>password</SvnPassword>
<SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
</DeploymentSynchronizer>
<!-- Deployment Synchronizer Configuration. Uncomment the following section when running with "registry based" dep sync.
In master nodes you need to set both AutoCommit and AutoCheckout to true
and in worker nodes set only AutoCheckout to true.
-->
<!--<DeploymentSynchronizer>
<Enabled>true</Enabled>
<AutoCommit>false</AutoCommit>
<AutoCheckout>true</AutoCheckout>
</DeploymentSynchronizer>-->
<!-- Mediation persistence configurations. Only valid if mediation features are available i.e. ESB -->
<!--<MediationConfig>
<LoadFromRegistry>false</LoadFromRegistry>
<SaveToFile>false</SaveToFile>
<Persistence>enabled</Persistence>
<RegistryPersistence>enabled</RegistryPersistence>
</MediationConfig>-->
<!--
Server intializing code, specified as implementation classes of org.wso2.carbon.core.ServerInitializer.
This code will be run when the Carbon server is initialized
-->
<ServerInitializers>
<!--<Initializer></Initializer>-->
</ServerInitializers>
<!--
Indicates whether the Carbon Servlet is required by the system, and whether it should be
registered
-->
<RequireCarbonServlet>${require.carbon.servlet}</RequireCarbonServlet>
<!--
Carbon H2 OSGI Configuration
By default non of the servers start.
name="web" - Start the web server with the H2 Console
name="webPort" - The port (default: 8082)
name="webAllowOthers" - Allow other computers to connect
name="webSSL" - Use encrypted (HTTPS) connections
name="tcp" - Start the TCP server
name="tcpPort" - The port (default: 9092)
name="tcpAllowOthers" - Allow other computers to connect
name="tcpSSL" - Use encrypted (SSL) connections
name="pg" - Start the PG server
name="pgPort" - The port (default: 5435)
name="pgAllowOthers" - Allow other computers to connect
name="trace" - Print additional trace information; for all servers
name="baseDir" - The base directory for H2 databases; for all servers
-->
<!--H2DatabaseConfiguration>
<property name="web" />
<property name="webPort">8082</property>
<property name="webAllowOthers" />
<property name="webSSL" />
<property name="tcp" />
<property name="tcpPort">9092</property>
<property name="tcpAllowOthers" />
<property name="tcpSSL" />
<property name="pg" />
<property name="pgPort">5435</property>
<property name="pgAllowOthers" />
<property name="trace" />
<property name="baseDir">${carbon.home}</property>
</H2DatabaseConfiguration-->
<!--Disabling statistics reporter by default-->
<StatisticsReporterDisabled>true</StatisticsReporterDisabled>
<!-- Enable accessing Admin Console via HTTP -->
<!-- EnableHTTPAdminConsole>true</EnableHTTPAdminConsole -->
<!--
Default Feature Repository of WSO2 Carbon.
-->
<FeatureRepository>
<RepositoryName>default repository</RepositoryName>
<RepositoryURL>${p2.repo.url}</RepositoryURL>
</FeatureRepository>
<!--
Configure API Management
-->
<APIManagement>
<!--Uses the embedded API Manager by default. If you want to use an external
API Manager instance to manage APIs, configure below externalAPIManager-->
<Enabled>true</Enabled>
<!--Uncomment and configure API Gateway and
Publisher URLs to use external API Manager instance-->
<!--ExternalAPIManager>
<APIGatewayURL>http://localhost:8281</APIGatewayURL>
<APIPublisherURL>http://localhost:8281/publisher</APIPublisherURL>
</ExternalAPIManager-->
<LoadAPIContextsInServerStartup>true</LoadAPIContextsInServerStartup>
</APIManagement>
</Server>

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2017 WSO2 Inc. (http://wso2.com)
~
~ Licensed 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.
-->
<wso2registry>
<!--
For details on configuring different config & governance registries see;
http://wso2.org/library/tutorials/2010/04/sharing-registry-space-across-multiple-product-instances
-->
<currentDBConfig>wso2registry</currentDBConfig>
<readOnly>false</readOnly>
<enableCache>true</enableCache>
<registryRoot>/</registryRoot>
<dbConfig name="wso2registry">
<url>jdbc:h2:./target/databasetest/CARBON_TEST</url>
<!--userName>sa</userName>
<password>sa</password-->
<driverName>org.h2.Driver</driverName>
<maxActive>80</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
</dbConfig>
<versionResourcesOnChange>false</versionResourcesOnChange>
<!-- NOTE: You can edit the options under "StaticConfiguration" only before the
startup. -->
<staticConfiguration>
<versioningProperties>true</versioningProperties>
<versioningComments>true</versioningComments>
<versioningTags>true</versioningTags>
<versioningRatings>true</versioningRatings>
</staticConfiguration>
</wso2registry>

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<artifactType type="application/vnd.wso2-license+xml" shortName="license" singularLabel="License" pluralLabel="Licenses"
hasNamespace="false" iconSet="10">
<storagePath>/device-mgt/license/@{overview_name}/@{overview_language}/@{overview_version}</storagePath>
<nameAttribute>overview_name</nameAttribute>
<ui>
<list>
<column name="Device Type">
<data type="path" value="overview_name" href="@{storagePath}"/>
</column>
<column name="Language">
<data type="path" value="overview_language" href="@{storagePath}"/>
</column>
<column name="Version">
<data type="path" value="overview_version" href="@{storagePath}"/>
</column>
</list>
</ui>
<content>
<table name="Overview">
<field type="text" required="true">
<name>Name</name>
</field>
<field type="text" required="true">
<name>Language</name>
</field>
<field type="text" required="true">
<name>Version</name>
</field>
<field type="text">
<name>Validity From</name>
</field>
<field type="text">
<name>Validity To</name>
</field>
<field type="text-area">
<name>License</name>
</field>
</table>
</content>
</artifactType>

@ -23,7 +23,10 @@
<test name="DeviceType Manager Service Test Cases" preserve-order="true"> <test name="DeviceType Manager Service Test Cases" preserve-order="true">
<classes> <classes>
<class name="org.wso2.carbon.device.mgt.extensions.device.type.template.BaseExtensionsTest"/>
<class name="org.wso2.carbon.device.mgt.extensions.device.type.template.DeviceTypeManagerServiceTest"/> <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"/>
</classes> </classes>
</test> </test>
</suite> </suite>

@ -0,0 +1,80 @@
<!--
~ 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.
-->
<UserManager>
<Realm>
<Configuration>
<AddAdmin>true</AddAdmin>
<AdminRole>admin</AdminRole>
<AdminUser>
<UserName>admin</UserName>
<Password>admin</Password>
</AdminUser>
<EveryOneRoleName>everyone</EveryOneRoleName>
<ReadOnly>false</ReadOnly>
<MaxUserNameListLength>500</MaxUserNameListLength>
<Property name="url">jdbc:h2:target/databasetest/CARBON_TEST</Property>
<Property name="driverName">org.h2.Driver</Property>
<Property name="maxActive">50</Property>
<Property name="maxWait">60000</Property>
<Property name="minIdle">5</Property>
</Configuration>
<UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">
<Property name="TenantManager">org.wso2.carbon.user.core.tenant.JDBCTenantManager</Property>
<Property name="ReadOnly">false</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="IsEmailUserName">false</Property>
<Property name="DomainCalculation">default</Property>
<Property name="PasswordDigest">SHA-256</Property>
<Property name="StoreSaltedPassword">true</Property>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="UserNameUniqueAcrossTenants">false</Property>
<Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaRegExViolationErrorMsg">Password length should be between 5 to 30 characters
</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="UsernameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="SharedGroupEnabled">false</Property>
<Property name="SCIMEnabled">false</Property>
<Property name="CaseSensitiveUsername">true</Property>
<Property name="MultiAttributeSeparator">,</Property>
<Property name="BulkImportSupported">true</Property>
</UserStoreManager>
<AuthorizationManager
class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
<Property name="AuthorizationCacheEnabled">true</Property>
</AuthorizationManager>
</Realm>
<SystemPermission>
<Permission>login</Permission>
<Permission>manage-configuration</Permission>
<Permission>manage-security</Permission>
<Permission>upload-services</Permission>
<Permission>manage-services</Permission>
<Permission>manage-lc-configuration</Permission>
<Permission>manage-mediation</Permission>
<Permission>monitor-system</Permission>
<Permission>delegate-identity</Permission>
</SystemPermission>
</UserManager>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save