Search in sources :

Example 6 with AutomationFrameworkException

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

the class AndroidOperation method testBlackListApplication.

@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test black list application " + "operation")
public void testBlackListApplication() throws FileNotFoundException, MalformedURLException, AutomationFrameworkException {
    JsonObject blackListApplicationPayload = PayloadGenerator.getJsonPayload(Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME, Constants.AndroidOperations.BLACKLIST_OPERATION);
    HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.BLACKLIST_APPS_ENDPOINT, blackListApplicationPayload.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 7 with AutomationFrameworkException

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

the class AndroidOperation method testUnLock.

@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android device un-lock " + "operation.")
public void testUnLock() throws MalformedURLException, AutomationFrameworkException {
    HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.UNLOCK_ENDPOINT, Constants.AndroidOperations.UNLOCK_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 8 with AutomationFrameworkException

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

the class DeviceTypeManagementJMeterTestCase method DeviceTypeManagementTest.

@Test(description = "This test case tests the Device Type/Device Management/Device Agent APIs")
public void DeviceTypeManagementTest() throws AutomationFrameworkException {
    URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "DeviceTypeManagementAPI.jmx");
    JMeterTest script = new JMeterTest(new File(url.getPath()));
    JMeterTestManager manager = new JMeterTestManager();
    log.info("Running Device Type/Device Management/Device Agent management api test cases using jmeter scripts");
    manager.runTest(script);
    log.info("Completed DeviceType API service test using jmeter scripts");
}
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) Test(org.testng.annotations.Test) JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest)

Example 9 with AutomationFrameworkException

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

the class NotificationManagementAPIJMeterTestCase method NotificationManagementTest.

@Test(description = "This test case tests the Notification Management APIs")
public void NotificationManagementTest() throws AutomationFrameworkException {
    URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "NotificationManagementAPI.jmx");
    JMeterTest script = new JMeterTest(new File(url.getPath()));
    JMeterTestManager manager = new JMeterTestManager();
    log.info("Running notification 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 10 with AutomationFrameworkException

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

the class BrokerServerExtension method initiate.

@Override
public void initiate() throws AutomationFrameworkException {
    try {
        automationContext = new AutomationContext("IOT", TestUserMode.SUPER_TENANT_USER);
        if (getParameters().get(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND) == null) {
            getParameters().put(ExtensionConstants.SERVER_STARTUP_PORT_OFFSET_COMMAND, "3");
        }
        serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
        executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
    } catch (XPathExpressionException e) {
        handleException("Error while initiating test environment", e);
    }
}
Also used : AutomationContext(org.wso2.carbon.automation.engine.context.AutomationContext) XPathExpressionException(javax.xml.xpath.XPathExpressionException)

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