Search in sources :

Example 41 with Account

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

the class GMailSteps method checkMailsFromCredentials.

@Then("^check that email from credenitals \"([^\"]*)\" with subject \"([^\"]*)\" and text \"([^\"]*)\" exists")
public void checkMailsFromCredentials(String credentials, String subject, String text) {
    Account account = AccountsDirectory.getInstance().get(credentials);
    String username = account.getProperty("username");
    TestUtils.waitFor(() -> checkMailExists(username, subject, text), 1, 60, "Could not find specified mail");
}
Also used : Account(io.syndesis.qe.account.Account) GoogleAccount(io.syndesis.qe.utils.google.GoogleAccount) Then(io.cucumber.java.en.Then)

Example 42 with Account

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

the class GMailSteps method sendEmailToCreds.

@When("^.*send an e-mail to credentials \"([^\"]*)\" with subject \"([^\"]*)\"$")
public void sendEmailToCreds(String credentials, String subject) {
    Account account = AccountsDirectory.getInstance().get(credentials);
    sendEmail(account.getProperty("username"), subject);
}
Also used : Account(io.syndesis.qe.account.Account) GoogleAccount(io.syndesis.qe.utils.google.GoogleAccount) When(io.cucumber.java.en.When)

Example 43 with Account

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

the class KafkaSteps method extractBrokerCertificate.

@Then("extract broker certificate")
public void extractBrokerCertificate() {
    // 1. get string with values: (oc get secret my-cluster-kafka-brokers -o yaml > sec.log)
    Secret secret = OpenShiftUtils.getInstance().getSecret("my-cluster-kafka-brokers");
    String secrets = secret.toString();
    // 2. extract values:
    String cert = extractValue("crt", secrets);
    // 3. put values into account:
    Account kafkaTlsAccount = AccountsDirectory.getInstance().get("kafka-autodetect-tls");
    Map<String, String> kafkaAutodetectTlsParameters = kafkaTlsAccount.getProperties();
    kafkaAutodetectTlsParameters.put("brokercertificate", cert);
    kafkaTlsAccount.setProperties(kafkaAutodetectTlsParameters);
}
Also used : Secret(io.fabric8.kubernetes.api.model.Secret) Account(io.syndesis.qe.account.Account) Then(io.cucumber.java.en.Then)

Example 44 with Account

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

the class KafkaSteps method createdKafkaConnectionUsingAMQStreamsAutoDetection.

// this method is preliminary, since auto-detection dropdown doesn't have data-testid yet and
// thus does not fit ...fillConnectionDetails(...) method of CommonSteps.createConnections()
@Given("created Kafka connection using AMQ streams auto detection using \"([^\"]*)\" security$")
public void createdKafkaConnectionUsingAMQStreamsAutoDetection(String securityMode, DataTable connectionsData) {
    final List<List<String>> dataTable = connectionsData.cells();
    final List<String> dataRow = dataTable.get(0);
    String connectionType = dataRow.get(0);
    String connectionName = dataRow.get(2);
    String description = dataRow.get(3);
    Account kafkaAccount = AccountsDirectory.getInstance().get("kafka-autodetect-" + securityMode.toLowerCase());
    commonSteps.navigateTo("Connections");
    commonSteps.validatePage("Connections");
    ElementsCollection connections = connectionsPage.getAllConnections();
    connections = connections.filter(exactText(connectionName));
    assertThat(connections.isEmpty()).isTrue();
    commonSteps.clickOnLink("Create Connection");
    TestUtils.sleepIgnoreInterrupt(TestConfiguration.getJenkinsDelay() * 1000);
    selectConnectionTypeSteps.selectConnectionType(connectionType);
    // select autodiscovered broker url:
    commonSteps.clickOnButtonByCssClassName("pf-c-select__toggle-button");
    commonSteps.clickOnButton(kafkaAccount.getProperty("brokers"));
    commonSteps.selectsFromDropdown(kafkaAccount.getProperty("transportprotocol"), "transportprotocol");
    if ("TLS".equals(securityMode)) {
        $(ByUtils.dataTestId("brokercertificate")).shouldBe(visible).sendKeys(kafkaAccount.getProperty("brokercertificate"));
    }
    commonSteps.clickOnButton("Validate");
    commonSteps.successNotificationIsPresentWithError(connectionType + " has been successfully validated", "success");
    commonSteps.scrollTo("top", "right");
    commonSteps.clickOnButton("Next");
    // next page:
    nameConnectionSteps.setConnectionName(connectionName);
    nameConnectionSteps.setConnectionDescription(description);
    commonSteps.clickOnButton("Save");
}
Also used : Account(io.syndesis.qe.account.Account) ElementsCollection(com.codeborne.selenide.ElementsCollection) List(java.util.List) Given(io.cucumber.java.en.Given)

Example 45 with Account

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

the class ODataSteps method resetODataV2Service.

@Then("^.*reset OData v2 service$")
public void resetODataV2Service() throws IOException {
    log.info("Reseting odata service by getting new user token");
    OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();
    Response response = client.newCall(new Request.Builder().url(ODataUtils.getV2ResetUrl()).get().build()).execute();
    assertThat(response.code()).isEqualTo(302);
    String location = response.headers().get("Location");
    if (location != null) {
        String newUrl = ODataUtils.getV2BaseUrl() + location;
        Account a = AccountsDirectory.getInstance().get("odata V2");
        Map<String, String> properties = Collections.singletonMap("serviceUri", newUrl);
        a.setProperties(properties);
        log.info("new OData V2 URL is {}", newUrl);
    }
    response.close();
}
Also used : HTTPResponse(io.syndesis.qe.utils.http.HTTPResponse) Response(okhttp3.Response) Account(io.syndesis.qe.account.Account) OkHttpClient(okhttp3.OkHttpClient) Request(okhttp3.Request) Then(io.cucumber.java.en.Then)

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