Search in sources :

Example 1 with IOTResponse

use of org.wso2.iot.integration.common.IOTResponse in project product-iots by wso2.

the class RoleManagement method testUpdateRolePermission.

@Test(description = "Test update permission role.", dependsOnMethods = { "testAddRole" })
public void testUpdateRolePermission() throws FileNotFoundException {
    IOTResponse response = client.put(Constants.RoleManagement.ROLE_MANAGEMENT_END_POINT + "/" + ROLE_NAME, PayloadGenerator.getJsonPayload(Constants.RoleManagement.ROLE_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_PUT).toString());
    Assert.assertEquals(HttpStatus.SC_OK, response.getStatus());
}
Also used : IOTResponse(org.wso2.iot.integration.common.IOTResponse) Test(org.testng.annotations.Test)

Example 2 with IOTResponse

use of org.wso2.iot.integration.common.IOTResponse in project product-iots by wso2.

the class RoleManagement method testAddRole.

@Test(description = "Test add role.")
public void testAddRole() throws FileNotFoundException {
    IOTResponse response = client.post(Constants.RoleManagement.ROLE_MANAGEMENT_END_POINT, PayloadGenerator.getJsonPayload(Constants.RoleManagement.ROLE_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST).toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getStatus());
}
Also used : IOTResponse(org.wso2.iot.integration.common.IOTResponse) Test(org.testng.annotations.Test)

Example 3 with IOTResponse

use of org.wso2.iot.integration.common.IOTResponse in project product-iots by wso2.

the class RoleManagement method testGetRolePermissions.

@Test(description = "Test getting permissions of a role.", dependsOnMethods = { "testGetFilteredRoles" })
public void testGetRolePermissions() throws FileNotFoundException {
    IOTResponse response = client.get(Constants.RoleManagement.ROLE_MANAGEMENT_END_POINT + "/" + ROLE_NAME + "/permissions");
    Assert.assertEquals(HttpStatus.SC_OK, response.getStatus());
}
Also used : IOTResponse(org.wso2.iot.integration.common.IOTResponse) Test(org.testng.annotations.Test)

Example 4 with IOTResponse

use of org.wso2.iot.integration.common.IOTResponse in project product-iots by wso2.

the class MobileDeviceManagementWithNoDevices method testCountDevicesWithNoDevices.

@Test(description = "Test count devices with no added devices")
public void testCountDevicesWithNoDevices() throws Exception {
    IOTResponse response = client.get(Constants.MobileDeviceManagement.GET_DEVICE_COUNT_ENDPOINT);
    Assert.assertEquals(HttpStatus.SC_OK, response.getStatus());
    Assert.assertEquals(Constants.MobileDeviceManagement.NO_DEVICE, response.getBody());
}
Also used : IOTResponse(org.wso2.iot.integration.common.IOTResponse) Test(org.testng.annotations.Test)

Example 5 with IOTResponse

use of org.wso2.iot.integration.common.IOTResponse in project product-iots by wso2.

the class RoleManagement method testGetFilteredRoles.

@Test(description = "Test getting roles that has particular prefix.", dependsOnMethods = { "testGetRoles" })
public void testGetFilteredRoles() throws FileNotFoundException {
    IOTResponse response = client.get(Constants.RoleManagement.ROLE_MANAGEMENT_END_POINT + "/filter/administ?offset=0&limit=2");
    Assert.assertEquals(HttpStatus.SC_OK, response.getStatus());
    AssertUtil.jsonPayloadCompare(PayloadGenerator.getJsonPayload(Constants.RoleManagement.ROLE_RESPONSE_PAYLOAD_FILE_NAME, Constants.RoleManagement.GET_FILTERED_ROLED_METHOD).toString(), response.getBody(), true);
}
Also used : IOTResponse(org.wso2.iot.integration.common.IOTResponse) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)9 IOTResponse (org.wso2.iot.integration.common.IOTResponse)9 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 JsonParser (com.google.gson.JsonParser)1