Search in sources :

Example 16 with AutomationFrameworkException

use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException 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 AutomationFrameworkException

use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException 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 AutomationFrameworkException

use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException 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());
}
Also used : HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) Test(org.testng.annotations.Test)

Example 19 with AutomationFrameworkException

use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException 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());
}
Also used : JsonObject(com.google.gson.JsonObject) HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) Test(org.testng.annotations.Test)

Example 20 with AutomationFrameworkException

use of org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException in project product-iots by wso2.

the class AndroidOperation method testUpdateApplication.

@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android app update operation")
public void testUpdateApplication() throws FileNotFoundException, MalformedURLException, AutomationFrameworkException {
    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.UPDATE_APPS_ENDPOINT, installApplicationPayload.toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
Also used : JsonObject(com.google.gson.JsonObject) HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)15 File (java.io.File)12 URL (java.net.URL)8 JMeterTest (org.wso2.carbon.automation.extensions.jmeter.JMeterTest)8 JMeterTestManager (org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager)8 XPathExpressionException (javax.xml.xpath.XPathExpressionException)7 HttpResponse (org.wso2.carbon.automation.test.utils.http.client.HttpResponse)7 JsonObject (com.google.gson.JsonObject)4 AutomationFrameworkException (org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException)4 AutomationContext (org.wso2.carbon.automation.engine.context.AutomationContext)3 IOException (java.io.IOException)2 User (org.wso2.carbon.automation.engine.context.beans.User)2 BeforeClass (org.testng.annotations.BeforeClass)1 ReportGenerator (org.wso2.carbon.automation.engine.frameworkutils.ReportGenerator)1 ArchiveExtractor (org.wso2.carbon.automation.extensions.servers.utils.ArchiveExtractor)1 ServerLogReader (org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader)1 LogViewerClient (org.wso2.carbon.integration.common.admin.client.LogViewerClient)1