Search in sources :

Example 6 with Account

use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.

the class DropBoxUtils method getClient.

private DbxClientV2 getClient() throws DbxException {
    if (this.client == null) {
        System.setProperty("https.protocols", "TLSv1.2");
        Account account = AccountsDirectory.getInstance().get(Account.Name.DROPBOX);
        DbxRequestConfig config = new DbxRequestConfig(account.getProperty("clientIdentifier"));
        this.client = new DbxClientV2(config, account.getProperty("accessToken"));
        log.debug("DropBox client created, logged as: " + client.users().getCurrentAccount());
    } else {
        log.debug("DropBox client was already created, returning existing instance");
    }
    return this.client;
}
Also used : Account(io.syndesis.qe.account.Account) DbxClientV2(com.dropbox.core.v2.DbxClientV2) DbxRequestConfig(com.dropbox.core.DbxRequestConfig)

Example 7 with Account

use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.

the class SftpClientManager method initProperties.

private void initProperties() {
    Account account = AccountsDirectory.getInstance().get(Account.Name.SFTP);
    Map<String, String> properties = new HashMap<>();
    account.getProperties().forEach((key, value) -> properties.put(key.toLowerCase(), value));
    sftpUser = properties.get("username");
    sftpPass = properties.get("password");
    sftpPodName = properties.get("host");
    sftpRemotePort = Integer.parseInt(properties.get("port"));
}
Also used : Account(io.syndesis.qe.account.Account) HashMap(java.util.HashMap)

Example 8 with Account

use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.

the class DynamoDbUtils method initClient.

@PostConstruct
public void initClient() {
    log.info("Initializing DynamoDb client");
    Account dynamoDbAccount = AccountsDirectory.getInstance().get(Account.Name.AWS);
    final String region = dynamoDbAccount.getProperty("region");
    this.tableName = dynamoDbAccount.getProperty("tableName");
    dynamoDb = DynamoDbClient.builder().region(Region.of(region)).credentialsProvider(() -> AwsBasicCredentials.create(dynamoDbAccount.getProperty("accessKey"), dynamoDbAccount.getProperty("secretKey"))).build();
}
Also used : Account(io.syndesis.qe.account.Account) PostConstruct(javax.annotation.PostConstruct)

Example 9 with Account

use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.

the class CommonSteps method createConnections.

