Search in sources :

Example 16 with Script

use of org.wso2.siddhi.core.function.Script in project product-iots by wso2.

the class DeviceManagementAPINegativeTestCase method negativeTests.

@Test(description = "This test case tests the response when the APIs are called with invalid payloads and without" + " required parameters")
public void negativeTests() throws AutomationFrameworkException {
    URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "AndroidDeviceManagementAPI_Negative_Tests.jmx");
    JMeterTest script = new JMeterTest(new File(url.getPath()));
    JMeterTestManager manager = new JMeterTestManager();
    manager.runTest(script);
}
Also used : JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) File(java.io.File) URL(java.net.URL) JMeterTestManager(org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager) JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) Test(org.testng.annotations.Test)

Example 17 with Script

use of org.wso2.siddhi.core.function.Script in project product-iots by wso2.

the class GroupManagementJMeterTestCase method GroupManagementTest.

@Test(description = "This test case tests the Group Management APIs")
public void GroupManagementTest() throws AutomationFrameworkException {
    URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "GroupManagementAPI.jmx");
    JMeterTest script = new JMeterTest(new File(url.getPath()));
    JMeterTestManager manager = new JMeterTestManager();
    log.info("Running group management api test cases using jmeter scripts");
    manager.runTest(script);
}
Also used : JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) File(java.io.File) URL(java.net.URL) JMeterTestManager(org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager) JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) Test(org.testng.annotations.Test)

Example 18 with Script

use of org.wso2.siddhi.core.function.Script in project product-iots by wso2.

the class AppManagerJmeterTestCase method AppManagementTest.

@Test(description = "This test case tests the flow of App Manager mobile-app creation and lifecycle")
public void AppManagementTest() throws AutomationFrameworkException {
    URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "AppManagerTest.jmx");
    JMeterTest script = new JMeterTest(new File(url.getPath()));
    JMeterTestManager manager = new JMeterTestManager();
    log.info("Running app manager mobile creation related test cases using jmeter scripts");
    manager.runTest(script);
}
Also used : JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) File(java.io.File) URL(java.net.URL) JMeterTestManager(org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager) JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) Test(org.testng.annotations.Test)

Example 19 with Script

use of org.wso2.siddhi.core.function.Script 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");
}
Also used : RestClient(org.wso2.iot.integration.common.RestClient) HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) Test(org.testng.annotations.Test)

Example 20 with Script

use of org.wso2.siddhi.core.function.Script in project product-iots by wso2.

the class MobileQSGTestCase method testUserRoleCreation.

@Test(description = "This test case tests whether user and roles are created as expected", dependsOnMethods = { "executeQSGScript" })
public void testUserRoleCreation() throws Exception {
    // Two users will be created with the quick start script, check whether those two users are created
    // successfully,
    String url = Constants.UserManagement.USER_ENDPOINT + "/" + username1;
    HttpResponse response = client.get(url);
    Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
    url = Constants.UserManagement.USER_ENDPOINT + "/" + username2;
    response = client.get(url);
    Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
    // A single role will be created with the quick start script, checking whether that role creation happens
    // without problem
    String rolename = "iotMobileUser";
    response = client.get(Constants.RoleManagement.ROLE_MANAGEMENT_END_POINT + "/" + rolename);
    Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
}
Also used : HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)11 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)10 LinkedHashMap (java.util.LinkedHashMap)10 ByteArrayInputStream (java.io.ByteArrayInputStream)9 File (java.io.File)9 InputStream (java.io.InputStream)9 ResultSet (java.sql.ResultSet)9 URITemplate (org.wso2.carbon.apimgt.api.model.URITemplate)9 URL (java.net.URL)8 PreparedStatement (java.sql.PreparedStatement)8 SQLException (java.sql.SQLException)8 JMeterTest (org.wso2.carbon.automation.extensions.jmeter.JMeterTest)8 JMeterTestManager (org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager)8 Connection (java.sql.Connection)7 HashSet (java.util.HashSet)7 LinkedHashSet (java.util.LinkedHashSet)7 Scope (org.wso2.carbon.apimgt.api.model.Scope)7 Gson (com.google.gson.Gson)5 ClientCertificateDTO (org.wso2.carbon.apimgt.api.dto.ClientCertificateDTO)4