@Test(description = "Add an Android device.") public void testEnrollment() throws Exception { JsonObject enrollmentData = PayloadGenerator.getJsonPayload( Constants.AndroidEnrollment.ENROLLMENT_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST); enrollmentData.addProperty(Constants.DEVICE_IDENTIFIER_KEY, Constants.DEVICE_ID); MDMResponse response = client.post(Constants.AndroidEnrollment.ENROLLMENT_ENDPOINT, enrollmentData.toString()); Assert.assertEquals(HttpStatus.SC_OK, response.getStatus()); AssertUtil.jsonPayloadCompare( PayloadGenerator.getJsonPayload( Constants.AndroidEnrollment.ENROLLMENT_RESPONSE_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST) .toString(), response.getBody(), true); }
@Test( dependsOnMethods = {"testEnrollment"}, description = "Test Android install apps operation.") public void testInstallApps() 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 = rclient.post(Constants.AndroidOperations.INSTALL_APPS_ENDPOINT, operationData.toString()); Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode()); }