diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java index a8811e54186..add4acef72a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java @@ -100,7 +100,7 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService { CarbonContext.getThreadLocalCarbonContext().getUsername()); try { - String tenantDomain = MultitenantUtils.getTenantDomain(authorizedUser); + String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); int tenantId = DeviceMgtAPIUtils.getRealmService().getTenantManager().getTenantId(tenantDomain); AnalyticsDataAPI analyticsDataAPI = DeviceMgtAPIUtils.getAnalyticsDataAPI(); List searchResults = analyticsDataAPI.search(tenantId, tableName, query, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java index 627ea432a9d..44b740a0974 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java @@ -321,7 +321,7 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis getDeviceTaskManagerService(); OperationMonitoringTaskConfig operationMonitoringTaskConfig = deviceManagementService. getOperationMonitoringConfig(); - if (operationMonitoringTaskConfig != null) { + if (operationMonitoringTaskConfig != null && operationMonitoringTaskConfig.isEnabled()) { deviceTaskManagerService.stopTask(deviceManagementService.getType(), deviceManagementService.getOperationMonitoringConfig()); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java index c5bcec41c27..ccb0317a38e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java @@ -51,6 +51,7 @@ import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerSer import org.wso2.carbon.registry.api.Registry; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; +import org.wso2.carbon.stratos.common.util.ClaimsMgtUtil; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; @@ -428,6 +429,9 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic } catch (JWTClientException e) { throw new GeoLocationBasedServiceException( "JWT token creation failed while " + action + " geo alert '" + alertType, e); + } catch (Exception e) { + throw new GeoLocationBasedServiceException( + "Error occurred while " + action + " geo alert '" + alertType, e); } finally { cleanup(eventprocessorStub); } @@ -541,6 +545,9 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic throw new GeoLocationBasedServiceException( "JWT token creation failed while " + action + " geo alert '" + alertType + "' for " + identifier.getType() + " device with id:" + identifier.getId(), e); + } catch (Exception e) { + throw new GeoLocationBasedServiceException( + "Error occurred while " + action + " geo alert '" + alertType, e); } finally { cleanup(eventprocessorStub); } @@ -646,6 +653,9 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic executionPlanName + " for " + identifier.getType() + " device with id:" + identifier.getId(), e ); + } catch (Exception e) { + throw new GeoLocationBasedServiceException( + "Error occurred while removing geo alert '" + alertType, e); } finally { cleanup(eventprocessorStub); } @@ -672,6 +682,9 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic "JWT token creation failed while removing geo alert '" + alertType + "': " + executionPlanName, e ); + } catch (Exception e) { + throw new GeoLocationBasedServiceException( + "Error occurred while removing geo alert '" + alertType, e); } finally { cleanup(eventprocessorStub); } @@ -702,14 +715,16 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic } } - protected EventProcessorAdminServiceStub getEventProcessorAdminServiceStub() throws JWTClientException { + protected EventProcessorAdminServiceStub getEventProcessorAdminServiceStub() throws Exception { //send alert to event-processing String eventProcessorAdminServiceWSUrl = Utils.replaceSystemProperty(GeoServices.DAS_URL) + "/services/EventProcessorAdminService"; //Getting the tenant Domain + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); + String username = ClaimsMgtUtil.getAdminUserNameFromTenantId(DeviceManagementDataHolder.getInstance().getRealmService(), + tenantId); String tenantAdminUser = username + "@" + tenantDomain; try { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java index ae39c831097..ee3072170cb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java @@ -89,7 +89,9 @@ public class DeviceTaskManagerServiceComponent { Map deviceConfigMap = DeviceMonitoringOperationDataHolder .getInstance().getOperationMonitoringConfigFromMap(); for (String platformType : new ArrayList<>(deviceConfigMap.keySet())) { - deviceTaskManagerService.startTask(platformType, deviceConfigMap.get(platformType)); + if (deviceConfigMap.get(platformType).isEnabled()){ + deviceTaskManagerService.startTask(platformType, deviceConfigMap.get(platformType)); + } deviceConfigMap.remove(platformType); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java index 133ba08cb0a..4f79999c8e0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java @@ -86,11 +86,18 @@ public class PushNotificationSchedulerTask implements Runnable { NotificationStrategy notificationStrategy = provider.getNotificationStrategyByDeviceType (operationMapping.getDeviceIdentifier().getType()); // Send the push notification on given strategy - notificationStrategy.execute(new NotificationContext(operationMapping.getDeviceIdentifier(), - provider.getOperation(operationMapping.getDeviceIdentifier().getType(), operationMapping - .getOperationId()))); - operationMapping.setPushNotificationStatus(Operation.PushNotificationStatus.COMPLETED); - operationsCompletedList.add(operationMapping); + if (notificationStrategy != null) { + notificationStrategy.execute(new NotificationContext(operationMapping.getDeviceIdentifier(), + provider.getOperation(operationMapping.getDeviceIdentifier().getType(), operationMapping + .getOperationId()))); + operationMapping.setPushNotificationStatus(Operation.PushNotificationStatus.COMPLETED); + operationsCompletedList.add(operationMapping); + } else { + if (log.isDebugEnabled()) { + log.debug("Tenant '" + PrivilegedCarbonContext.getThreadLocalCarbonContext() + .getTenantDomain() + "' does not have push notification strategy."); + } + } } catch (DeviceManagementException e) { log.error("Error occurred while getting notification strategy for operation mapping " + operationMapping.getDeviceIdentifier().getType(), e); @@ -121,7 +128,7 @@ public class PushNotificationSchedulerTask implements Runnable { log.debug("Push notification job running completed."); } } catch (Throwable cause) { - log.error("PushNotificationSchedulerTask failed due to " + cause); + log.error("PushNotificationSchedulerTask failed due to " + cause.getMessage(), cause); } } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index c3a1b37008e..9786b8f73dd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -24,6 +24,7 @@ import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.MonitoringOperation; +import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; @@ -589,6 +590,8 @@ public interface DeviceManagementProviderService { int getDeviceMonitoringFrequency(String deviceType); + OperationMonitoringTaskConfig getDeviceMonitoringConfig(String deviceType); + boolean isDeviceMonitoringEnabled(String deviceType); PolicyMonitoringManager getPolicyMonitoringManager(String deviceType); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index c7d23ecaaa4..a22242796c7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -1597,6 +1597,13 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return operationMonitoringTaskConfig.getFrequency(); } + @Override + public OperationMonitoringTaskConfig getDeviceMonitoringConfig(String deviceType) { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + DeviceManagementService dms = pluginRepository.getDeviceManagementService(deviceType, tenantId); + return dms.getOperationMonitoringConfig(); + } + @Override public boolean isDeviceMonitoringEnabled(String deviceType) { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java index 7b65a3b6ee5..fb91f62a52c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java @@ -16,16 +16,15 @@ * under the License. */ - package org.wso2.carbon.device.mgt.core.task.impl; -import com.google.gson.Gson; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.task.DeviceMgtTaskException; import org.wso2.carbon.device.mgt.core.task.DeviceTaskManager; import org.wso2.carbon.ntask.core.Task; @@ -38,20 +37,12 @@ public class DeviceDetailsRetrieverTask implements Task { private static Log log = LogFactory.getLog(DeviceDetailsRetrieverTask.class); private String deviceType; - private String oppConfig; - private OperationMonitoringTaskConfig operationMonitoringTaskConfig; private boolean executeForTenants = false; private final String IS_CLOUD = "is.cloud"; @Override public void setProperties(Map map) { deviceType = map.get("DEVICE_TYPE"); - oppConfig = map.get("OPPCONFIG"); - - Gson gson = new Gson(); - - operationMonitoringTaskConfig = gson.fromJson(oppConfig, - OperationMonitoringTaskConfig.class); } @Override @@ -60,29 +51,33 @@ public class DeviceDetailsRetrieverTask implements Task { @Override public void execute() { + DeviceManagementProviderService deviceManagementProviderService = DeviceManagementDataHolder.getInstance() + .getDeviceManagementProvider(); + OperationMonitoringTaskConfig operationMonitoringTaskConfig = deviceManagementProviderService + .getDeviceMonitoringConfig(deviceType); - if(System.getProperty(IS_CLOUD) != null && Boolean.parseBoolean(System.getProperty(IS_CLOUD))){ + if (System.getProperty(IS_CLOUD) != null && Boolean.parseBoolean(System.getProperty(IS_CLOUD))) { executeForTenants = true; } - if(executeForTenants){ - this.executeForAllTenants(); + if (executeForTenants) { + this.executeForAllTenants(operationMonitoringTaskConfig); } else { if (log.isDebugEnabled()) { log.debug("Device details retrieving task started to run."); } - DeviceTaskManager deviceTaskManager = new DeviceTaskManagerImpl(deviceType, - operationMonitoringTaskConfig); + DeviceTaskManager deviceTaskManager = new DeviceTaskManagerImpl(deviceType, operationMonitoringTaskConfig); //pass the configurations also from here, monitoring tasks try { - deviceTaskManager.addOperations(); + if (deviceManagementProviderService.isDeviceMonitoringEnabled(deviceType)) { + deviceTaskManager.addOperations(); + } } catch (DeviceMgtTaskException e) { - log.error( - "Error occurred while trying to add the operations to device to retrieve device details.", e); + log.error("Error occurred while trying to add the operations to device to retrieve device details.", e); } } } - private void executeForAllTenants() { + private void executeForAllTenants(OperationMonitoringTaskConfig operationMonitoringTaskConfig) { if (log.isDebugEnabled()) { log.debug("Device details retrieving task started to run for all tenants."); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java index b8119222dbe..d564fd7542f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java @@ -107,10 +107,12 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService { throws DeviceMgtTaskException { try { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); TaskService taskService = DeviceManagementDataHolder.getInstance().getTaskService(); if (taskService.isServerInit()) { TaskManager taskManager = taskService.getTaskManager(TASK_TYPE); - taskManager.deleteTask(deviceType); + String taskName = deviceType + String.valueOf(tenantId); + taskManager.deleteTask(taskName); } } catch (TaskException e) { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); @@ -131,8 +133,8 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService { TaskManager taskManager = taskService.getTaskManager(TASK_TYPE); if (taskManager.isTaskScheduled(deviceType)) { - - taskManager.deleteTask(deviceType); + String taskName = deviceType + String.valueOf(tenantId); + taskManager.deleteTask(taskName); TaskInfo.TriggerInfo triggerInfo = new TaskInfo.TriggerInfo(); triggerInfo.setIntervalMillis(operationMonitoringTaskConfig.getFrequency()); triggerInfo.setRepeatCount(-1); @@ -140,7 +142,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService { Map properties = new HashMap<>(); properties.put(TENANT_ID, String.valueOf(tenantId)); - TaskInfo taskInfo = new TaskInfo(deviceType, TASK_CLASS, properties, triggerInfo); + TaskInfo taskInfo = new TaskInfo(taskName, TASK_CLASS, properties, triggerInfo); taskManager.registerTask(taskInfo); taskManager.rescheduleTask(taskInfo.getName()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManagementService.java index 29ebe9c4937..d9449f6a498 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/TestDeviceManagementService.java @@ -43,7 +43,7 @@ public class TestDeviceManagementService implements DeviceManagementService { public TestDeviceManagementService(String deviceType, String tenantDomain) { providerType = deviceType; this.tenantDomain = tenantDomain; - this.operationCode = "default"; + this.operationCode = "DEVICE_INFO"; } @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java index 1e0916d079a..649ecf42441 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java @@ -143,7 +143,7 @@ public class GeoLocationProviderServiceTest { Assert.assertEquals(geoFenceNode.getStationaryTime(), SAMPLE_STATIONARY_TIME); } - private void initMocks() throws JWTClientException, RemoteException { + private void initMocks() throws Exception { EventProcessorAdminServiceStub mockEventProcessorAdminServiceStub = Mockito.mock(EventProcessorAdminServiceStub.class); geoLocationProviderServiceImpl = Mockito.mock(GeoLocationProviderServiceImpl.class, Mockito.CALLS_REAL_METHODS); mockExecutionPlanConfigurationDto[0] = Mockito.mock(ExecutionPlanConfigurationDto.class); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/task/DeviceTaskManagerTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/task/DeviceTaskManagerTest.java index d76783991c6..4b558f07086 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/task/DeviceTaskManagerTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/task/DeviceTaskManagerTest.java @@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.core.task; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.testng.Assert; import org.testng.annotations.AfterClass; @@ -27,6 +28,8 @@ import org.testng.annotations.Test; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.MonitoringOperation; +import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; 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; @@ -60,8 +63,6 @@ public class DeviceTaskManagerTest extends BaseDeviceManagementTest { private static final Log log = LogFactory.getLog(DeviceTaskManagerTest.class); private static final String NEW_DEVICE_TYPE = "NEW-DEVICE-TYPE"; - private static final String DEVICE_DETAIL_RETRIEVER_OPPCONFIG = "{\"isEnabled\":true,\"frequency\":60000," + - "\"monitoringOperation\":[{\"taskName\":\"DEVICE_INFO\",\"recurrentTimes\":2}]}"; private List deviceIds; private DeviceTaskManager deviceTaskManager; private DeviceManagementProviderService deviceMgtProviderService; @@ -76,7 +77,6 @@ public class DeviceTaskManagerTest extends BaseDeviceManagementTest { } List devices = TestDataHolder.generateDummyDeviceData(this.deviceIds); this.deviceMgtProviderService = new DeviceManagementProviderServiceImpl(); - DeviceManagementServiceComponent.notifyStartupListeners(); DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(this.deviceMgtProviderService); DeviceManagementDataHolder.getInstance() @@ -152,7 +152,6 @@ public class DeviceTaskManagerTest extends BaseDeviceManagementTest { DeviceDetailsRetrieverTask deviceDetailsRetrieverTask = new DeviceDetailsRetrieverTask(); Map map = new HashMap<>(); map.put("DEVICE_TYPE", TestDataHolder.TEST_DEVICE_TYPE); - map.put("OPPCONFIG", DEVICE_DETAIL_RETRIEVER_OPPCONFIG); deviceDetailsRetrieverTask.setProperties(map); deviceDetailsRetrieverTask.execute(); for (DeviceIdentifier deviceId : deviceIds) { @@ -172,7 +171,6 @@ public class DeviceTaskManagerTest extends BaseDeviceManagementTest { System.setProperty("is.cloud", "true"); Map map = new HashMap<>(); map.put("DEVICE_TYPE", TestDataHolder.TEST_DEVICE_TYPE); - map.put("OPPCONFIG", DEVICE_DETAIL_RETRIEVER_OPPCONFIG); deviceDetailsRetrieverTask.setProperties(map); deviceDetailsRetrieverTask.execute(); for (DeviceIdentifier deviceId : deviceIds) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 3b4f031c6d5..d717cdae31e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -15,6 +15,9 @@ "iOSConfigRoot": "%https.ip%/ios-enrollment/", "iOSAPIRoot": "%https.ip%/ios/", "adminService": "%https.ip%", + "deviceInfoServiceAPI" : "/api/device-mgt/%device-type%/v1.0/admin/devices/info", + "deviceLocationServiceAPI" : "/api/device-mgt/%device-type%/v1.0/admin/devices/location", + "iOSDeviceInfoServiceAPI" : "/api/device-mgt/%device-type%/v1.0/admin/devices/info", "gatewayEnabled": true, "oauthProvider": { "appRegistration": { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js index 805ec7a3ab4..67b20c2a981 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js @@ -279,10 +279,12 @@ var getProviderData = function (timeFrom, timeTo) { var serviceUrl = '/api/device-mgt/v1.0/geo-services/stats/' + deviceType + '/' + deviceId + '?from=' + timeFrom + '&to=' + timeTo; invokerUtil.get(serviceUrl, function (data) { - if(data === ""){showCurrentLocation(tableData);} + if (data === "") { + showCurrentLocation(tableData); + } tableData = JSON.parse(data); if (tableData.length === 0) { - showCurrentLocation(tableData); + showCurrentLocation(tableData); } }, function (message) { showCurrentLocation(tableData); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/error-pages-router.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/error-pages-router.js index 5da3b447515..a0e30cc5476 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/error-pages-router.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/error-pages-router.js @@ -113,8 +113,7 @@ conf: appConfigurations }, uri: errorPage.definition[constants.PAGE_DEFINITION_URI], - uriParams: {}, - user: utils.getCurrentUser() + uriParams: {} }; var templateContext = {status: status, message: message}; var renderer = require("/lib/dynamic-files-renderer.js").renderer; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index 9f02be6c4ca..70686c9498c 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -29,7 +29,6 @@ 4.0.0 org.wso2.carbon.device.mgt.api.feature pom - 3.2.1-SNAPSHOT WSO2 Carbon - Device Management API Feature http://wso2.org This feature contains the APIs required for Device Management console UI diff --git a/pom.xml b/pom.xml index f731484ef2b..80a56540e35 100644 --- a/pom.xml +++ b/pom.xml @@ -36,8 +36,8 @@ components/device-mgt - components/device-mgt-extensions - components/identity-extensions + components/device-mgt-extensionscomponents/identity-extensions + components/identity-extensions components/apimgt-extensions components/policy-mgt components/certificate-mgt