Search in sources :

Example 6 with RestClient

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

the class FeatureManagement method initTest.

@BeforeClass(alwaysRun = true, groups = { Constants.FeatureManagement.FEATURE_MANAGEMENT_GROUP })
public void initTest() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    String accessTokenString = "Bearer " + OAuthUtil.getOAuthToken(backendHTTPSURL, backendHTTPSURL);
    this.client = new RestClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString);
}
Also used : RestClient(org.wso2.iot.integration.common.RestClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with RestClient

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

the class DeviceTypeManagementJMeterTestCase method initTest.

@BeforeClass(alwaysRun = true)
public void initTest() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    restClient = new RestClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString);
}
Also used : RestClient(org.wso2.iot.integration.common.RestClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 8 with RestClient

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

the class AndroidSenseEnrollment method initTest.

@BeforeClass(alwaysRun = true, groups = { Constants.UserManagement.USER_MANAGEMENT_GROUP })
public void initTest() throws Exception {
    super.init(userMode);
    User currentUser = getAutomationContext().getContextTenant().getContextUser();
    byte[] bytesEncoded = Base64.encodeBase64((currentUser.getUserName() + ":" + currentUser.getPassword()).getBytes());
    String encoded = new String(bytesEncoded);
    String auth_string = "Basic " + encoded;
    String anaytics_https_url = automationContext.getContextUrls().getWebAppURLHttps().replace("9443", String.valueOf(Constants.HTTPS_ANALYTICS_PORT)).replace("/t/" + automationContext.getContextTenant().getDomain(), "") + "/";
    this.client = new RestClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString);
    this.analyticsClient = new RestClient(anaytics_https_url, Constants.APPLICATION_JSON, auth_string);
    if (this.userMode == TestUserMode.TENANT_ADMIN) {
        HttpResponse response = client.post(Constants.AndroidSenseEnrollment.ANALYTICS_ARTIFACTS_DEPLOYMENT_ENDPOINT, "");
        Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
    }
}
Also used : User(org.wso2.carbon.automation.engine.context.beans.User) RestClient(org.wso2.iot.integration.common.RestClient) HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) BeforeClass(org.testng.annotations.BeforeClass)

Example 9 with RestClient

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

the class AndroidEnrollment method initTest.

@BeforeClass(alwaysRun = true, groups = { Constants.UserManagement.USER_MANAGEMENT_GROUP })
public void initTest() throws Exception {
    super.init(userMode);
    this.client = new RestClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString);
}
Also used : RestClient(org.wso2.iot.integration.common.RestClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 10 with RestClient

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

the class WindowsEnrollment method initTest.

@BeforeClass(alwaysRun = true, groups = { Constants.WindowsEnrollment.WINDOWS_ENROLLMENT_GROUP })
public void initTest() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    String accessTokenString = "Bearer " + OAuthUtil.getOAuthToken(backendHTTPURL, backendHTTPSURL);
    client = new RestClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString);
}
Also used : RestClient(org.wso2.iot.integration.common.RestClient) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

RestClient (org.wso2.iot.integration.common.RestClient)11 BeforeClass (org.testng.annotations.BeforeClass)9 HttpResponse (org.wso2.carbon.automation.test.utils.http.client.HttpResponse)5 Test (org.testng.annotations.Test)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 JSONObject (org.json.JSONObject)1 User (org.wso2.carbon.automation.engine.context.beans.User)1