diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 582123a3aa..98b5295724 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -62,6 +62,22 @@ org.wso2.carbon org.wso2.carbon.ndatasource.core + + org.testng + testng + test + + + org.powermock + powermock-api-mockito + test + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.extensions.pull.notification + test + + @@ -117,6 +133,15 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + + src/test/resources/testng.xml + + + org.jacoco jacoco-maven-plugin diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java new file mode 100644 index 0000000000..f261f98374 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java @@ -0,0 +1,276 @@ +/* + * 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.base.MultitenantConstants; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.DeviceStatusTaskPluginConfig; +import org.wso2.carbon.device.mgt.common.InitialOperationConfig; +import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; +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.PlatformConfiguration; +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.DeviceTypeConfiguration; +import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PolicyMonitoring; +import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PullNotificationSubscriberConfig; +import org.wso2.carbon.device.mgt.extensions.device.type.template.config.PushNotificationProvider; +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.utils.Utils; +import org.xml.sax.SAXException; + +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import static org.powermock.api.mockito.PowerMockito.when; + +/** + * This is the test class for {@link DeviceTypeManagerService} + */ +public class DeviceTypeManagerServiceTest { + private DeviceTypeManagerService androidDeviceTypeManagerService; + private DeviceTypeConfiguration androidDeviceConfiguration; + private DeviceTypeManagerService rasberrypiDeviceTypeManagerService; + private DeviceTypeConfiguration rasberrypiDeviceConfiguration; + private Method setProvisioningConfig; + private Method setOperationMonitoringConfig; + private Method setDeviceStatusTaskPluginConfig; + private Method populatePushNotificationConfig; + private Method setPolicyMonitoringManager; + private Method setPullNotificationSubscriber; + + @BeforeTest + public void setup() throws NoSuchMethodException, SAXException, JAXBException, ParserConfigurationException, + DeviceTypeConfigurationException, IOException, NoSuchFieldException, IllegalAccessException, + DeviceManagementException { + setProvisioningConfig = DeviceTypeManagerService.class + .getDeclaredMethod("setProvisioningConfig", String.class, DeviceTypeConfiguration.class); + setProvisioningConfig.setAccessible(true); + setDeviceStatusTaskPluginConfig = DeviceTypeManagerService.class + .getDeclaredMethod("setDeviceStatusTaskPluginConfig", DeviceStatusTaskConfiguration.class); + setDeviceStatusTaskPluginConfig.setAccessible(true); + setOperationMonitoringConfig = DeviceTypeManagerService.class + .getDeclaredMethod("setOperationMonitoringConfig", DeviceTypeConfiguration.class); + setOperationMonitoringConfig.setAccessible(true); + populatePushNotificationConfig = DeviceTypeManagerService.class + .getDeclaredMethod("populatePushNotificationConfig", PushNotificationProvider.class); + populatePushNotificationConfig.setAccessible(true); + setPolicyMonitoringManager = DeviceTypeManagerService.class + .getDeclaredMethod("setPolicyMonitoringManager", PolicyMonitoring.class); + setPolicyMonitoringManager.setAccessible(true); + setPullNotificationSubscriber = DeviceTypeManagerService.class + .getDeclaredMethod("setPullNotificationSubscriber", PullNotificationSubscriberConfig.class); + setPullNotificationSubscriber.setAccessible(true); + + Field deviceStatusTaskPluginConfig = DeviceTypeManagerService.class + .getDeclaredField("deviceStatusTaskPluginConfig"); + deviceStatusTaskPluginConfig.setAccessible(true); + + Field operationMonitoringConfigs = DeviceTypeManagerService.class + .getDeclaredField("operationMonitoringConfigs"); + operationMonitoringConfigs.setAccessible(true); + + Field initialOperationConfig = DeviceTypeManagerService.class.getDeclaredField("initialOperationConfig"); + initialOperationConfig.setAccessible(true); + + Field deviceManager = DeviceTypeManagerService.class.getDeclaredField("deviceManager"); + deviceManager.setAccessible(true); + + androidDeviceTypeManagerService = Mockito.mock(DeviceTypeManagerService.class, Mockito.CALLS_REAL_METHODS); + deviceStatusTaskPluginConfig.set(androidDeviceTypeManagerService, new DeviceStatusTaskPluginConfig()); + operationMonitoringConfigs.set(androidDeviceTypeManagerService, new OperationMonitoringTaskConfig()); + initialOperationConfig.set(androidDeviceTypeManagerService, new InitialOperationConfig()); + + rasberrypiDeviceTypeManagerService = Mockito.mock(DeviceTypeManagerService.class, Mockito.CALLS_REAL_METHODS); + deviceStatusTaskPluginConfig.set(rasberrypiDeviceTypeManagerService, new DeviceStatusTaskPluginConfig()); + operationMonitoringConfigs.set(rasberrypiDeviceTypeManagerService, new OperationMonitoringTaskConfig()); + initialOperationConfig.set(rasberrypiDeviceTypeManagerService, new InitialOperationConfig()); + + ClassLoader classLoader = getClass().getClassLoader(); + URL resourceUrl = classLoader.getResource("android.xml"); + + File androidConfiguration = null; + if (resourceUrl != null) { + androidConfiguration = new File(resourceUrl.getFile()); + } + androidDeviceConfiguration = Utils.getDeviceTypeConfiguration(androidConfiguration); + + resourceUrl = classLoader.getResource("raspberrypi.xml"); + File raspberrypiConfiguration = null; + if (resourceUrl != null) { + raspberrypiConfiguration = new File(resourceUrl.getFile()); + } + rasberrypiDeviceConfiguration = Utils.getDeviceTypeConfiguration(raspberrypiConfiguration); + + PlatformConfiguration platformConfiguration = new PlatformConfiguration(); + platformConfiguration.setType("android"); + List configurationEntries = new ArrayList<>(); + ConfigurationEntry configurationEntry = new ConfigurationEntry(); + configurationEntry.setValue("10"); + configurationEntry.setName("frequency"); + configurationEntry.setContentType("Integer"); + + configurationEntries.add(configurationEntry); + platformConfiguration.setConfiguration(configurationEntries); + + if (androidConfiguration != null) { + // This is needed for DeviceTypeManager Initialization + System.setProperty("carbon.home", androidConfiguration.getAbsolutePath()); + } + DeviceTypeManager deviceTypeManager = Mockito.mock(DeviceTypeManager.class); + when(deviceTypeManager.getConfiguration()).thenReturn(platformConfiguration); + deviceManager.set(androidDeviceTypeManagerService, deviceTypeManager); + } + + @Test(description = "This test cases tests the retrieval of provisioning config after providing the configurations " + + "values") + public void testWithProvisioningConfig() throws Exception { + boolean isRasberryPiSharedWithTenants = + (rasberrypiDeviceConfiguration.getProvisioningConfig() != null) && rasberrypiDeviceConfiguration + .getProvisioningConfig().isSharedWithAllTenants(); + setProvisioningConfig.invoke(androidDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, + androidDeviceConfiguration); + ProvisioningConfig provisioningConfig = androidDeviceTypeManagerService.getProvisioningConfig(); + Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), + androidDeviceConfiguration.getProvisioningConfig().isSharedWithAllTenants(), + "Provisioning configs " + "are not correctly set as per the configuration file provided"); + + setProvisioningConfig.invoke(rasberrypiDeviceTypeManagerService, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, + rasberrypiDeviceConfiguration); + provisioningConfig = rasberrypiDeviceTypeManagerService.getProvisioningConfig(); + Assert.assertEquals(provisioningConfig.isSharedWithAllTenants(), isRasberryPiSharedWithTenants, + "Provisioning configs are not correctly set as per the configuration file provided."); + } + + @Test (description = "This test case tests the Device task config retrieval") + public void testDeviceStatusTaskConfig () throws InvocationTargetException, IllegalAccessException { + setDeviceStatusTaskPluginConfig + .invoke(androidDeviceTypeManagerService, androidDeviceConfiguration.getDeviceStatusTaskConfiguration()); + DeviceStatusTaskPluginConfig deviceStatusTaskPuginConfig = androidDeviceTypeManagerService + .getDeviceStatusTaskPluginConfig(); + DeviceStatusTaskConfiguration deviceStatusTaskConfiguration = androidDeviceConfiguration + .getDeviceStatusTaskConfiguration(); + + Assert.assertEquals(deviceStatusTaskPuginConfig.getFrequency(), deviceStatusTaskConfiguration.getFrequency(), + "Frequency provided in the device task configuration is not set properly."); + Assert.assertEquals(deviceStatusTaskPuginConfig.getIdleTimeToMarkInactive(), + deviceStatusTaskConfiguration.getIdleTimeToMarkInactive(), + "Idle time to mark inactive provided in " + "the device task configuration is not set properly."); + Assert.assertEquals(deviceStatusTaskPuginConfig.getIdleTimeToMarkUnreachable(), + deviceStatusTaskConfiguration.getIdleTimeToMarkUnreachable(), + "Idle time to mark un-reachable " + "provided in the device task configuration is not set properly."); + Assert.assertEquals(deviceStatusTaskPuginConfig.isRequireStatusMonitoring(), + deviceStatusTaskConfiguration.isEnabled(), + "Enabled status provided in the device task configuration" + " is not set properly"); + + setDeviceStatusTaskPluginConfig.invoke(rasberrypiDeviceTypeManagerService, + rasberrypiDeviceConfiguration.getDeviceStatusTaskConfiguration()); + deviceStatusTaskPuginConfig = rasberrypiDeviceTypeManagerService.getDeviceStatusTaskPluginConfig(); + Assert.assertEquals(deviceStatusTaskPuginConfig.getFrequency(), 0); + } + + @Test(description = "This test case aims to test whether correct operations are listed as per the configuration " + + "of device types") + public void testOperationConfig() throws InvocationTargetException, IllegalAccessException { + setOperationMonitoringConfig.invoke(androidDeviceTypeManagerService, androidDeviceConfiguration); + OperationMonitoringTaskConfig operationMonitoringTaskConfig = androidDeviceTypeManagerService + .getOperationMonitoringConfig(); + TaskConfiguration taskConfiguration = androidDeviceConfiguration.getTaskConfiguration(); + Assert.assertEquals(operationMonitoringTaskConfig.getFrequency(), taskConfiguration.getFrequency(), + "Policy " + "Monitoring frequency does not match with the frequency in the configuration"); + Assert.assertEquals(operationMonitoringTaskConfig.getMonitoringOperation().size(), + taskConfiguration.getOperations().size(), + "Number of task configuration operations does not match with the task " + + "configuration operations provided in the configuration file"); + + setOperationMonitoringConfig.invoke(rasberrypiDeviceTypeManagerService, rasberrypiDeviceConfiguration); + operationMonitoringTaskConfig = rasberrypiDeviceTypeManagerService.getOperationMonitoringConfig(); + Assert.assertEquals(operationMonitoringTaskConfig.getFrequency(), 0, + "Frequency is set for a non-existing " + "operation task configuration"); + } + + @Test(description = "This test case tests the populateNotificationConfig method and retrieval of the same.") + public void testPopulatePushNotificationConfig() throws InvocationTargetException, IllegalAccessException { + populatePushNotificationConfig + .invoke(androidDeviceTypeManagerService, androidDeviceConfiguration.getPushNotificationProvider()); + PushNotificationConfig pushNotificationConfig = androidDeviceTypeManagerService.getPushNotificationConfig(); + Assert.assertNotEquals(pushNotificationConfig, null, "Push notification configuration is set even though " + + "Push notfication configuration was not mentioned."); + + populatePushNotificationConfig.invoke(rasberrypiDeviceTypeManagerService, + rasberrypiDeviceConfiguration.getPushNotificationProvider()); + pushNotificationConfig = rasberrypiDeviceTypeManagerService.getPushNotificationConfig(); + PushNotificationProvider pushNotificationProvider = rasberrypiDeviceConfiguration.getPushNotificationProvider(); + Assert.assertEquals(pushNotificationConfig.getType(), pushNotificationProvider.getType()); + Assert.assertEquals(pushNotificationConfig.isScheduled(), pushNotificationProvider.isScheduled()); + } + + @Test(description = "This test case tests the initial operation configuration setting and retrieval of the same.") + public void testSetInitialOperationConfig() throws InvocationTargetException, IllegalAccessException { + androidDeviceTypeManagerService.setInitialOperationConfig(androidDeviceConfiguration); + InitialOperationConfig initialOperationConfig = androidDeviceTypeManagerService.getInitialOperationConfig(); + + Assert.assertEquals(initialOperationConfig.getOperations().size(),androidDeviceConfiguration.getOperations() + .size()); + } + + @Test(description = "This test case tests the policy monitoring configuration setting.") + public void testSetPolicyMonitoring() throws InvocationTargetException, IllegalAccessException { + setPolicyMonitoringManager + .invoke(androidDeviceTypeManagerService, androidDeviceConfiguration.getPolicyMonitoring()); + Assert.assertEquals(androidDeviceTypeManagerService.getPolicyMonitoringManager() != null, + (androidDeviceConfiguration.getPolicyMonitoring() != null && androidDeviceConfiguration + .getPolicyMonitoring().isEnabled()), + "Policy Management configurations are added as per the " + "configuration file"); + setPolicyMonitoringManager + .invoke(rasberrypiDeviceTypeManagerService, rasberrypiDeviceConfiguration.getPolicyMonitoring()); + Assert.assertEquals(rasberrypiDeviceTypeManagerService.getPolicyMonitoringManager() != null, + (rasberrypiDeviceConfiguration.getPolicyMonitoring() != null && rasberrypiDeviceConfiguration + .getPolicyMonitoring().isEnabled()), + "Policy Management configurations are added as " + "per the " + "configuration file"); + } + + @Test (description = "This test case tests whether the Pull Notification Subscriber is set correctly.") + public void testSetPullNotificationSubscriberConfig() throws InvocationTargetException, IllegalAccessException { + setPullNotificationSubscriber.invoke(androidDeviceTypeManagerService, androidDeviceConfiguration + .getPullNotificationSubscriberConfig()); + Assert.assertEquals(androidDeviceTypeManagerService.getPullNotificationSubscriber() != null, + androidDeviceConfiguration.getPullNotificationSubscriberConfig() != null); + setPullNotificationSubscriber.invoke(rasberrypiDeviceTypeManagerService, rasberrypiDeviceConfiguration + .getPullNotificationSubscriberConfig()); + Assert.assertEquals(rasberrypiDeviceTypeManagerService.getPullNotificationSubscriber() != null, + rasberrypiDeviceConfiguration.getPullNotificationSubscriberConfig() != null); + + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java new file mode 100644 index 0000000000..f19049015b --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.wso2.carbon.device.mgt.extensions.utils; + +import org.w3c.dom.Document; +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.xml.sax.SAXException; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import java.io.File; +import java.io.IOException; + +/** + * This class handles the test utility tasks. + */ +public class Utils { + + /** + * To get the device type configuration based on the configuration file + * @param configurationFile Relevant configuration file of a device type + * @return the DeviceTypeConfiguration object of the relevant Device Type + * @throws DeviceTypeConfigurationException DeviceType Configuration Exception + * @throws IOException IO Exception + * @throws SAXException SAX Exception + * @throws ParserConfigurationException Parser Configuration Exception + * @throws JAXBException JAXB Exception + */ + public static DeviceTypeConfiguration getDeviceTypeConfiguration(File configurationFile) + throws DeviceTypeConfigurationException, IOException, SAXException, ParserConfigurationException, + JAXBException { + + Document doc = convertToDocument(configurationFile); + + /* Un-marshaling Webapp Authenticator configuration */ + JAXBContext ctx = JAXBContext.newInstance(DeviceTypeConfiguration.class); + Unmarshaller unmarshaller = ctx.createUnmarshaller(); + //unmarshaller.setSchema(getSchema()); + return (DeviceTypeConfiguration) unmarshaller.unmarshal(doc); + + } + + private static Document convertToDocument(File file) + throws DeviceTypeConfigurationException, ParserConfigurationException, IOException, SAXException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + return docBuilder.parse(file); + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android.xml new file mode 100644 index 0000000000..2cc394bde1 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/android.xml @@ -0,0 +1,381 @@ + + + + + + + + + en_US + 1.0.0 + This End User License Agreement ("Agreement") is a legal agreement between you ("You") and WSO2, + Inc., regarding the enrollment of Your personal mobile device ("Device") in SoR's mobile device + management program, and the loading to and removal from Your Device and Your use of certain + applications and any associated software and user documentation, whether provided in "online" or + electronic format, used in connection with the operation of or provision of services to WSO2, + Inc., BY SELECTING "I ACCEPT" DURING INSTALLATION, YOU ARE ENROLLING YOUR DEVICE, AND THEREBY + AUTHORIZING SOR OR ITS AGENTS TO INSTALL, UPDATE AND REMOVE THE APPS FROM YOUR DEVICE AS DESCRIBED + IN THIS AGREEMENT. YOU ARE ALSO EXPLICITLY ACKNOWLEDGING AND AGREEING THAT (1) THIS IS A BINDING + CONTRACT AND (2) YOU HAVE READ AND AGREE TO THE TERMS OF THIS AGREEMENT. + + IF YOU DO NOT ACCEPT THESE TERMS, DO NOT ENROLL YOUR DEVICE AND DO NOT PROCEED ANY FURTHER. + + You agree that: (1) You understand and agree to be bound by the terms and conditions contained in + this Agreement, and (2) You are at least 21 years old and have the legal capacity to enter into + this Agreement as defined by the laws of Your jurisdiction. SoR shall have the right, without + prior notice, to terminate or suspend (i) this Agreement, (ii) the enrollment of Your Device, or + (iii) the functioning of the Apps in the event of a violation of this Agreement or the cessation + of Your relationship with SoR (including termination of Your employment if You are an employee or + expiration or termination of Your applicable franchise or supply agreement if You are a franchisee + of or supplier to the WSO2 WSO2, Inc., system). SoR expressly reserves all rights not expressly + granted herein. + + + + + true + + + + + + + + + jdbc/MobileAndroidDM_DS + + + + DEVICE_ID + + FCM_TOKEN + DEVICE_INFO + IMEI + IMSI + OS_VERSION + DEVICE_MODEL + VENDOR + LATITUDE + LONGITUDE + SERIAL + MAC_ADDRESS + DEVICE_NAME + OS_BUILD_DATE + +
+
+
+ + + + Ring + Ring the device + + + + + Device Lock + Lock the device + + + + + Location + Request coordinates of device location + + + + + Clear Password + Clear current password + + + + + Reboot + Reboot the device + + + + + Upgrade Firmware + Upgrade Firmware + + + + + Mute + Enable mute in the device + + + + + Message + Send message + + + + + Change Lock-code + Change current lock code + + + + + Enterprise Wipe + Remove enterprise applications + + + + + Wipe Data + Factory reset the device + + + + + Wifi + Setting up wifi configuration + + + Camera + Enable or disable camera + + + Email + Configure email settings + + + Device info + Request device information + + + Application List + Request list of current installed applications + + + Install App + Install App + + + Uninstall App + Uninstall App + + + Blacklist app + Blacklist applications + + + Encrypt Storage + Encrypt storage + + + Password Policy + Set passcode policy + + + Configure VPN + Configure VPN settings + + + Disallow user to change volume + Allow or disallow user to change volume" + + + Disallow bluetooth configuration + Allow or disallow bluetooth configuration + + + Disallow user to change cell broadcast configurations + Allow or disallow user to change cell broadcast configurations + + + Disallow user to change user credentials + Allow or disallow user to change user credentials + + + Disallow user to change mobile networks configurations + Allow or disallow user to change mobile networks configurations + + + Disallow user to change tethering configurations + Allow or disallow user to change tethering configurations + + + Disallow user to change VPN configurations + Allow or disallow user to change VPN configurations + + + Disallow user to change WIFI configurations + Allow or disallow user to change WIFI configurations + + + Disallow user to change app control + Allow or disallow user to change app control + + + Disallow window creation + Allow or disallow window creation + + + Disallow user to change app control configurations + Allow or disallow user to change app control configurations + + + Disallow cross profile copy paste + Allow or disallow cross profile copy paste + + + Disallow debugging features + Allow or disallow debugging features + + + Disallow factory reset + Allow or disallow factory reset + + + Disallow add user + Allow or disallow add user + + + Disallow install apps + Allow or disallow install apps + + + Disallow install unknown sources + Allow or disallow install unknown sources + + + Disallow modify account + Allow or disallow modify account + + + Disallow mount physical media + Allow or disallow mount physical media + + + Disallow network reset + Allow or disallow network reset + + + Disallow outgoing beam + Allow or disallow outgoing beam + + + Disallow outgoing calls + Allow or disallow outgoing calls + + + Disallow remove users + Allow or disallow remove users + + + Disallow safe boot + Allow or disallow safe boot + + + Disallow share location + Allow or disallow share location + + + Disallow sms + Allow or disallow sms + + + Disallow uninstall app + Allow or disallow uninstall app + + + Disallow unmute mic + Allow or disallow unmute mic + + + Disallow usb file transfer + Allow or disallow usb file transfer + + + Disallow parent profile app linking + Allow or disallow parent profile app linking + + + Disallow ensure verify apps + Allow or disallow ensure verify apps + + + Disallow auto timing + Allow or disallow auto timing + + + Remove device owner + Remove device owner + + + Fetch device logcat + Fetch device logcat + + + Unlock the device + Unlock the device + + + + true + 60000 + + + DEVICE_INFO + 1 + + + APPLICATION_LIST + 5 + + + DEVICE_LOCATION + 1 + + + + + + DEVICE_INFO + APPLICATION_LIST + DEVICE_LOCATION + + + true + 300 + 900 + 600 + + + + false + + + + + admin + + +
\ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml new file mode 100644 index 0000000000..5115fafd8e --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/raspberrypi.xml @@ -0,0 +1,47 @@ + + + + + + + Control Bulb + Control Bulb on Raspberrypi + + + state + + + + + + + + true + + 1 + + + + + en_US + 1.0.0 + This is license text + + + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml new file mode 100644 index 0000000000..026b63df9a --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/testng.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index 3ae68fd378..b51fc5cc9f 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -154,6 +154,7 @@ + @@ -179,6 +180,10 @@ + + + + diff --git a/pom.xml b/pom.xml index 6b5818d674..c30878f9e1 100644 --- a/pom.xml +++ b/pom.xml @@ -1526,6 +1526,12 @@ org.wso2.carbon.registry.resource ${carbon.registry.resource.version} + + org.powermock + powermock-api-mockito + ${power.mock.version} + test + @@ -1955,6 +1961,7 @@ 0.7.8 0.7.5.201505241946 1.0b3 + 1.6.4