@Given("^created connections$")
public void createConnections(DataTable connectionsData) {
    Connections connectionsPage = new Connections();
    ConfigureConnectionSteps configureConnectionSteps = new ConfigureConnectionSteps();
    NameConnectionSteps nameConnectionSteps = new NameConnectionSteps();
    List<List<String>> dataTable = connectionsData.cells();
    for (List<String> dataRow : dataTable) {
        String connectionType = validateConnectorName(dataRow.get(0));
        String connectionCredentialsName = dataRow.get(1);
        String connectionName = dataRow.get(2);
        String connectionDescription = dataRow.get(3);
        if ("Gmail".equalsIgnoreCase(connectionType) || "Google Calendar".equalsIgnoreCase(connectionType)) {
            Account a = AccountsDirectory.getInstance().get(connectionCredentialsName);
            GoogleAccount googleAccount = googleAccounts.getGoogleAccountForTestAccount(connectionCredentialsName);
            a.getProperties().put("accessToken", googleAccount.getCredential().getAccessToken());
        }
        navigateTo("Connections");
        validatePage("Connections");
        ElementsCollection connections = connectionsPage.getAllConnections();
        connections = connections.filter(exactText(connectionName));
        try {
            if (connections.size() != 0) {
                log.warn("Connection {} already exists!", connectionName);
                continue;
            }
        } catch (org.openqa.selenium.StaleElementReferenceException e) {
            // this may happen if page was "reloaded" before connections.size was processed, give it second try
            connections = connectionsPage.getAllConnections();
            connections = connections.filter(exactText(connectionName));
            if (connections.size() != 0) {
                log.warn("Connection {} already exists!", connectionName);
                continue;
            }
        }
        clickOnLink("Create Connection");
        log.info("Sleeping so jenkins has more time to load all connectors");
        TestUtils.sleepIgnoreInterrupt(TestConfiguration.getJenkinsDelay() * 1000);
        selectConnectionTypeSteps.selectConnectionType(connectionType);
        configureConnectionSteps.fillConnectionDetails(connectionCredentialsName);
        // do nothing if connection does not require any credentials
        if (!("no credentials".equalsIgnoreCase(connectionCredentialsName) || "no validation".equalsIgnoreCase(connectionDescription))) {
            clickOnButton("Validate");
            TestUtils.waitFor(() -> $$(Alert.ALL.getBy()).size() > 0, 2, 20, "Any notification appears!");
            if (getAllAlerts(connectionType + " does not support validation", "info").size() > 0) {
                log.warn("Connection type " + connectionType + " doesn't support validation. The test suite assumes that set credentials are correct.");
            } else {
                successNotificationIsPresentWithError(connectionType + " has been successfully validated", "success");
            }
            scrollTo("top", "right");
            clickOnButton("Next");
        } else if ("no validation".equalsIgnoreCase(connectionDescription)) {
            scrollTo("top", "right");
            clickOnButton("Next");
        }
        nameConnectionSteps.setConnectionName(connectionName);
        nameConnectionSteps.setConnectionDescription(connectionDescription);
        clickOnButton("Save");
        try {
            TestUtils.sleepForJenkinsDelayIfHigher(2);
            OpenShiftWaitUtils.waitFor(() -> !syndesisRootPage.getCurrentUrl().contains("connections/create"), 2, 20);
        } catch (TimeoutException | InterruptedException e) {
            clickOnButton("Save");
            TestUtils.waitFor(() -> !syndesisRootPage.getCurrentUrl().contains("connections/create"), 2, 20, "Unable to create a connection - create button does nothing.");
        }
    }
}
Also used : Connections(io.syndesis.qe.pages.connections.Connections) GoogleAccount(io.syndesis.qe.utils.google.GoogleAccount) Account(io.syndesis.qe.account.Account) GoogleAccount(io.syndesis.qe.utils.google.GoogleAccount) ConfigureConnectionSteps(io.syndesis.qe.steps.connections.wizard.phases.ConfigureConnectionSteps) NameConnectionSteps(io.syndesis.qe.steps.connections.wizard.phases.NameConnectionSteps) ElementsCollection(com.codeborne.selenide.ElementsCollection) List(java.util.List) ArrayList(java.util.ArrayList) TimeoutException(java.util.concurrent.TimeoutException) Given(io.cucumber.java.en.Given)

Example 10 with Account

use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.

the class CommonSteps method fillAndValidateConcur.

