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 4c407bce109..2cb00848da3 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 @@ -1,3 +1,21 @@ +/* + * 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; @@ -16,32 +34,31 @@ 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 Exception { + 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(); } 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 index 00084f14fc1..80555b5803e 100644 --- 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 @@ -1,7 +1,7 @@