forked from community/device-mgt-plugins
parent
e37e722ac6
commit
9532c69874
@ -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>
|
Loading…
Reference in new issue