Search in sources :

Example 21 with AutomationFrameworkException

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

the class AndroidOperation method testUninstallApplication.

@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android app un-install " + "operation")
public void testUninstallApplication() throws MalformedURLException, AutomationFrameworkException {
    HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.UNINSTALL_APPS_ENDPOINT, Constants.AndroidOperations.UNINSTALL_APPS_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 22 with AutomationFrameworkException

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

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

the class SampleInstallationTest method setup.

@BeforeClass(alwaysRun = true)
public void setup() throws XPathExpressionException, XMLStreamException, IOException, AutomationFrameworkException, LoginAuthenticationExceptionException {
    super.init();
    logViewerClient = new LogViewerClient(getBackendURL(), getSessionCookie(automationContext));
}
Also used : LogViewerClient(org.wso2.carbon.integration.common.admin.client.LogViewerClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 24 with AutomationFrameworkException

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

the class CarbonServerManagerExtension method restartGracefully.

public synchronized void restartGracefully() throws AutomationFrameworkException {
    try {
        int httpsPort = defaultHttpsPort + this.portOffset;
        String backendURL = this.automationContext.getContextUrls().getSecureServiceUrl().replaceAll("(:\\d+)", ":" + httpsPort);
        User superUser = this.automationContext.getSuperTenant().getTenantAdmin();
        ClientConnectionUtil.sendGraceFullRestartRequest(backendURL, superUser.getUserName(), superUser.getPassword());
    } catch (XPathExpressionException var5) {
        throw new AutomationFrameworkException("restart failed", var5);
    }
    long time = System.currentTimeMillis() + 300000L;
    // while(!this.inputStreamHandler.getOutput().contains("Halting JVM") && System.currentTimeMillis() < time) {
    // ;
    // }
    time = System.currentTimeMillis();
    while (System.currentTimeMillis() < time + 5000L) {
        ;
    }
    try {
        ClientConnectionUtil.waitForPort(Integer.parseInt((String) this.automationContext.getInstance().getPorts().get("https")), (String) this.automationContext.getInstance().getHosts().get("default"));
        ClientConnectionUtil.waitForLogin(this.automationContext);
    } catch (XPathExpressionException var4) {
        throw new AutomationFrameworkException("Connection attempt to carbon server failed", var4);
    }
}
Also used : User(org.wso2.carbon.automation.engine.context.beans.User) AutomationFrameworkException(org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException) 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