use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class AppOperations method uploadAsset.
private static String uploadAsset(String path) {
String resUploadEndpoint = EMMQSGConfig.getInstance().getEmmHost() + appmPublisherResourcesUrl;
HTTPResponse httpResponse = HTTPInvoker.uploadFile(resUploadEndpoint, path, "image/jpeg");
if (Constants.HTTPStatus.OK == httpResponse.getResponseCode()) {
JSONObject resp = null;
try {
resp = (JSONObject) new JSONParser().parse(httpResponse.getResponse());
return (String) resp.get("id");
} catch (ParseException e) {
e.printStackTrace();
}
}
return null;
}
use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class OperationManagement method testInstallApps.
@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());
}
use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class NotificationManagement method testGetNotification.
@Test(description = "Test get notification.", dependsOnMethods = { "testUpdateNotification" })
public void testGetNotification() throws Exception {
HttpResponse response = client.get(Constants.NotificationManagement.NOTIFICATION_ENDPOINT);
Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
}
use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class NotificationManagement method testUpdateNotification.
@Test(description = "Test update notification.", dependsOnMethods = { "testAddNotification" })
public void testUpdateNotification() throws Exception {
HttpResponse response = client.put(Constants.NotificationManagement.NOTIFICATION_UPDATE_ENDPOINT, PayloadGenerator.getJsonPayload(Constants.NotificationManagement.NOTIFICATION_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_PUT).toString());
Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload(Constants.NotificationManagement.NOTIFICATION_RESPONSE_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_PUT).toString(), response.getData().toString(), true);
}
use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class MobileQSGTestCase method testMobileApp.
@Test(description = "This test case tests whether app-catalogue is created from qsg script", dependsOnMethods = { "executeQSGScript" })
public void testMobileApp() throws Exception {
RestClient appManagerRestClient = new RestClient(automationContext.getContextUrls().getWebAppURLHttps(), Constants.APPLICATION_JSON, accessTokenString);
HttpResponse response = appManagerRestClient.get(Constants.QSGManagement.GET_MOBILE_APPS_ENDPONT);
Assert.assertEquals(response.getResponseCode(), HttpStatus.SC_OK);
Assert.assertTrue(response.getData().contains("WSO2Con-Android"), "Con-App-Android addition through script is not successful");
}
Aggregations