diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java index f7914d3d52..bc02e33e5a 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -62,7 +62,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { for (APIInfo apiInfo : apiList.getList()) { if (api.getName().equals(apiInfo.getName()) && api.getVersion().equals(apiInfo.getVersion())) { api = publisherClient.getApi().apisApiIdPut(apiInfo.getId(), api, CONTENT_TYPE, null, null); - if (CREATED_STATUS.equals(api.getStatus())) { + if (api != null && CREATED_STATUS.equals(api.getStatus())) { publisherClient.getApi().apisChangeLifecyclePost(PUBLISH_ACTION, api.getId(), null, null, null); } @@ -83,7 +83,9 @@ public class APIPublisherServiceImpl implements APIPublisherService { return false; } for (APIInfo existingApi : apiList.getList()) { - if (existingApi.getName().equals(api.getName()) && existingApi.getVersion().equals(api.getVersion())) { + if (existingApi.getName() != null && existingApi.getName().equals(api. + getName()) && existingApi.getVersion() != null && + existingApi.getVersion().equals(api.getVersion())) { return true; } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceTest.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceTest.java index cf313fca21..5360caa68b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceTest.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceTest.java @@ -19,17 +19,30 @@ package org.wso2.carbon.apimgt.webapp.publisher; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; +import org.wso2.carbon.apimgt.integration.client.IntegrationClientServiceImpl; import org.wso2.carbon.apimgt.integration.client.OAuthRequestInterceptor; import org.wso2.carbon.apimgt.integration.client.model.OAuthApplication; +import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIsApi; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.API; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIInfo; +import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIList; +import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig; import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiScope; import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiUriTemplate; import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException; +import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder; +import org.wso2.carbon.apimgt.webapp.publisher.utils.Api; import java.lang.reflect.Field; import java.util.*; +import static org.mockito.Mockito.doReturn; + /** * This is the test class for {@link APIPublisherServiceImpl} */ @@ -37,23 +50,107 @@ public class APIPublisherServiceTest extends BaseAPIPublisherTest { private static final Log log = LogFactory.getLog(APIPublisherServiceTest.class); private APIPublisherServiceImpl apiPublisherService = new APIPublisherServiceImpl(); - private APIConfig apiConfig = new APIConfig(); @BeforeTest public void initialConfigs() throws Exception { - setApiConfigs(apiConfig); initializeOAuthApplication(); + WebappPublisherConfig.init(); } @Test(description = "Publishes an API | will fail if there are any exceptions") public void publishAPI() throws NoSuchFieldException, IllegalAccessException, APIManagerPublisherException { + APIConfig apiConfig = new APIConfig(); + setApiConfigs(apiConfig, "testAPI-0"); + apiPublisherService.publishAPI(apiConfig); + } + + @Test(description = "Testing for API status CREATED | will fail if there are any exceptions") + public void publishCreatedAPI() throws APIManagerPublisherException, NoSuchFieldException, + IllegalAccessException { + APIConfig apiConfig = new APIConfig(); + setApiConfigs(apiConfig, "testAPI-1"); + APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance(). + getClass(), Mockito.CALLS_REAL_METHODS); + IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl. + class, Mockito.CALLS_REAL_METHODS); + doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService(); + PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService(). + getPublisherClient(); + doReturn(publisherClient).when(integrationClientService).getPublisherClient(); + APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS); + doReturn(apIsApi).when(publisherClient).getApi(); + API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS); + api.setStatus("CREATED"); + doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString()); apiPublisherService.publishAPI(apiConfig); } - private void setApiConfigs(APIConfig apiConfig) { - apiConfig.setName("Windows Device Management Administrative Service"); - apiConfig.setContext("/api/device-mgt/windows/v1.0/admin/devices"); + @Test(description = "createAPIListWithNoApi | will fail if there are any exceptions") + private void publishWithNoAPIListCreated() throws APIManagerPublisherException { + APIConfig apiConfig = new APIConfig(); + setApiConfigs(apiConfig, "testAPI-3"); + APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance(). + getClass(), Mockito.CALLS_REAL_METHODS); + IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl. + class, Mockito.CALLS_REAL_METHODS); + doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService(); + PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService(). + getPublisherClient(); + doReturn(publisherClient).when(integrationClientService).getPublisherClient(); + APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS); + doReturn(apIsApi).when(publisherClient).getApi(); + API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS); + api.setStatus("CREATED"); + doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString()); + APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS); + APIInfo apiInfo = new APIInfo(); + List apiInfoList = new ArrayList<>(); + apiInfoList.add(apiInfo); + apiList.list(apiInfoList); + doReturn(apiList).when(apIsApi).apisGet(Mockito.anyInt(), Mockito.anyInt(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); + doReturn(api).when(apIsApi).apisApiIdPut(Mockito.anyString(), Mockito.any(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); + apiPublisherService.publishAPI(apiConfig); + } + + @Test(description = "createAPIList | will fail if there are any exceptions") + private void publishWithAPIListCreated() throws APIManagerPublisherException { + APIConfig apiConfig = new APIConfig(); + setApiConfigs(apiConfig, "testAPI-2"); + APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance(). + getClass(), Mockito.CALLS_REAL_METHODS); + IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl. + class, Mockito.CALLS_REAL_METHODS); + doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService(); + PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService(). + getPublisherClient(); + doReturn(publisherClient).when(integrationClientService).getPublisherClient(); + APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS); + doReturn(apIsApi).when(publisherClient).getApi(); + API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS); + api.setStatus("CREATED"); + doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString()); + APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS); + APIInfo apiInfo = new APIInfo(); + apiInfo.setName("testAPI-2"); + apiInfo.setVersion("1.0.0"); + apiInfo.setId("test-one"); + List apiInfoList = new ArrayList<>(); + apiInfoList.add(apiInfo); + apiList.list(apiInfoList); + doReturn(apiList).when(apIsApi).apisGet(Mockito.anyInt(), Mockito.anyInt(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); + doReturn(api).when(apIsApi).apisApiIdPut(Mockito.anyString(), Mockito.any(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); + apiConfig.setSharedWithAllTenants(false); + apiPublisherService.publishAPI(apiConfig); + } + + private void setApiConfigs(APIConfig apiConfig, String name) { + apiConfig.setName(name); + apiConfig.setContext("api/device-mgt/windows/v1.g0/admin/devices"); apiConfig.setOwner("admin"); apiConfig.setEndpoint("https://localhost:9443/api/device-mgt/windows/v1.0/admin/devices"); apiConfig.setVersion("1.0.0"); @@ -98,3 +195,4 @@ APIPublisherServiceTest extends BaseAPIPublisherTest { } } + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/etc/webapp-publisher-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/etc/webapp-publisher-config.xml new file mode 100644 index 0000000000..6e03eb73bd --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/test/resources/carbon-home/repository/conf/etc/webapp-publisher-config.xml @@ -0,0 +1,39 @@ + + + + + + + + https://${iot.core.host}:${iot.core.https.port} + + + true + + + true + + + + default + + diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index cd4cb7795d..ed2d1a4733 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -74,6 +74,39 @@ org.wso2.carbon org.wso2.carbon.ndatasource.core + + org.testng + testng + + + org.powermock + powermock-module-testng + test + + + org.wso2.carbon.registry + org.wso2.carbon.registry.indexing + test + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + slf4j-api + + + org.slf4j + log4j-over-slf4j + + + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + test + 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/DeviceTypePluginDeployer.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/DeviceTypePluginDeployer.java index eb02504d97..82d039f53e 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/DeviceTypePluginDeployer.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/DeviceTypePluginDeployer.java @@ -51,8 +51,8 @@ public class DeviceTypePluginDeployer extends AbstractDeployer { private static Log log = LogFactory.getLog(DeviceTypePluginDeployer.class); private ConfigurationContext configurationContext; - protected Map deviceTypeServiceRegistrations = new ConcurrentHashMap(); - protected Map deviceTypeConfigurationDataMap = new ConcurrentHashMap(); + private Map deviceTypeServiceRegistrations = new ConcurrentHashMap(); + private Map deviceTypeConfigurationDataMap = new ConcurrentHashMap(); @Override public void init(ConfigurationContext configurationContext) { @@ -118,7 +118,7 @@ public class DeviceTypePluginDeployer extends AbstractDeployer { } } - private ServiceRegistration registerDeviceType(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier, + protected ServiceRegistration registerDeviceType(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier, DeviceTypeConfiguration deviceManagementConfiguration) { DeviceTypeManagerService deviceTypeManagerService = new DeviceTypeManagerService(deviceTypeConfigIdentifier, deviceManagementConfiguration); 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 new file mode 100644 index 0000000000..7f158ff569 --- /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/DeviceTypePluginDeployerTest.java @@ -0,0 +1,95 @@ +/* + * 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.deployment.repository.util.DeploymentFileData; +import org.junit.Assert; +import org.mockito.Mockito; +import org.osgi.framework.ServiceRegistration; +import org.testng.annotations.BeforeClass; +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; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/* + Unit tests for DeviceTypePluginDeployer + */ +public class DeviceTypePluginDeployerTest { + private DeviceTypePluginDeployer deviceTypePluginDeployer; + private DeploymentFileData deploymentFileData; + private Field deviceTypeServiceRegistrations = null; + private Field deviceTypeConfigurationDataMap = null; + private ServiceRegistration serviceRegistration = null; + + @BeforeClass + public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException { + deviceTypePluginDeployer = Mockito.mock(DeviceTypePluginDeployer.class, Mockito.CALLS_REAL_METHODS); + serviceRegistration = Mockito.mock(ServiceRegistration.class, Mockito.CALLS_REAL_METHODS); + Mockito.doReturn(serviceRegistration).when(deviceTypePluginDeployer).registerDeviceType(Mockito.any(), + Mockito.any()); + deviceTypeServiceRegistrations = DeviceTypePluginDeployer.class.getDeclaredField + ("deviceTypeServiceRegistrations"); + deviceTypeServiceRegistrations.setAccessible(true); + deviceTypeServiceRegistrations.set(deviceTypePluginDeployer, new ConcurrentHashMap()); + deviceTypeConfigurationDataMap = DeviceTypePluginDeployer.class.getDeclaredField + ("deviceTypeConfigurationDataMap"); + deviceTypeConfigurationDataMap.setAccessible(true); + deviceTypeConfigurationDataMap.set(deviceTypePluginDeployer, new ConcurrentHashMap()); + this.initializeCarbonContext(); + } + + 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); + } + + @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); + Assert.assertEquals(tempServiceRegistration.get(deploymentFileData.getAbsolutePath()), serviceRegistration); + Map tempDeviceTypeConfig = (Map) + deviceTypeConfigurationDataMap.get(deviceTypePluginDeployer); + DeviceTypeConfigIdentifier deviceTypeConfigIdentifier = tempDeviceTypeConfig.get(deploymentFileData + .getAbsolutePath()); + Assert.assertEquals(deviceTypeConfigIdentifier.getDeviceType(), "android"); + } +} diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/android.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/android.xml new file mode 100644 index 0000000000..21db962414 --- /dev/null +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/android.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/log4j.properties b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/log4j.properties new file mode 100644 index 0000000000..e415fd607d --- /dev/null +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/log4j.properties @@ -0,0 +1,34 @@ +# +# Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +# +# WSO2 Inc. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# This is the log4j configuration file used by WSO2 Carbon +# +# IMPORTANT : Please do not remove or change the names of any +# of the Appender defined here. The layout pattern & log file +# can be changed using the WSO2 Carbon Management Console, and those +# settings will override the settings in this file. +# + +log4j.rootLogger=DEBUG, STD_OUT + +# Redirect log messages to console +log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender +log4j.appender.STD_OUT.Target=System.out +log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout +log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/repository/conf/carbon.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/repository/conf/carbon.xml new file mode 100644 index 0000000000..f24ee57be2 --- /dev/null +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/repository/conf/carbon.xml @@ -0,0 +1,656 @@ + + + + + + + + + ${product.name} + + + ${product.key} + + + ${product.version} + + + + + + + + + local:/${carbon.context}/services/ + + + + + + + ${default.server.role} + + + + + + + org.wso2.carbon + + + / + + + + + + + + + 15 + + + + + + + + + 0 + + + + + 9999 + + 11111 + + + + + + 10389 + + 8000 + + + + + + 10500 + + + + + + + org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory + + + + + + + + + java + + + + + + + + + + false + + + false + + + 600 + + + + false + + + + + + + + 30 + + + + + + + + + 15 + + + + + + ${carbon.home}/repository/deployment/server/ + + + 15 + + + ${carbon.home}/repository/conf/axis2/axis2.xml + + + 30000 + + + ${carbon.home}/repository/deployment/client/ + + ${carbon.home}/repository/conf/axis2/axis2_client.xml + + true + + + + + + + + + + admin + Default Administrator Role + + + user + Default User Role + + + + + + + + + + + + ${carbon.home}/repository/resources/security/wso2carbon.jks + + JKS + + wso2carbon + + wso2carbon + + wso2carbon + + + + + + ${carbon.home}/repository/resources/security/client-truststore.jks + + JKS + + wso2carbon + + + + + + + + + + + + + + + + + + + UserManager + + + false + + + + + + + ${carbon.home}/tmp/work + + + + + + true + + + 10 + + + 30 + + + + + + 100 + + + + keystore + certificate + * + + org.wso2.carbon.ui.transports.fileupload.AnyFileUploadExecutor + + + + + jarZip + + org.wso2.carbon.ui.transports.fileupload.JarZipUploadExecutor + + + + dbs + + org.wso2.carbon.ui.transports.fileupload.DBSFileUploadExecutor + + + + tools + + org.wso2.carbon.ui.transports.fileupload.ToolsFileUploadExecutor + + + + toolsAny + + org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor + + + + + + + info + org.wso2.carbon.core.transports.util.InfoProcessor + + + wsdl + org.wso2.carbon.core.transports.util.Wsdl11Processor + + + wsdl2 + org.wso2.carbon.core.transports.util.Wsdl20Processor + + + xsd + org.wso2.carbon.core.transports.util.XsdProcessor + + + + + + false + false + true + svn + http://svnrepo.example.com/repos/ + username + password + true + + + + + + + + + + + + + + + ${require.carbon.servlet} + + + + + true + + + + + + + default repository + ${p2.repo.url} + + + + + + + + true + + + + + + true + + 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 new file mode 100644 index 0000000000..d0ea4e8805 --- /dev/null +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/testng.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index 3a63e1a087..ac05f968d3 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -192,7 +192,9 @@ - + + +