mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt into entgra-master
# Conflicts: # components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml # components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml # components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml # components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml # components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml # components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml # components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml # components/apimgt-extensions/pom.xml # components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml # components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml # components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.v09.api/pom.xml # components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml # components/certificate-mgt/org.wso2.carbon.certificate.mgt.v09.api/pom.xml # components/certificate-mgt/pom.xml # components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml # components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml # components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml # components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml # components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml # components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml # components/device-mgt-extensions/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dto/operation/mgt/Operation.java # components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java # components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml # components/device-mgt/org.wso2.carbon.device.mgt.v09.api/pom.xml # components/device-mgt/pom.xml # components/email-sender/org.wso2.carbon.email.sender.core/pom.xml # components/email-sender/pom.xml # components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml # components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml # components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml # components/identity-extensions/pom.xml # components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml # components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml # components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml # components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml # components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml # components/policy-mgt/pom.xml # components/test-coverage/pom.xml # components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml # components/webapp-authenticator-framework/pom.xml # features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml # features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml # features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml # features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml # features/apimgt-extensions/pom.xml # features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml # features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml # features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml # features/certificate-mgt/pom.xml # features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml # features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml # features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml # features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml # features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml # features/device-mgt-extensions/pom.xml # features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/pom.xml # features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml # features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/pom.xml # features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml # features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml # features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml # features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml # features/device-mgt/pom.xml # features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml # features/email-sender/pom.xml # features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml # features/jwt-client/pom.xml # features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml # features/oauth-extensions/pom.xml # features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml # features/policy-mgt/pom.xml # features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml # features/webapp-authenticator-framework/pom.xml # pom.xml
This commit is contained in:
commit
f0ec4a3520
@ -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<SearchResultEntry> searchResults = analyticsDataAPI.search(tenantId, tableName, query,
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -89,7 +89,9 @@ public class DeviceTaskManagerServiceComponent {
|
||||
Map<String, OperationMonitoringTaskConfig> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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<String, String> 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.");
|
||||
|
||||
@ -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<String, String> 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());
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<DeviceIdentifier> deviceIds;
|
||||
private DeviceTaskManager deviceTaskManager;
|
||||
private DeviceManagementProviderService deviceMgtProviderService;
|
||||
@ -76,7 +77,6 @@ public class DeviceTaskManagerTest extends BaseDeviceManagementTest {
|
||||
}
|
||||
List<Device> 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<String, String> 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<String, String> 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) {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.api.feature</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.2.1-SNAPSHOT</version>
|
||||
<name>WSO2 Carbon - Device Management API Feature</name>
|
||||
<url>http://wso2.org</url>
|
||||
<description>This feature contains the APIs required for Device Management console UI</description>
|
||||
|
||||
4
pom.xml
4
pom.xml
@ -36,8 +36,8 @@
|
||||
|
||||
<modules>
|
||||
<module>components/device-mgt</module>
|
||||
<module>components/device-mgt-extensions</module>
|
||||
<module>components/identity-extensions</module>
|
||||
<module>components/device-mgt-extensions</module><module>components/identity-extensions</module>
|
||||
<module>components/identity-extensions</module>
|
||||
<module>components/apimgt-extensions</module>
|
||||
<module>components/policy-mgt</module>
|
||||
<module>components/certificate-mgt</module>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user