required changes for PR

revert-70aa11f8
GDLMadushanka 7 years ago
parent 7f4158ca60
commit ca1c9b18cd

@ -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();
}

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ 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

@ -26,4 +26,4 @@
<class name="org.wso2.carbon.device.mgt.extensions.device.type.deployer.DeviceTypePluginDeployerTest"/>
</classes>
</test>
</suite>
</suite>
Loading…
Cancel
Save