use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class VirtualFireAlarmTestCase method testBatchDataPersistence.
// Test case related to virtual fire alarm added here as the batch cron runs for every 5 minutes and rather than
// waiting for that we can check them in a latter test cases
@Test(description = "Test whether data that is published is stored in analytics event table", dependsOnMethods = { "testPolicyPublishing" })
public void testBatchDataPersistence() throws Exception {
String deviceId1 = this.userMode == TestUserMode.TENANT_ADMIN ? tenantDeviceId1 : VirtualFireAlarmTestCase.deviceId1;
String deviceId2 = this.userMode == TestUserMode.TENANT_ADMIN ? tenantDeviceId2 : VirtualFireAlarmTestCase.deviceId2;
long MilliSecondDifference = System.currentTimeMillis() - VirtualFireAlarmTestCase.currentTime;
if (MilliSecondDifference < 300000) {
Thread.sleep(300000 - MilliSecondDifference);
}
String url = Constants.VirtualFireAlarmConstants.STATS_ENDPOINT + "/" + deviceId1;
url += "?from=" + (VirtualFireAlarmTestCase.currentTime - 300000) / 1000 + "&to=" + System.currentTimeMillis() / 1000;
HttpResponse response = restClient.get(url);
// TODO:Need to verify this testcase
// JsonArray jsonArray = new JsonParser().parse(response.getData()).getAsJsonArray();
// Assert.assertEquals(
// "Published event for the device with the id " + deviceId1 + " is not inserted to "
// + "analytics table", HttpStatus.SC_OK, response.getResponseCode());
// Assert.assertTrue(
// "Published event for the device with the id " + deviceId1 + " is not inserted to analytics table",
// jsonArray.size() > 0);
//
// url = Constants.VirtualFireAlarmConstants.STATS_ENDPOINT + "/" + deviceId2;
// url += "?from=" + (VirtualFireAlarmTestCase.currentTime - 300000)/1000 + "&to=" + System.currentTimeMillis()
// /1000;
// response = restClient.get(url);
// log.info("PAYLOADXX : " + response.getData());
// jsonArray = new JsonParser().parse(response.getData()).getAsJsonArray();
// Assert.assertEquals(
// "Published event for the device with the id " + deviceId2 + " is not inserted to "
// + "analytics table", HttpStatus.SC_OK, response.getResponseCode());
// Assert.assertTrue(
// "Published event for the device with the id " + deviceId2 + " is not inserted to analytics table",
// jsonArray.size() > 0);
}
use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class AndroidOperation method testInstallApplication.
@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android app install operation")
public void testInstallApplication() throws Exception {
JsonObject installApplicationPayload = PayloadGenerator.getJsonPayload(Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME, Constants.AndroidOperations.INSTALL_APPS_OPERATION);
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.INSTALL_APPS_ENDPOINT, installApplicationPayload.toString());
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class AndroidOperation method testGetInfo.
@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android get info operation")
public void testGetInfo() 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());
}
use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class AndroidOperation method testLock.
@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android device lock operation.")
public void testLock() throws MalformedURLException, AutomationFrameworkException {
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.LOCK_ENDPOINT, Constants.AndroidOperations.LOCK_OPERATION_PAYLOAD);
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
use of org.wso2.mdm.qsg.dto.HTTPResponse in project product-iots by wso2.
the class AndroidOperation method testConfigureVPN.
@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test configure VPN operation")
public void testConfigureVPN() throws FileNotFoundException, MalformedURLException, AutomationFrameworkException {
JsonObject configureVPNPayload = PayloadGenerator.getJsonPayload(Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME, Constants.AndroidOperations.VPN_OPERATION);
HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.VPN_ENDPOINT, configureVPNPayload.toString());
Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
Aggregations