Add test cases for Android Device Management Admin Service.

revert-dabc3590
charitha 7 years ago
parent e37e722ac6
commit 9532c69874

@ -49,6 +49,44 @@
<warName>api#device-mgt#android#v1.0</warName> <warName>api#device-mgt#android#v1.0</warName>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
<outputDirectory>${basedir}/target/coverage-reports/site</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<log4j.configuration>file:src/test/resources/log4j.properties</log4j.configuration>
</systemPropertyVariables>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
@ -262,5 +300,55 @@
<groupId>javax.ws.rs</groupId> <groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId> <artifactId>javax.ws.rs-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.queuing</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.ndatasource.core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp.wso2</groupId>
<artifactId>commons-dbcp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-pool.wso2</groupId>
<artifactId>commons-pool</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>javax.cache.wso2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -0,0 +1,312 @@
/*
* 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.mdm.services.android;
import org.mockito.Matchers;
import org.mockito.MockitoAnnotations;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockObjectFactory;
import org.testng.Assert;
import org.testng.IObjectFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.ObjectFactory;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.mdm.services.android.services.impl.DeviceManagementAdminServiceImpl;
import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils;
import org.wso2.carbon.mdm.services.android.utils.TestUtils;
import javax.ws.rs.core.Response;
@PowerMockIgnore({"javax.ws.rs.*"})
@PrepareForTest(AndroidAPIUtils.class)
public class DeviceManagementAdminServiceTests {
private DeviceManagementAdminServiceImpl deviceManagementAdminService;
@ObjectFactory
public IObjectFactory getObjectFactory() {
return new PowerMockObjectFactory();
}
@BeforeClass
public void init() throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
MockitoAnnotations.initMocks(this);
deviceManagementAdminService = new DeviceManagementAdminServiceImpl();
}
private void mockAndroidAPIUtils()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
Activity activity = TestUtils.getActivity();
PowerMockito.mockStatic(AndroidAPIUtils.class);
try {
PowerMockito.when(AndroidAPIUtils.class, "getOperationResponse", Matchers.anyList(), Matchers.any(Operation.class))
.thenReturn(activity);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testConfigureDeviceLock()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.configureDeviceLock(TestUtils.getDeviceLockBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testConfigureDeviceUnlock()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.configureDeviceUnlock(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetDeviceLocation()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.getDeviceLocation(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testRemovePassword()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.removePassword(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testConfigureCamera()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.configureCamera(TestUtils.getCamerabeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetDeviceInformation()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.getDeviceInformation(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetDeviceLogcat()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.getDeviceLogcat(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testWipeDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.wipeDevice(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testWipeData()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.wipeData(TestUtils.getWipeDataBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testGetApplications()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.getApplications(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testRingDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.ringDevice(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testRebootDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.rebootDevice(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testMuteDevice()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.muteDevice(TestUtils.getDeviceIds());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testInstallApplication()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService
.installApplication(TestUtils.getApplicationInstallationBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testUpdateApplication()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.updateApplication(TestUtils.getApplicationUpdateBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testUninstallApplicationPublic()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService
.uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperPublic());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testUninstallApplicationWebApp()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService
.uninstallApplication(TestUtils.getApplicationUninstallationBeanWrapperWebApp());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testBlacklistApplications()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService
.blacklistApplications(TestUtils.getBlacklistApplicationsBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testUpgradeFirmware()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.upgradeFirmware(TestUtils.getUpgradeFirmwareBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testConfigureVPN()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.configureVPN(TestUtils.getVpnBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testSendNotification()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.sendNotification(TestUtils.getNotificationBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testConfigureWifi()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.configureWifi(TestUtils.getWifiBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testEncryptStorage()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.encryptStorage(TestUtils.getEncryptionBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testChangeLockCode()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.changeLockCode(TestUtils.getLockCodeBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testSetPasswordPolicy()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.setPasswordPolicy(TestUtils.getPasswordPolicyBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
@Test
public void testSetWebClip()
throws DeviceManagementException, OperationManagementException, InvalidDeviceException {
mockAndroidAPIUtils();
Response response = deviceManagementAdminService.setWebClip(TestUtils.getWebClipBeanWrapper());
Assert.assertNotNull(response);
Assert.assertEquals(response.getStatus(), Response.Status.CREATED.getStatusCode());
}
}

@ -0,0 +1,224 @@
/*
* 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.mdm.services.android.utils;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.mdm.services.android.bean.ApplicationInstallation;
import org.wso2.carbon.mdm.services.android.bean.ApplicationUninstallation;
import org.wso2.carbon.mdm.services.android.bean.ApplicationUpdate;
import org.wso2.carbon.mdm.services.android.bean.BlacklistApplications;
import org.wso2.carbon.mdm.services.android.bean.Camera;
import org.wso2.carbon.mdm.services.android.bean.DeviceEncryption;
import org.wso2.carbon.mdm.services.android.bean.DeviceLock;
import org.wso2.carbon.mdm.services.android.bean.LockCode;
import org.wso2.carbon.mdm.services.android.bean.Notification;
import org.wso2.carbon.mdm.services.android.bean.PasscodePolicy;
import org.wso2.carbon.mdm.services.android.bean.UpgradeFirmware;
import org.wso2.carbon.mdm.services.android.bean.Vpn;
import org.wso2.carbon.mdm.services.android.bean.WebClip;
import org.wso2.carbon.mdm.services.android.bean.Wifi;
import org.wso2.carbon.mdm.services.android.bean.WipeData;
import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationInstallationBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUninstallationBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUpdateBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.BlacklistApplicationsBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.CameraBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.DeviceLockBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EncryptionBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.LockCodeBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.NotificationBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.PasswordPolicyBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.UpgradeFirmwareBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.VpnBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.WebClipBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.WifiBeanWrapper;
import org.wso2.carbon.mdm.services.android.bean.wrapper.WipeDataBeanWrapper;
import java.util.ArrayList;
import java.util.List;
public class TestUtils {
public static Activity getActivity() {
Activity activity = new Activity();
activity.setActivityId("ACTIVITY_1");
activity.setCode("CODE");
return activity;
}
public static List<String> getDeviceIds() {
List<String> deviceIds = new ArrayList<>();
deviceIds.add("1a2b3c4d5e");
return deviceIds;
}
public static DeviceLockBeanWrapper getDeviceLockBeanWrapper() {
DeviceLockBeanWrapper deviceLockBeanWrapper = new DeviceLockBeanWrapper();
deviceLockBeanWrapper.setDeviceIDs(getDeviceIds());
DeviceLock deviceLockOperation = new DeviceLock();
deviceLockOperation.setHardLockEnabled(true);
deviceLockOperation.setMessage("Test Operation");
deviceLockBeanWrapper.setOperation(deviceLockOperation);
return deviceLockBeanWrapper;
}
public static CameraBeanWrapper getCamerabeanWrapper() {
CameraBeanWrapper cameraBeanWrapper = new CameraBeanWrapper();
cameraBeanWrapper.setDeviceIDs(getDeviceIds());
Camera camera = new Camera();
camera.setEnabled(false);
cameraBeanWrapper.setOperation(camera);
return cameraBeanWrapper;
}
public static WipeDataBeanWrapper getWipeDataBeanWrapper() {
WipeDataBeanWrapper wipeDataBeanWrapper = new WipeDataBeanWrapper();
wipeDataBeanWrapper.setDeviceIDs(getDeviceIds());
WipeData wipeData = new WipeData();
wipeData.setPin("1234");
wipeDataBeanWrapper.setOperation(wipeData);
return wipeDataBeanWrapper;
}
public static ApplicationInstallationBeanWrapper getApplicationInstallationBeanWrapper() {
ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper = new ApplicationInstallationBeanWrapper();
applicationInstallationBeanWrapper.setDeviceIDs(getDeviceIds());
ApplicationInstallation applicationInstallation = new ApplicationInstallation();
applicationInstallation.setAppIdentifier("org.wso2.iot.agent");
applicationInstallation.setUrl("https://github.com/wso2/cdmf-agent-android/releases/download/v3.1.21/client-standalone.apk");
applicationInstallation.setType("enterprise");
applicationInstallation.setSchedule("2017-10-11T18:46:19-0530");
applicationInstallationBeanWrapper.setOperation(applicationInstallation);
return applicationInstallationBeanWrapper;
}
public static ApplicationUpdateBeanWrapper getApplicationUpdateBeanWrapper() {
ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper = new ApplicationUpdateBeanWrapper();
applicationUpdateBeanWrapper.setDeviceIDs(getDeviceIds());
ApplicationUpdate applicationUpdate = new ApplicationUpdate();
applicationUpdate.setAppIdentifier("org.wso2.iot.agent");
applicationUpdate.setUrl("https://github.com/wso2/cdmf-agent-android/releases/download/v3.1.21/client-standalone.apk");
applicationUpdate.setType("enterprise");
applicationUpdate.setSchedule("2017-10-11T18:46:19-0530");
applicationUpdateBeanWrapper.setOperation(applicationUpdate);
return applicationUpdateBeanWrapper;
}
public static ApplicationUninstallationBeanWrapper getApplicationUninstallationBeanWrapperPublic() {
ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper = new ApplicationUninstallationBeanWrapper();
applicationUninstallationBeanWrapper.setDeviceIDs(getDeviceIds());
ApplicationUninstallation applicationUninstallation = new ApplicationUninstallation();
applicationUninstallation.setAppIdentifier("org.wso2.iot.agent");
applicationUninstallation.setType("public");
applicationUninstallationBeanWrapper.setOperation(applicationUninstallation);
return applicationUninstallationBeanWrapper;
}
public static ApplicationUninstallationBeanWrapper getApplicationUninstallationBeanWrapperWebApp() {
ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper = new ApplicationUninstallationBeanWrapper();
applicationUninstallationBeanWrapper.setDeviceIDs(getDeviceIds());
ApplicationUninstallation applicationUninstallation = new ApplicationUninstallation();
applicationUninstallation.setAppIdentifier("org.wso2.iot.agent");
applicationUninstallation.setType("webapp");
applicationUninstallationBeanWrapper.setOperation(applicationUninstallation);
return applicationUninstallationBeanWrapper;
}
public static BlacklistApplicationsBeanWrapper getBlacklistApplicationsBeanWrapper() {
BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper = new BlacklistApplicationsBeanWrapper();
blacklistApplicationsBeanWrapper.setDeviceIDs(getDeviceIds());
BlacklistApplications blacklistApplications = new BlacklistApplications();
List<String> appIds = new ArrayList<>();
appIds.add("org.wso2.iot.agent");
blacklistApplications.setAppIdentifier(appIds);
blacklistApplicationsBeanWrapper.setOperation(blacklistApplications);
return blacklistApplicationsBeanWrapper;
}
public static UpgradeFirmwareBeanWrapper getUpgradeFirmwareBeanWrapper() {
UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper = new UpgradeFirmwareBeanWrapper();
upgradeFirmwareBeanWrapper.setDeviceIDs(getDeviceIds());
UpgradeFirmware upgradeFirmware = new UpgradeFirmware();
upgradeFirmware.setServer("https://github.com/wso2/cdmf-agent-android/releases/download/");
upgradeFirmware.setSchedule("2017-10-11T18:46:19-0530");
upgradeFirmwareBeanWrapper.setOperation(upgradeFirmware);
return upgradeFirmwareBeanWrapper;
}
public static VpnBeanWrapper getVpnBeanWrapper() {
VpnBeanWrapper vpnBeanWrapper = new VpnBeanWrapper();
vpnBeanWrapper.setDeviceIDs(getDeviceIds());
Vpn vpn = new Vpn();
vpnBeanWrapper.setOperation(vpn);
return vpnBeanWrapper;
}
public static NotificationBeanWrapper getNotificationBeanWrapper() {
NotificationBeanWrapper notificationBeanWrapper = new NotificationBeanWrapper();
notificationBeanWrapper.setDeviceIDs(getDeviceIds());
Notification notification = new Notification();
notification.setMessageText("Message");
notification.setMessageTitle("Title");
notificationBeanWrapper.setOperation(notification);
return notificationBeanWrapper;
}
public static WifiBeanWrapper getWifiBeanWrapper() {
WifiBeanWrapper wifiBeanWrapper = new WifiBeanWrapper();
wifiBeanWrapper.setDeviceIDs(getDeviceIds());
Wifi wifi = new Wifi();
wifiBeanWrapper.setOperation(wifi);
return wifiBeanWrapper;
}
public static EncryptionBeanWrapper getEncryptionBeanWrapper() {
EncryptionBeanWrapper encryptionBeanWrapper = new EncryptionBeanWrapper();
encryptionBeanWrapper.setDeviceIDs(getDeviceIds());
DeviceEncryption deviceEncryption = new DeviceEncryption();
deviceEncryption.setEncrypted(true);
encryptionBeanWrapper.setOperation(deviceEncryption);
return encryptionBeanWrapper;
}
public static LockCodeBeanWrapper getLockCodeBeanWrapper() {
LockCodeBeanWrapper lockCodeBeanWrapper = new LockCodeBeanWrapper();
lockCodeBeanWrapper.setDeviceIDs(getDeviceIds());
LockCode lockCode = new LockCode();
lockCode.setLockCode("1234");
lockCodeBeanWrapper.setOperation(lockCode);
return lockCodeBeanWrapper;
}
public static PasswordPolicyBeanWrapper getPasswordPolicyBeanWrapper() {
PasswordPolicyBeanWrapper passwordPolicyBeanWrapper = new PasswordPolicyBeanWrapper();
passwordPolicyBeanWrapper.setDeviceIDs(getDeviceIds());
PasscodePolicy passcodePolicy = new PasscodePolicy();
passwordPolicyBeanWrapper.setOperation(passcodePolicy);
return passwordPolicyBeanWrapper;
}
public static WebClipBeanWrapper getWebClipBeanWrapper() {
WebClipBeanWrapper webClipBeanWrapper = new WebClipBeanWrapper();
webClipBeanWrapper.setDeviceIDs(getDeviceIds());
WebClip webClip = new WebClip();
webClipBeanWrapper.setOperation(webClip);
return webClipBeanWrapper;
}
}

@ -0,0 +1,34 @@
#
# 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.
#
#
# 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

@ -0,0 +1,29 @@
<!--
~ 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.
-->
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="AndroidDeviceManagementAPIs">
<test name="API Tests" preserve-order="true">
<classes>
<class name="org.wso2.carbon.mdm.services.android.DeviceManagementAdminServiceTests" />
</classes>
</test>
</suite>

@ -147,6 +147,9 @@
<fileset dir="${siddhi.extensions}/${target}/${coverge-report}"> <fileset dir="${siddhi.extensions}/${target}/${coverge-report}">
<include name="${individual.test.report.name}" /> <include name="${individual.test.report.name}" />
</fileset> </fileset>
<fileset dir="${android.api}/${target}/${coverge-report}">
<include name="${individual.test.report.name}" />
</fileset>
<!-- Need to list the newly added exec files here --> <!-- Need to list the newly added exec files here -->
</executiondata> </executiondata>

@ -69,6 +69,12 @@
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId> <artifactId>swagger-jaxrs</artifactId>
<version>${swagger.version}</version> <version>${swagger.version}</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
@ -251,6 +257,12 @@
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.mgt.core</artifactId>
<version>${carbon.devicemgt.version}</version> <version>${carbon.devicemgt.version}</version>
<exclusions>
<exclusion>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
@ -271,6 +283,12 @@
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId> <artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>${carbon.devicemgt.version}</version> <version>${carbon.devicemgt.version}</version>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
@ -293,6 +311,12 @@
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher</artifactId> <artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher</artifactId>
<version>${carbon.devicemgt.version}</version> <version>${carbon.devicemgt.version}</version>
<exclusions>
<exclusion>
<groupId>jboss</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
@ -1114,6 +1138,36 @@
<version>${junit.version}</version> <version>${junit.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.queuing</artifactId>
<version>${carbon.kernel.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp.wso2</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons.dbcp.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -1293,6 +1347,9 @@
<jacoco.maven.plugin.version>0.7.8</jacoco.maven.plugin.version> <jacoco.maven.plugin.version>0.7.8</jacoco.maven.plugin.version>
<jacoco.ant.verision>0.7.5.201505241946</jacoco.ant.verision> <jacoco.ant.verision>0.7.5.201505241946</jacoco.ant.verision>
<ant.contrib.version>1.0b3</ant.contrib.version> <ant.contrib.version>1.0b3</ant.contrib.version>
<commons.dbcp.version>1.4.0.wso2v1</commons.dbcp.version>
<javassist.version>3.12.1.GA</javassist.version>
<powermock.version>1.7.0</powermock.version>
</properties> </properties>
<scm> <scm>

Loading…
Cancel
Save