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;
}
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();
}
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);
}
}
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);
}
}
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);
}
Aggregations