private void fillAndValidateConcur() {
    Account account = AccountsDirectory.getInstance().get(Account.Name.CONCUR);
    $$(By.tagName("input")).stream().filter(e -> e.getAttribute("name").equalsIgnoreCase("type") && e.getAttribute("value").equalsIgnoreCase("username")).findFirst().get().click();
    $(By.id("userid")).shouldBe(visible).sendKeys(account.getProperty("userId"));
    $(By.xpath(".//*[@type='submit']")).shouldBe(visible).click();
    TestUtils.sleepForJenkinsDelayIfHigher(3);
    $(By.id("password")).shouldBe(visible).sendKeys(account.getProperty("password"));
    $(By.xpath(".//*[@type='submit']")).shouldBe(visible).click();
}
Also used : SyndesisRootPage(io.syndesis.qe.pages.SyndesisRootPage) ModalDialogPage(io.syndesis.qe.pages.ModalDialogPage) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Autowired(org.springframework.beans.factory.annotation.Autowired) TimeoutException(java.util.concurrent.TimeoutException) Form(io.syndesis.qe.fragments.common.form.Form) CustomWebDriverProvider(io.syndesis.qe.CustomWebDriverProvider) JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) JSONObject(org.json.JSONObject) Map(java.util.Map) ByUtils(io.syndesis.qe.utils.ByUtils) OpenShiftWaitUtils.waitFor(io.syndesis.qe.wait.OpenShiftWaitUtils.waitFor) ConfigureConnectionSteps(io.syndesis.qe.steps.connections.wizard.phases.ConfigureConnectionSteps) CalendarUtils(io.syndesis.qe.utils.CalendarUtils) Syndesis(io.syndesis.qe.resource.impl.Syndesis) Condition(com.codeborne.selenide.Condition) TestConfiguration(io.syndesis.qe.TestConfiguration) AccountsDirectory(io.syndesis.qe.account.AccountsDirectory) UIUtils(io.syndesis.qe.utils.UIUtils) Condition.exactText(com.codeborne.selenide.Condition.exactText) Condition.visible(com.codeborne.selenide.Condition.visible) Condition.hidden(com.codeborne.selenide.Condition.hidden) SelectConnectionTypeSteps(io.syndesis.qe.steps.connections.wizard.phases.SelectConnectionTypeSteps) Selenide(com.codeborne.selenide.Selenide) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) Assertions.fail(org.assertj.core.api.Assertions.fail) Condition.enabled(com.codeborne.selenide.Condition.enabled) ResourceFactory(io.syndesis.qe.resource.ResourceFactory) MapEntry.entry(org.assertj.core.data.MapEntry.entry) OpenShiftWaitUtils(io.syndesis.qe.wait.OpenShiftWaitUtils) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) KeyCloakLogin(io.syndesis.qe.pages.login.KeyCloakLogin) Selenide.$$(com.codeborne.selenide.Selenide.$$) Then(io.cucumber.java.en.Then) Connections(io.syndesis.qe.pages.connections.Connections) WebDriver(org.openqa.selenium.WebDriver) WebDriverException(org.openqa.selenium.WebDriverException) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) Condition.text(com.codeborne.selenide.Condition.text) ArrayList(java.util.ArrayList) Condition.attribute(com.codeborne.selenide.Condition.attribute) PortForwardUtils(io.syndesis.qe.utils.PortForwardUtils) GoogleAccount(io.syndesis.qe.utils.google.GoogleAccount) Calendar(java.util.Calendar) Given(io.cucumber.java.en.Given) GitHubLogin(io.syndesis.qe.pages.login.GitHubLogin) ElementNotFound(com.codeborne.selenide.ex.ElementNotFound) ExcludeFromSelectorReports(io.syndesis.qe.report.selector.ExcludeFromSelectorReports) CollectionCondition(com.codeborne.selenide.CollectionCondition) ElementsCollection(com.codeborne.selenide.ElementsCollection) DataTable(io.cucumber.datatable.DataTable) RHDevLogin(io.syndesis.qe.pages.login.RHDevLogin) Dimension(org.openqa.selenium.Dimension) WebDriverRunner(com.codeborne.selenide.WebDriverRunner) Files(java.nio.file.Files) When(io.cucumber.java.en.When) By(org.openqa.selenium.By) NameConnectionSteps(io.syndesis.qe.steps.connections.wizard.phases.NameConnectionSteps) Alert(io.syndesis.qe.utils.Alert) IOException(java.io.IOException) OpenShiftUtils(io.syndesis.qe.utils.OpenShiftUtils) Account(io.syndesis.qe.account.Account) File(java.io.File) SelenideElement(com.codeborne.selenide.SelenideElement) GoogleAccounts(io.syndesis.qe.utils.google.GoogleAccounts) Selenide.$(com.codeborne.selenide.Selenide.$) TestUtils(io.syndesis.qe.utils.TestUtils) Condition.matchText(com.codeborne.selenide.Condition.matchText) Paths(java.nio.file.Paths) SyndesisPage(io.syndesis.qe.pages.SyndesisPage) MinishiftLogin(io.syndesis.qe.pages.login.MinishiftLogin) GoogleAccount(io.syndesis.qe.utils.google.GoogleAccount) Account(io.syndesis.qe.account.Account)

Aggregations

Account (io.syndesis.qe.account.Account)51 HashMap (java.util.HashMap)21 GoogleAccount (io.syndesis.qe.utils.google.GoogleAccount)10 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)9 Then (io.cucumber.java.en.Then)6 When (io.cucumber.java.en.When)6 Given (io.cucumber.java.en.Given)5 ArrayList (java.util.ArrayList)5 TimeoutException (java.util.concurrent.TimeoutException)5 List (java.util.List)4 ElementsCollection (com.codeborne.selenide.ElementsCollection)3 Form (io.syndesis.qe.fragments.common.form.Form)3 AsynchronousJiraRestClientFactory (com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory)2 SelenideElement (com.codeborne.selenide.SelenideElement)2 ElementNotFound (com.codeborne.selenide.ex.ElementNotFound)2 DataTable (io.cucumber.datatable.DataTable)2 ContainerPort (io.fabric8.kubernetes.api.model.ContainerPort)2 ContainerPortBuilder (io.fabric8.kubernetes.api.model.ContainerPortBuilder)2 EnvVar (io.fabric8.kubernetes.api.model.EnvVar)2 ServicePortBuilder (io.fabric8.kubernetes.api.model.ServicePortBuilder)2