From ea06e593a4bedb680565b0f762f52c4eca91c1ba Mon Sep 17 00:00:00 2001 From: GDLMadushanka Date: Fri, 13 Oct 2017 09:55:17 +0530 Subject: [PATCH 1/2] unit tests for device type capp deployer --- .../type/deployer/DeviceTypeCAppDeployer.java | 4 +- .../deployer/DeviceTypeCAppDeployerTest.java | 132 ++++++ .../DeviceTypePluginDeployerTest.java | 40 +- .../src/test/resources/invalidAndroid.xml | 382 ++++++++++++++++++ .../src/test/resources/testng.xml | 1 + 5 files changed, 552 insertions(+), 7 deletions(-) create mode 100644 components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java create mode 100644 components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/invalidAndroid.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployer.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployer.java index 435e3cad3b3..2880177a9e5 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployer.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployer.java @@ -78,7 +78,7 @@ public class DeviceTypeCAppDeployer implements AppDeploymentHandler { } - private void deployTypeSpecifiedArtifacts(List artifacts, AxisConfiguration axisConfig, + protected void deployTypeSpecifiedArtifacts(List artifacts, AxisConfiguration axisConfig, String fileType, String directory) throws DeploymentException { for (Artifact artifact : artifacts) { Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType); @@ -118,7 +118,7 @@ public class DeviceTypeCAppDeployer implements AppDeploymentHandler { } - private void undeployTypeSpecifiedArtifacts(List artifacts, AxisConfiguration axisConfig, String fileType + protected void undeployTypeSpecifiedArtifacts(List artifacts, AxisConfiguration axisConfig, String fileType , String directory) throws DeploymentException { for (Artifact artifact : artifacts) { Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType); diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java new file mode 100644 index 00000000000..0f1788f03c2 --- /dev/null +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java @@ -0,0 +1,132 @@ +/* + * 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.deployer; + +import org.apache.axis2.deployment.DeploymentException; +import org.apache.axis2.engine.AxisConfiguration; +import org.mockito.Mockito; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.application.deployer.CarbonApplication; +import org.wso2.carbon.application.deployer.config.ApplicationConfiguration; +import org.wso2.carbon.application.deployer.config.Artifact; +import org.wso2.carbon.application.deployer.config.CappFile; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants; +import org.wso2.carbon.registry.core.exceptions.RegistryException; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.ArrayList; + +/* + Unit tests for deviceTypeCAppDeployer + */ +public class DeviceTypeCAppDeployerTest { + private DeviceTypeCAppDeployer deviceTypeCAppDeployer; + private CarbonApplication carbonApplication = null; + private AxisConfiguration axisConfiguration = null; + private ApplicationConfiguration applicationConfiguration = null; + private CappFile cappFile = new CappFile(); + + + private void initializeActifact(String type) { + Artifact tempArtifact = new Artifact(); + cappFile.setName("testCappFile"); + tempArtifact.setType(type); + tempArtifact.addFile(cappFile); + Artifact.Dependency dependency = new Artifact.Dependency(); + dependency.setArtifact(tempArtifact); + tempArtifact.addDependency(dependency); + Mockito.doReturn(tempArtifact).when(applicationConfiguration).getApplicationArtifact(); + } + + private void initializeErrorArtifact() { + Artifact errArtifact = new Artifact(); + errArtifact.setType(DeviceTypePluginConstants.CDMF_PLUGIN_TYPE); + Artifact.Dependency dependency = new Artifact.Dependency(); + dependency.setArtifact(errArtifact); + errArtifact.addDependency(dependency); + Mockito.doReturn(errArtifact).when(applicationConfiguration).getApplicationArtifact(); + } + + @BeforeClass + public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException { + Field deviceTypePlugins; + Field deviceTypeUIs; + deviceTypeCAppDeployer = Mockito.mock(DeviceTypeCAppDeployer.class, Mockito.CALLS_REAL_METHODS); + carbonApplication = Mockito.mock(CarbonApplication.class, Mockito.CALLS_REAL_METHODS); + axisConfiguration = Mockito.mock(AxisConfiguration.class, Mockito.CALLS_REAL_METHODS); + applicationConfiguration = Mockito.mock(ApplicationConfiguration.class, Mockito.CALLS_REAL_METHODS); + Mockito.doReturn(applicationConfiguration).when(carbonApplication).getAppConfig(); + Mockito.doNothing().when(deviceTypeCAppDeployer).deployTypeSpecifiedArtifacts(Mockito.any(), Mockito.any(), + Mockito.any(), Mockito.any()); + Mockito.doNothing().when(deviceTypeCAppDeployer).undeployTypeSpecifiedArtifacts(Mockito.any(), Mockito.any(), + Mockito.any(), Mockito.any()); + this.initializeCarbonContext(); + deviceTypePlugins = DeviceTypeCAppDeployer.class.getDeclaredField("deviceTypePlugins"); + deviceTypePlugins.setAccessible(true); + deviceTypePlugins.set(deviceTypeCAppDeployer, new ArrayList()); + deviceTypeUIs = DeviceTypeCAppDeployer.class.getDeclaredField("deviceTypeUIs"); + deviceTypeUIs.setAccessible(true); + deviceTypeUIs.set(deviceTypeCAppDeployer, new ArrayList()); + } + + private void initializeCarbonContext() throws IOException, RegistryException { + if (System.getProperty("carbon.home") == null) { + File file = new File("src/test/resources"); + if (file.exists()) { + System.setProperty("carbon.home", file.getAbsolutePath()); + } + } + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( + org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId( + org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID); + } + + @Test(description = "deploying a capp of plugin type") + public void testDeployCarbonAppsPluginType() throws DeploymentException, IllegalAccessException { + initializeActifact(DeviceTypePluginConstants.CDMF_PLUGIN_TYPE); + deviceTypeCAppDeployer.deployArtifacts(carbonApplication, axisConfiguration); + } + + @Test(description = "deploying an erroneous car file") + public void testDeployErrorArtifact() throws DeploymentException, IllegalAccessException { + initializeErrorArtifact(); + deviceTypeCAppDeployer.deployArtifacts(carbonApplication, axisConfiguration); + } + + @Test(dependsOnMethods = {"testDeployCarbonAppsPluginType"}, description = "undeploying previously deployed capp") + public void testUndeployCarbonAppsPluginType() throws DeploymentException { + deviceTypeCAppDeployer.undeployArtifacts(carbonApplication, axisConfiguration); + } + + @Test(dependsOnMethods = {"testUndeployCarbonAppsPluginType"}, description = "deploying a capp of UI type") + public void testDeployCarbonAppsUiType() throws DeploymentException, IllegalAccessException { + initializeActifact(DeviceTypePluginConstants.CDMF_UI_TYPE); + deviceTypeCAppDeployer.deployArtifacts(carbonApplication, axisConfiguration); + } + + @Test(dependsOnMethods = {"testDeployCarbonAppsUiType"}, description = "Undeploy previously deployed capp") + public void testUndeployCarbonAppsUiType() throws DeploymentException { + deviceTypeCAppDeployer.undeployArtifacts(carbonApplication, axisConfiguration); + } +} diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java index 7f158ff5692..5b2f298baa5 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java @@ -28,6 +28,7 @@ import org.testng.annotations.Test; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.extensions.device.type.template.DeviceTypeConfigIdentifier; import org.wso2.carbon.registry.core.exceptions.RegistryException; + import java.io.File; import java.io.IOException; import java.lang.reflect.Field; @@ -40,9 +41,12 @@ import java.util.concurrent.ConcurrentHashMap; public class DeviceTypePluginDeployerTest { private DeviceTypePluginDeployer deviceTypePluginDeployer; private DeploymentFileData deploymentFileData; + private DeploymentFileData invalidDeploymentFileData; private Field deviceTypeServiceRegistrations = null; private Field deviceTypeConfigurationDataMap = null; private ServiceRegistration serviceRegistration = null; + private File file = new File("src/test/resources/android.xml"); + private File invalidFile = new File("src/test/resources/invalidAndroid.xml"); @BeforeClass public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException { @@ -59,10 +63,15 @@ public class DeviceTypePluginDeployerTest { deviceTypeConfigurationDataMap.setAccessible(true); deviceTypeConfigurationDataMap.set(deviceTypePluginDeployer, new ConcurrentHashMap()); this.initializeCarbonContext(); + if (file.exists()) { + deploymentFileData = new DeploymentFileData(file); + } + if (invalidFile.exists()) { + invalidDeploymentFileData = new DeploymentFileData(invalidFile); + } } private void initializeCarbonContext() throws IOException, RegistryException { - if (System.getProperty("carbon.home") == null) { File file = new File("src/test/resources"); if (file.exists()) { @@ -78,10 +87,6 @@ public class DeviceTypePluginDeployerTest { @SuppressWarnings("unchecked") @Test(description = "Testing deviceType deploy method by deploying Android device type") public void deploy() throws DeploymentException, IllegalAccessException { - File file = new File("src/test/resources/android.xml"); - if (file.exists()) { - deploymentFileData = new DeploymentFileData(file); - } deviceTypePluginDeployer.deploy(deploymentFileData); Map tempServiceRegistration = (Map) deviceTypeServiceRegistrations.get(deviceTypePluginDeployer); @@ -92,4 +97,29 @@ public class DeviceTypePluginDeployerTest { .getAbsolutePath()); Assert.assertEquals(deviceTypeConfigIdentifier.getDeviceType(), "android"); } + + @Test(description = "Testing exception for invalid xml files", expectedExceptions = {org.apache.axis2.deployment + .DeploymentException.class}) + public void deployInvalidXml() throws DeploymentException, IllegalAccessException { + deviceTypePluginDeployer.deploy(invalidDeploymentFileData); + } + + @Test(description = "Testing exception for non existing xml file", expectedExceptions = {org.apache.axis2.deployment + .DeploymentException.class}) + public void unDeployInvalidXml() throws DeploymentException, IllegalAccessException { + deviceTypePluginDeployer.deploy(new DeploymentFileData(new File("src/test/resources/notExist.xml"))); + } + + @SuppressWarnings("unchecked") + @Test(dependsOnMethods = {"deploy"} , description = "Testing deviceType undeploy method by un-deploying Android " + + "device type") + public void unDeploy() throws DeploymentException, IllegalAccessException { + deviceTypePluginDeployer.undeploy(deploymentFileData.getAbsolutePath()); + Map tempServiceRegistration = (Map) + deviceTypeServiceRegistrations.get(deviceTypePluginDeployer); + Assert.assertNull(tempServiceRegistration.get(deploymentFileData.getAbsolutePath())); + Map tempDeviceTypeConfig = (Map) + deviceTypeConfigurationDataMap.get(deviceTypePluginDeployer); + Assert.assertNull(tempDeviceTypeConfig.get(deploymentFileData.getAbsolutePath())); + } } diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/invalidAndroid.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/invalidAndroid.xml new file mode 100644 index 00000000000..45ddc258b51 --- /dev/null +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/invalidAndroid.xml @@ -0,0 +1,382 @@ + + + + + + + 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 + +
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/testng.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/testng.xml index d0ea4e8805f..5d4a11b9b9e 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/testng.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/testng.xml @@ -23,6 +23,7 @@ + From f0496bc4098afba2f83a4922efb117d72f28699b Mon Sep 17 00:00:00 2001 From: GDLMadushanka Date: Fri, 13 Oct 2017 10:02:37 +0530 Subject: [PATCH 2/2] refactoring --- .../device/type/deployer/DeviceTypeCAppDeployerTest.java | 1 - .../device/type/deployer/DeviceTypePluginDeployerTest.java | 1 - 2 files changed, 2 deletions(-) diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java index 0f1788f03c2..0aa0e28839b 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java @@ -30,7 +30,6 @@ import org.wso2.carbon.application.deployer.config.CappFile; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants; import org.wso2.carbon.registry.core.exceptions.RegistryException; - import java.io.File; import java.io.IOException; import java.lang.reflect.Field; diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java index 5b2f298baa5..597575ea319 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java @@ -28,7 +28,6 @@ import org.testng.annotations.Test; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.extensions.device.type.template.DeviceTypeConfigIdentifier; import org.wso2.carbon.registry.core.exceptions.RegistryException; - import java.io.File; import java.io.IOException; import java.lang.reflect.Field;