Search in sources :

Example 1 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class TestBase method init.

protected void init(TestUserMode userMode) throws Exception {
    automationContext = new AutomationContext(Constants.AUTOMATION_CONTEXT, userMode);
    String tenantDomain = automationContext.getContextTenant().getDomain();
    backendHTTPSURL = automationContext.getContextUrls().getWebAppURLHttps().replace("9443", String.valueOf(Constants.HTTPS_GATEWAY_PORT)).replace("/t/" + tenantDomain, "");
    backendHTTPURL = automationContext.getContextUrls().getWebAppURL().replace("9763", String.valueOf(Constants.HTTP_GATEWAY_PORT)).replace("/t/" + tenantDomain, "");
    User currentUser = getAutomationContext().getContextTenant().getContextUser();
    byte[] bytesEncoded = Base64.encodeBase64((currentUser.getUserName() + ":" + currentUser.getPassword()).getBytes());
    String encoded = new String(bytesEncoded);
    accessToken = OAuthUtil.getOAuthTokenPair(encoded, backendHTTPSURL, backendHTTPSURL, currentUser.getUserName(), currentUser.getPassword());
    accessTokenString = "Bearer " + accessToken;
}
Also used : AutomationContext(org.wso2.carbon.automation.engine.context.AutomationContext) User(org.wso2.carbon.automation.engine.context.beans.User)

Example 2 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class TestBase method initPublisher.

protected void initPublisher(String productGroupName, String instanceName, TestUserMode userMode) throws XPathExpressionException {
    automationContext = new AutomationContext(productGroupName, instanceName, userMode);
    backendHTTPSURL = automationContext.getContextUrls().getBackEndUrl();
}
Also used : AutomationContext(org.wso2.carbon.automation.engine.context.AutomationContext)

Example 3 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class IOTServerExtension method initiate.

@Override
public void initiate() {
    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, IOT_CORE_PORT_OFFSET);
        }
        serverManager = new CustomTestServerManager(getAutomationContext(), null, getParameters());
        executionEnvironment = automationContext.getConfigurationValue(ContextXpathConstants.EXECUTION_ENVIRONMENT);
    } catch (XPathExpressionException e) {
        throw new RuntimeException("Error while initiating test environment", e);
    }
}
Also used : AutomationContext(org.wso2.carbon.automation.engine.context.AutomationContext) XPathExpressionException(javax.xml.xpath.XPathExpressionException)

Example 4 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext 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)

Example 5 with AutomationContext

use of org.wso2.carbon.automation.engine.context.AutomationContext in project product-iots by wso2.

the class DeviceGroupTest method setup.

@BeforeClass(alwaysRun = true)
public void setup() throws Exception {
    super.init();
    driver = BrowserManager.getWebDriver();
    LoginUtils.login(driver, automationContext, getWebAppURL());
    adminDashboard = new IOTAdminDashboard(driver);
}
Also used : IOTAdminDashboard(org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

AutomationContext (org.wso2.carbon.automation.engine.context.AutomationContext)8 XPathExpressionException (javax.xml.xpath.XPathExpressionException)7 BeforeClass (org.testng.annotations.BeforeClass)7 IOTAdminDashboard (org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard)4 DevicesPage (org.wso2.iot.integration.ui.pages.devices.DevicesPage)2 MalformedURLException (java.net.MalformedURLException)1 RemoteException (java.rmi.RemoteException)1 Test (org.testng.annotations.Test)1 User (org.wso2.carbon.automation.engine.context.beans.User)1 LogViewerClient (org.wso2.carbon.integration.common.admin.client.LogViewerClient)1 AutomationUtilException (org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException)1 ServerConfigurationManager (org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager)1 LogViewerLogViewerException (org.wso2.carbon.logging.view.stub.LogViewerLogViewerException)1 EnrollDevicePage (org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage)1 LoginPage (org.wso2.iot.integration.ui.pages.login.LoginPage)1 ConnectedCupDeviceInterface (org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface)1