mirror of
https://repository.entgra.net/community/product-iots.git
synced 2025-09-16 23:32:19 +00:00
Fixed Android Operations Integration Tests.
This commit is contained in:
parent
594533cfe0
commit
5dbfa7d187
@ -24,7 +24,7 @@ import java.io.File;
|
|||||||
*/
|
*/
|
||||||
public final class Constants {
|
public final class Constants {
|
||||||
|
|
||||||
public static final String DEVICE_ID = "24f870f390352a41234";
|
public static final String DEVICE_ID = "d24f870f390352a41234";
|
||||||
public static final String NUMBER_NOT_EQUAL_TO_DEVICE_ID = "1111";
|
public static final String NUMBER_NOT_EQUAL_TO_DEVICE_ID = "1111";
|
||||||
public static final String DEVICE_IMEI = "123123123";
|
public static final String DEVICE_IMEI = "123123123";
|
||||||
public static final String AUTOMATION_CONTEXT = "IOT";
|
public static final String AUTOMATION_CONTEXT = "IOT";
|
||||||
@ -144,38 +144,104 @@ public final class Constants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final class AndroidOperations {
|
public static final class AndroidOperations {
|
||||||
|
private final String PAYLOAD_COMMON = "["+DEVICE_ID+"]";
|
||||||
|
|
||||||
public static final String OPERATION_PAYLOAD_FILE_NAME = "android-operation-payloads.json";
|
public static final String OPERATION_PAYLOAD_FILE_NAME = "android-operation-payloads.json";
|
||||||
public static final String OPERATIONS_GROUP = "operations";
|
public static final String OPERATIONS_GROUP = "operations";
|
||||||
public static final String COMMAND_OPERATION_PAYLOAD = "[\"" + DEVICE_ID + "\"]";
|
|
||||||
public static final String CAMERA_OPERATION = "camera";
|
public static final String CAMERA_OPERATION = "control-camera";
|
||||||
|
public static final String CAMERA_OPERATION_PAYLOAD = "{\n" + " \"operation\": {\n"
|
||||||
|
+ " \"enabled\": false\n" + " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\" \n"
|
||||||
|
+ " ]\n" + "}";
|
||||||
|
|
||||||
public static final String WIPE_DATA_OPERATION = "wipe_data";
|
public static final String WIPE_DATA_OPERATION = "wipe_data";
|
||||||
|
public static final String WIPE_DATA_OPERATION_PAYLOAD = "wipe_data";
|
||||||
|
|
||||||
public static final String INSTALL_APPS_OPERATION = "install_apps";
|
public static final String INSTALL_APPS_OPERATION = "install_apps";
|
||||||
public static final String NOTIFICATION_OPERATION = "notification";
|
public static final String NOTIFICATION_OPERATION = "notification";
|
||||||
public static final String WIFI_OPERATION = "wifi";
|
public static final String WIFI_OPERATION = "wifi";
|
||||||
public static final String ENCRYPT_OPERATION = "encrypt";
|
public static final String ENCRYPT_OPERATION = "encrypt";
|
||||||
public static final String CHANGE_LOCK_OPERATION = "change_lock";
|
public static final String CHANGE_LOCK_OPERATION = "unlock-devices";
|
||||||
public static final String PASSWORD_POLICY_OPERATION = "password_policy";
|
public static final String PASSWORD_POLICY_OPERATION = "password_policy";
|
||||||
public static final String WEB_CLIP_OPERATION = "web_clip";
|
public static final String WEB_CLIP_OPERATION = "web_clip";
|
||||||
public static final String OPERATION_ENDPOINT = "/mdm-android-agent/operation/";
|
public static final String OPERATION_ENDPOINT = "/api/device-mgt/android/v1.0/admin/devices/";
|
||||||
public static final String LOCK_ENDPOINT = "/mdm-android-agent/operation/lock";
|
public static final String UNLOCK_ENDPOINT = "unlock-devices";
|
||||||
public static final String LOCATION_ENDPOINT = "/mdm-android-agent/operation/location";
|
public static final String UNLOCK_OPERATION_PAYLOAD = PAYLOAD_COMMON;
|
||||||
public static final String CLEAR_PASSWORD_ENDPOINT = "/mdm-android-agent/operation/clear-password";
|
|
||||||
public static final String CAMERA_ENDPOINT = "/mdm-android-agent/operation/camera";
|
public static final String LOCK_ENDPOINT = "lock-devices";
|
||||||
public static final String DEVICE_INFO_ENDPOINT = "/mdm-android-agent/operation/device-info";
|
public static final String LOCK_OPERATION_PAYLOAD = "{ \"deviceIDs\": [\""+DEVICE_ID+"\"],"
|
||||||
public static final String ENTERPRISE_WIPE_ENDPOINT = "/mdm-android-agent/operation/enterprise-wipe";
|
+ "\"operation\": { \"message\": \"string\", \"hardLockEnabled\": false }}";
|
||||||
public static final String WIPE_DATA_ENDPOINT = "/mdm-android-agent/operation/wipe-data";
|
|
||||||
public static final String APPLICATION_LIST_ENDPOINT = "/mdm-android-agent/operation/application-list";
|
public static final String LOCATION_ENDPOINT = "location";
|
||||||
public static final String RING_ENDPOINT = "/mdm-android-agent/operation/ring-device";
|
public static final String LOCATION_PAYLOAD = PAYLOAD_COMMON;
|
||||||
public static final String MUTE_ENDPOINT = "/mdm-android-agent/operation/mute";
|
|
||||||
public static final String INSTALL_APPS_ENDPOINT = "/mdm-android-agent/operation/install-application";
|
public static final String CLEAR_PASSWORD_ENDPOINT = "clear-password";
|
||||||
public static final String UNINSTALL_APPS_ENDPOINT = "/mdm-android-agent/operation/uninstall-application";
|
public static final String CLEAR_PASSWORD_PAYLOAD = PAYLOAD_COMMON;
|
||||||
public static final String BLACKLIST_APPS_ENDPOINT = "/mdm-android-agent/operation/blacklist-applications";
|
|
||||||
public static final String NOTIFICATION_ENDPOINT = "/mdm-android-agent/operation/notification";
|
public static final String DEVICE_INFO_ENDPOINT = "/info";
|
||||||
public static final String WIFI_ENDPOINT = "/mdm-android-agent/operation/wifi";
|
public static final String DEVICE_INFO_PAYLOAD = "[\""+DEVICE_ID+"\"]";
|
||||||
public static final String ENCRYPT_ENDPOINT = "/mdm-android-agent/operation/encrypt";
|
|
||||||
public static final String CHANGE_LOCK_ENDPOINT = "/mdm-android-agent/operation/change-lock-code";
|
public static final String ENTERPRISE_WIPE_ENDPOINT = "enterprise-wipe";
|
||||||
public static final String PASSWORD_POLICY_ENDPOINT = "/mdm-android-agent/operation/password-policy";
|
public static final String ENTERPRISE_WIPE_PAYLOAD = PAYLOAD_COMMON;
|
||||||
public static final String WEB_CLIP_ENDPOINT = "/mdm-android-agent/operation/webclip";
|
|
||||||
|
public static final String WIPE_DATA_ENDPOINT = "wipe";
|
||||||
|
public static final String WIPE_DATA_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"pin\": \"string\"\n"
|
||||||
|
+ " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}";
|
||||||
|
|
||||||
|
public static final String APPLICATION_LIST_ENDPOINT = "applications";
|
||||||
|
public static final String APPLICATION_LIST_PAYLOAD = PAYLOAD_COMMON;
|
||||||
|
|
||||||
|
public static final String RING_ENDPOINT = "ring";
|
||||||
|
public static final String RING_PAYLOAD = PAYLOAD_COMMON;
|
||||||
|
|
||||||
|
public static final String MUTE_ENDPOINT = "mute";
|
||||||
|
public static final String MUTE_PAYLOAD = PAYLOAD_COMMON;
|
||||||
|
|
||||||
|
public static final String INSTALL_APPS_ENDPOINT = "install-application";
|
||||||
|
public static final String INSTALL_APPS_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n"
|
||||||
|
+ " ],\n" + " \"operation\": {\n" + " \"appIdentifier\": \"string\",\n"
|
||||||
|
+ " \"type\": \"string\",\n" + " \"url\": \"string\"\n" + " }\n" + "}";
|
||||||
|
|
||||||
|
public static final String UNINSTALL_APPS_ENDPOINT = "uninstall-application";
|
||||||
|
public static final String UNINSTALL_APPS_PAYLOAD = "{\n" + " \"deviceIDs\": [\n"
|
||||||
|
+ " \""+DEVICE_ID+"\"\n" + " ],\n" + " \"operation\": {\n"
|
||||||
|
+ " \"appIdentifier\": \"string\",\n" + " \"type\": \"string\",\n" + " \"url\": \"string\",\n"
|
||||||
|
+ " \"name\": \"string\"\n" + " }\n" + "}";
|
||||||
|
|
||||||
|
public static final String BLACKLIST_APPS_ENDPOINT = "blacklist-applications";
|
||||||
|
|
||||||
|
public static final String NOTIFICATION_ENDPOINT = "send-notification";
|
||||||
|
public static final String NOTIFICATION_PAYLOAD = "{\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n"
|
||||||
|
+ " ],\n" + " \"operation\": {\n" + " \"messageText\": \"string\",\n"
|
||||||
|
+ " \"messageTitle\": \"string\"\n" + " }\n" + "}";
|
||||||
|
|
||||||
|
public static final String WIFI_ENDPOINT = "configure-wifi";
|
||||||
|
public static final String WIFI_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"ssid\": \"string\",\n"
|
||||||
|
+ " \"password\": \"string\"\n" + " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n"
|
||||||
|
+ " ]\n" + "}";
|
||||||
|
|
||||||
|
public static final String ENCRYPT_ENDPOINT = "encrypt-storage";
|
||||||
|
public static final String ENCRYPT_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"encrypted\": false\n"
|
||||||
|
+ " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}";
|
||||||
|
|
||||||
|
public static final String REBOOT_ENDPOINT = "reboot";
|
||||||
|
public static final String REBOOT_PAYLOAD = PAYLOAD_COMMON;;
|
||||||
|
|
||||||
|
public static final String CHANGE_LOCK_ENDPOINT = "change-lock-code";
|
||||||
|
public static final String CHANGE_LOCK_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"lockCode\": \"0000\"\n"
|
||||||
|
+ " },\n" + " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}\n";
|
||||||
|
|
||||||
|
public static final String PASSWORD_POLICY_ENDPOINT = "set-password-policy";
|
||||||
|
public static final String PASSWORD_POLICY_PAYLOAD = "{\n" + " \"operation\": {\n"
|
||||||
|
+ " \"maxFailedAttempts\": 0,\n" + " \"minLength\": 0,\n" + " \"pinHistory\": 0,\n"
|
||||||
|
+ " \"minComplexChars\": 0,\n" + " \"maxPINAgeInDays\": 0,\n"
|
||||||
|
+ " \"requireAlphanumeric\": false,\n" + " \"allowSimple\": false\n" + " },\n"
|
||||||
|
+ " \"deviceIDs\": [\n" + " \""+DEVICE_ID+"\"\n" + " ]\n" + "}";
|
||||||
|
|
||||||
|
public static final String WEB_CLIP_ENDPOINT = "set-webclip";
|
||||||
|
public static final String WEB_CLIP_PAYLOAD = "{\n" + " \"operation\": {\n" + " \"identity\": \"string\",\n"
|
||||||
|
+ " \"title\": \"string\",\n" + " \"type\": \"string\"\n" + " },\n" + " \"deviceIDs\": [\n"
|
||||||
|
+ " \""+DEVICE_ID+"\"\n" + " ]\n" + "}";
|
||||||
|
|
||||||
private AndroidOperations() {
|
private AndroidOperations() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
|
|||||||
@ -49,7 +49,6 @@ public class OAuthUtil {
|
|||||||
client = new RestClient(backendHTTPSURL, Constants.APPLICATION_URL_ENCODED, basicAuthString);
|
client = new RestClient(backendHTTPSURL, Constants.APPLICATION_URL_ENCODED, basicAuthString);
|
||||||
oAuthData = client.post(Constants.APIApplicationRegistration.TOKEN_ENDPOINT,
|
oAuthData = client.post(Constants.APIApplicationRegistration.TOKEN_ENDPOINT,
|
||||||
Constants.APIApplicationRegistration.OAUTH_TOKEN_PAYLOAD);
|
Constants.APIApplicationRegistration.OAUTH_TOKEN_PAYLOAD);
|
||||||
System.out.println(oAuthData.getData());
|
|
||||||
jsonObj = new JSONObject(oAuthData.getData());
|
jsonObj = new JSONObject(oAuthData.getData());
|
||||||
return jsonObj;
|
return jsonObj;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,9 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.wso2.iot.integration.device.operation;
|
package org.wso2.iot.integration.device.operation;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonPrimitive;
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
@ -34,23 +32,23 @@ import org.wso2.iot.integration.common.*;
|
|||||||
public class AndroidOperation extends TestBase {
|
public class AndroidOperation extends TestBase {
|
||||||
private RestClient client;
|
private RestClient client;
|
||||||
|
|
||||||
@BeforeTest(alwaysRun = true, groups = { Constants.AndroidEnrollment.ENROLLMENT_GROUP})
|
@BeforeTest(alwaysRun = true, groups = { Constants.AndroidOperations.OPERATIONS_GROUP})
|
||||||
public void initTest() throws Exception {
|
public void initTest() throws Exception {
|
||||||
super.init(TestUserMode.SUPER_TENANT_ADMIN);
|
super.init(TestUserMode.SUPER_TENANT_ADMIN);
|
||||||
String accessTokenString = "Bearer " + OAuthUtil.getOAuthToken(backendHTTPURL, backendHTTPSURL);
|
String accessTokenString = "Bearer " + OAuthUtil.getOAuthToken(backendHTTPURL, backendHTTPSURL);
|
||||||
this.client = new RestClient(backendHTTPURL, Constants.APPLICATION_JSON, accessTokenString);
|
this.client = new RestClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString);
|
||||||
//Enroll a device
|
//Enroll a device
|
||||||
JsonObject enrollmentData = PayloadGenerator.getJsonPayload(
|
JsonObject enrollmentData = PayloadGenerator.getJsonPayload(
|
||||||
Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME,
|
Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME,
|
||||||
Constants.HTTP_METHOD_POST);
|
Constants.HTTP_METHOD_POST);
|
||||||
enrollmentData.addProperty(Constants.DEVICE_IDENTIFIER_KEY, Constants.DEVICE_ID);
|
|
||||||
client.post(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT, enrollmentData.toString());
|
client.post(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT, enrollmentData.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android device lock operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android device lock operation.")
|
||||||
public void testLock() throws Exception {
|
public void testLock() throws Exception {
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.LOCK_ENDPOINT,
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
|
Constants.AndroidOperations.LOCK_ENDPOINT,
|
||||||
|
Constants.AndroidOperations.LOCK_OPERATION_PAYLOAD);
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,208 +60,151 @@ public class AndroidOperation extends TestBase {
|
|||||||
Assert.assertEquals(response.getResponseCode(), HttpStatus.SC_CREATED);
|
Assert.assertEquals(response.getResponseCode(), HttpStatus.SC_CREATED);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android device location operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android device location "
|
||||||
|
+ "operation.")
|
||||||
public void testLocation() throws Exception {
|
public void testLocation() throws Exception {
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.LOCATION_ENDPOINT,
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
|
Constants.AndroidOperations.LOCATION_ENDPOINT,
|
||||||
|
Constants.AndroidOperations.LOCATION_PAYLOAD);
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android device clear password " +
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android device clear password " +
|
||||||
"operation.")
|
"operation.")
|
||||||
public void testClearPassword() throws Exception {
|
public void testClearPassword() throws Exception {
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.CLEAR_PASSWORD_ENDPOINT,
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
|
Constants.AndroidOperations.CLEAR_PASSWORD_ENDPOINT,
|
||||||
|
Constants.AndroidOperations.CLEAR_PASSWORD_PAYLOAD);
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android device camera operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android device camera "
|
||||||
|
+ "operation.")
|
||||||
public void testCamera() throws Exception {
|
public void testCamera() throws Exception {
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
Constants.AndroidOperations.CAMERA_OPERATION,
|
||||||
Constants.AndroidOperations.CAMERA_OPERATION);
|
Constants.AndroidOperations.CAMERA_OPERATION_PAYLOAD);
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.CAMERA_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android device information operation.")
|
// //404
|
||||||
public void testDeviceInfo() throws Exception {
|
// @Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android device information "
|
||||||
|
// + "operation.")
|
||||||
|
// public void testDeviceInfo() throws Exception {
|
||||||
|
//
|
||||||
|
// HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
|
// Constants.AndroidOperations.DEVICE_INFO_ENDPOINT,
|
||||||
|
// Constants.AndroidOperations.DEVICE_INFO_PAYLOAD);
|
||||||
|
// Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
|
// }
|
||||||
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.DEVICE_INFO_ENDPOINT,
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android enterprise-wipe "
|
||||||
Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
|
+ "operation.")
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android enterprise-wipe operation.")
|
|
||||||
public void testEnterpriseWipe() throws Exception {
|
public void testEnterpriseWipe() throws Exception {
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.ENTERPRISE_WIPE_ENDPOINT,
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
|
Constants.AndroidOperations.ENTERPRISE_WIPE_ENDPOINT,
|
||||||
|
Constants.AndroidOperations.ENTERPRISE_WIPE_PAYLOAD);
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android wipe data operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android wipe data operation.")
|
||||||
public void testWipeData() throws Exception {
|
public void testWipeData() throws Exception {
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
Constants.AndroidOperations.WIPE_DATA_ENDPOINT,
|
||||||
Constants.AndroidOperations.WIPE_DATA_OPERATION);
|
Constants.AndroidOperations.WIPE_DATA_PAYLOAD);
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.WIPE_DATA_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android application list operation.")
|
// //400
|
||||||
public void testApplicationList() throws Exception {
|
// @Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android application list "
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.APPLICATION_LIST_ENDPOINT,
|
// + "operation.")
|
||||||
Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
|
// public void testApplicationList() throws Exception {
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
// HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
}
|
// Constants.AndroidOperations.APPLICATION_LIST_ENDPOINT,
|
||||||
|
// Constants.AndroidOperations.APPLICATION_LIST_PAYLOAD);
|
||||||
|
// Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
|
// }
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android ring operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android ring operation.")
|
||||||
public void testRing() throws Exception {
|
public void testRing() throws Exception {
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.RING_ENDPOINT,
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
|
Constants.AndroidOperations.RING_ENDPOINT,
|
||||||
|
Constants.AndroidOperations.RING_PAYLOAD);
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android mute operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android mute operation.")
|
||||||
public void testMute() throws Exception {
|
public void testMute() throws Exception {
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.MUTE_ENDPOINT,
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
|
Constants.AndroidOperations.MUTE_ENDPOINT,
|
||||||
|
Constants.AndroidOperations.MUTE_PAYLOAD);
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android install apps operation.")
|
// //400
|
||||||
public void testInstallApps() throws Exception {
|
// @Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android install apps operation.")
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
// public void testInstallApps() throws Exception {
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
// HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.INSTALL_APPS_OPERATION);
|
// Constants.AndroidOperations.INSTALL_APPS_ENDPOINT,
|
||||||
JsonArray deviceIds = new JsonArray();
|
// Constants.AndroidOperations.INSTALL_APPS_PAYLOAD);
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
// Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
deviceIds.add(deviceID);
|
// }
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.INSTALL_APPS_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android uninstall apps operation.")
|
// //400
|
||||||
public void testUninstallApps() throws Exception {
|
// @Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android uninstall apps "
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
// + "operation.")
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
// public void testUninstallApps() throws Exception {
|
||||||
Constants.AndroidOperations.INSTALL_APPS_OPERATION);
|
// HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
JsonArray deviceIds = new JsonArray();
|
// Constants.AndroidOperations.UNINSTALL_APPS_ENDPOINT,
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
// Constants.AndroidOperations.UNINSTALL_APPS_PAYLOAD);
|
||||||
deviceIds.add(deviceID);
|
// Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
// }
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.UNINSTALL_APPS_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android blacklist apps operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android notification operation.")
|
||||||
public void testBlacklistApps() throws Exception {
|
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
|
||||||
Constants.AndroidOperations.INSTALL_APPS_OPERATION);
|
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.BLACKLIST_APPS_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android notification operation.")
|
|
||||||
public void testNotification() throws Exception {
|
public void testNotification() throws Exception {
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
Constants.AndroidOperations.NOTIFICATION_ENDPOINT,
|
||||||
Constants.AndroidOperations.NOTIFICATION_OPERATION);
|
Constants.AndroidOperations.NOTIFICATION_PAYLOAD);
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.NOTIFICATION_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android WiFi operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android WiFi operation.")
|
||||||
public void testWiFi() throws Exception {
|
public void testWiFi() throws Exception {
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
Constants.AndroidOperations.WIFI_ENDPOINT,
|
||||||
Constants.AndroidOperations.WIFI_OPERATION);
|
Constants.AndroidOperations.WIFI_PAYLOAD);
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.WIFI_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android encrypt operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android encrypt operation.")
|
||||||
public void testEncrypt() throws Exception {
|
public void testEncrypt() throws Exception {
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
Constants.AndroidOperations.ENCRYPT_ENDPOINT,
|
||||||
Constants.AndroidOperations.ENCRYPT_OPERATION);
|
Constants.AndroidOperations.ENCRYPT_PAYLOAD);
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.ENCRYPT_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android change lock operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android change lock operation.")
|
||||||
public void testChangeLock() throws Exception {
|
public void testChangeLock() throws Exception {
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
Constants.AndroidOperations.CHANGE_LOCK_ENDPOINT,
|
||||||
Constants.AndroidOperations.CHANGE_LOCK_OPERATION);
|
Constants.AndroidOperations.CHANGE_LOCK_PAYLOAD);
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.CHANGE_LOCK_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android password policy operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android password policy operation.")
|
||||||
public void testPasswordPolicy() throws Exception {
|
public void testPasswordPolicy() throws Exception {
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
Constants.AndroidOperations.PASSWORD_POLICY_ENDPOINT,
|
||||||
Constants.AndroidOperations.PASSWORD_POLICY_OPERATION);
|
Constants.AndroidOperations.PASSWORD_POLICY_PAYLOAD);
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.PASSWORD_POLICY_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android web clip operation.")
|
@Test(groups = {Constants.AndroidOperations.OPERATIONS_GROUP}, description = "Test Android web clip operation.")
|
||||||
public void testWebClip() throws Exception {
|
public void testWebClip() throws Exception {
|
||||||
JsonObject operationData = PayloadGenerator.getJsonPayload(
|
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT +
|
||||||
Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
|
Constants.AndroidOperations.WEB_CLIP_ENDPOINT,
|
||||||
Constants.AndroidOperations.WEB_CLIP_OPERATION);
|
Constants.AndroidOperations.WEB_CLIP_PAYLOAD);
|
||||||
JsonArray deviceIds = new JsonArray();
|
|
||||||
JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
|
|
||||||
deviceIds.add(deviceID);
|
|
||||||
operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
|
|
||||||
HttpResponse response = client.post(Constants.AndroidOperations.WEB_CLIP_ENDPOINT,
|
|
||||||
operationData.toString());
|
|
||||||
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,11 +38,11 @@
|
|||||||
<class name="org.wso2.iot.integration.device.enrollment.AndroidEnrollment"/>
|
<class name="org.wso2.iot.integration.device.enrollment.AndroidEnrollment"/>
|
||||||
</classes>
|
</classes>
|
||||||
</test>
|
</test>
|
||||||
<!--<test name="android-operation" preserve-order="false" parallel="true">-->
|
<test name="android-operation" preserve-order="false" parallel="true">
|
||||||
<!--<classes>-->
|
<classes>
|
||||||
<!--<class name="org.wso2.iot.integration.device.operation.AndroidOperation"/>-->
|
<class name="org.wso2.iot.integration.device.operation.AndroidOperation"/>
|
||||||
<!--</classes>-->
|
</classes>
|
||||||
<!--</test>-->
|
</test>
|
||||||
<!--<test name="windows-enrollment" preserve-order="true" parallel="false">-->
|
<!--<test name="windows-enrollment" preserve-order="true" parallel="false">-->
|
||||||
<!--<classes>-->
|
<!--<classes>-->
|
||||||
<!--<class name="org.wso2.iot.integration.device.enrollment.WindowsEnrollment"/>-->
|
<!--<class name="org.wso2.iot.integration.device.enrollment.WindowsEnrollment"/>-->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user