use of org.wso2.carbon.device.mgt.common.Device in project product-iots by wso2.
the class MobileDeviceManagement method testViewDevices.
@Test(description = "Test getting devices")
public void testViewDevices() throws Exception {
int expectedCount = this.userMode == TestUserMode.TENANT_ADMIN ? 3 : 23;
HttpResponse response = client.get(Constants.MobileDeviceManagement.GET_ALL_DEVICES_ENDPOINT);
Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
JsonObject devices = new JsonParser().parse(response.getData()).getAsJsonObject();
Assert.assertEquals("Expected device count is not received", expectedCount, devices.get("count").getAsInt());
}
use of org.wso2.carbon.device.mgt.common.Device in project product-iots by wso2.
the class MobileDeviceManagement method testAdvancedSearch.
@Test(description = "Test Advance search")
public void testAdvancedSearch() throws Exception {
JsonArray pendingOperationsData = PayloadGenerator.getJsonArray(Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME, Constants.AndroidEnrollment.GET_PENDING_OPERATIONS_METHOD);
JsonArray newPayload = new JsonArray();
HttpResponse response = client.put(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT + "/" + Constants.DEVICE_ID + "/pending-operations", pendingOperationsData.toString());
JsonArray pendingOperations = new JsonParser().parse(response.getData()).getAsJsonArray();
for (JsonElement pendingOperation : pendingOperations) {
JsonObject jsonObject = pendingOperation.getAsJsonObject();
if (jsonObject.get("code").getAsString().equals("DEVICE_INFO")) {
jsonObject.addProperty("operationResponse", PayloadGenerator.getJsonPayload(Constants.MobileDeviceManagement.REQUEST_PAYLOAD_FILE_NAME, Constants.MobileDeviceManagement.UPDATE_PAYLOAD_OPERATION).toString());
jsonObject.addProperty("status", "COMPLETED");
newPayload.add(jsonObject);
break;
}
}
client.put(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT + "/" + Constants.DEVICE_ID + "/pending-operations", newPayload.toString());
response = client.post(Constants.MobileDeviceManagement.GET_ALL_DEVICES_ENDPOINT + Constants.MobileDeviceManagement.ADVANCE_SEARCH_ENDPOINT, PayloadGenerator.getJsonPayload(Constants.MobileDeviceManagement.REQUEST_PAYLOAD_FILE_NAME, Constants.MobileDeviceManagement.ADVANCE_SEARCH_OPERATION).toString());
JsonObject devices = new JsonParser().parse(response.getData()).getAsJsonObject();
Assert.assertEquals("Expected device count is not received", 1, devices.get("devices").getAsJsonArray().size());
}
use of org.wso2.carbon.device.mgt.common.Device in project product-iots by wso2.
the class AndroidOperation method testLocation.
@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android device location " + "operation.")
public void testLocation() throws Exception {
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.LOCATION_ENDPOINT, Constants.AndroidOperations.LOCATION_PAYLOAD);
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
use of org.wso2.carbon.device.mgt.common.Device in project product-iots by wso2.
the class AndroidOperation method testUnLock.
@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android device un-lock " + "operation.")
public void testUnLock() throws MalformedURLException, AutomationFrameworkException {
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.UNLOCK_ENDPOINT, Constants.AndroidOperations.UNLOCK_OPERATION_PAYLOAD);
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
use of org.wso2.carbon.device.mgt.common.Device in project product-iots by wso2.
the class AndroidOperation method testCamera.
@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android device camera " + "operation.")
public void testCamera() throws Exception {
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.CAMERA_OPERATION, Constants.AndroidOperations.CAMERA_OPERATION_PAYLOAD);
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
Aggregations