Search in sources :

Example 26 with Account

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

the class OperatorValidationSteps method createPullSecretForBackup.

@When("create pull secret for backup")
public void createPullSecretForBackup() {
    Account aws = AccountsDirectory.getInstance().get(Account.Name.AWS);
    OpenShiftUtils.getInstance().createSecret(new SecretBuilder().withNewMetadata().withName(SYNDESIS_BACKUP_SECRET_NAME).endMetadata().withStringData(TestUtils.map("secret-key-id", aws.getProperty("accessKey"), "secret-access-key", aws.getProperty("secretKey"), "region", aws.getProperty("region").toLowerCase().replaceAll("_", "-"), "bucket-name", S3BucketNameBuilder.getBucketName(SYNDESIS_BACKUP_BUCKET_PREFIX))).build());
}
Also used : SecretBuilder(io.fabric8.kubernetes.api.model.SecretBuilder) Account(io.syndesis.qe.account.Account) When(io.cucumber.java.en.When)

Example 27 with Account

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

the class IssueHooksUtils method getGitHubClient.

private static GitHubClient getGitHubClient(Scenario scenario) {
    String oauthToken = "";
    Optional<Account> optional = AccountsDirectory.getInstance().getAccount(Account.Name.GITHUB);
    if (optional.isPresent()) {
        if (!optional.get().getProperties().containsKey("PersonalAccessToken")) {
            logError(scenario, "Account with name \"GitHub\" and property \"PersonalAccessToken\" is required in credentials.json file.");
            logError(scenario, "If you want to get known issues from github in logs in case of scenario fails, update your credentials.");
            return null;
        } else {
            oauthToken = optional.get().getProperty("PersonalAccessToken");
        }
    }
    GitHubClient client = new GitHubClient();
    client.setOAuth2Token(oauthToken);
    return client;
}
Also used : Account(io.syndesis.qe.account.Account) GitHubClient(org.eclipse.egit.github.core.client.GitHubClient)

Example 28 with Account

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

the class HTTPEndpoints method addAccounts.

public void addAccounts() {
    Account http = new Account();
    Map<String, String> params = new HashMap<>();
    params.put("baseUrl", "http://http-svc:8080");
    http.setService("http");
    http.setProperties(params);
    AccountsDirectory.getInstance().getAccounts().put("http", http);
    Account https = new Account();
    params = new HashMap<>();
    params.put("baseUrl", "https://https-svc:8443");
    https.setService("https");
    https.setProperties(params);
    AccountsDirectory.getInstance().getAccounts().put("https", https);
}
Also used : Account(io.syndesis.qe.account.Account) HashMap(java.util.HashMap) IntOrString(io.fabric8.kubernetes.api.model.IntOrString)

Example 29 with Account

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

the class MySQL method deploy.

@Override
public void deploy() {
    List<ContainerPort> ports = new LinkedList<>();
    ports.add(new ContainerPortBuilder().withName("mysql-cmd").withContainerPort(3306).withProtocol("TCP").build());
    List<EnvVar> templateParams = new ArrayList<>();
    templateParams.add(new EnvVar("MYSQL_USER", DB_USER, null));
    templateParams.add(new EnvVar("MYSQL_PASSWORD", DB_PASSWORD, null));
    templateParams.add(new EnvVar("MYSQL_DATABASE", DB_SCHEMA, null));
    OpenShiftUtils.getInstance().deploymentConfigs().createOrReplaceWithNew().editOrNewMetadata().withName(APP_NAME).addToLabels(LABEL_NAME, APP_NAME).endMetadata().editOrNewSpec().addToSelector(LABEL_NAME, APP_NAME).withReplicas(1).editOrNewTemplate().editOrNewMetadata().addToLabels(LABEL_NAME, APP_NAME).endMetadata().editOrNewSpec().addNewContainer().withName(APP_NAME).withImage("quay.io/syndesis_qe/mysql-57-centos7").addAllToPorts(ports).addAllToEnv(templateParams).endContainer().endSpec().endTemplate().addNewTrigger().withType("ConfigChange").endTrigger().endSpec().done();
    ServiceSpecBuilder serviceSpecBuilder = new ServiceSpecBuilder().addToSelector(LABEL_NAME, APP_NAME);
    serviceSpecBuilder.addToPorts(new ServicePortBuilder().withName("mysql-cmd").withPort(3306).withTargetPort(new IntOrString(3306)).build());
    OpenShiftUtils.getInstance().services().createOrReplaceWithNew().editOrNewMetadata().withName(APP_NAME).addToLabels(LABEL_NAME, APP_NAME).endMetadata().editOrNewSpecLike(serviceSpecBuilder.build()).endSpec().done();
    try {
        OpenShiftWaitUtils.waitFor(OpenShiftWaitUtils.areExactlyNPodsReady(LABEL_NAME, APP_NAME, 1));
        Thread.sleep(20 * 1000);
    } catch (InterruptedException | TimeoutException e) {
        log.error("Wait for {} deployment failed ", APP_NAME, e);
    }
    Account mysqlAccount = new Account();
    mysqlAccount.setService("mysql");
    Map<String, String> accountParameters = new HashMap<>();
    accountParameters.put("url", DB_URL);
    accountParameters.put("user", DB_USER);
    accountParameters.put("password", DB_PASSWORD);
    accountParameters.put("schema", DB_SCHEMA);
    mysqlAccount.setProperties(accountParameters);
    AccountsDirectory.getInstance().addAccount("mysql", mysqlAccount);
}
Also used : Account(io.syndesis.qe.account.Account) HashMap(java.util.HashMap) IntOrString(io.fabric8.kubernetes.api.model.IntOrString) ArrayList(java.util.ArrayList) IntOrString(io.fabric8.kubernetes.api.model.IntOrString) LinkedList(java.util.LinkedList) ServiceSpecBuilder(io.fabric8.kubernetes.api.model.ServiceSpecBuilder) ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) ContainerPortBuilder(io.fabric8.kubernetes.api.model.ContainerPortBuilder) ContainerPort(io.fabric8.kubernetes.api.model.ContainerPort) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) TimeoutException(java.util.concurrent.TimeoutException)

Example 30 with Account

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

the class SFTP 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));
    appName = properties.get("host");
    sftpPort = Integer.parseInt(properties.get("port"));
    userAndPassword = properties.get("username") + ":" + properties.get("password") + ":1500::" + TEST_DIRECTORY;
}
Also used : Account(io.syndesis.qe.account.Account) HashMap(java.util.HashMap) IntOrString(io.fabric8.kubernetes.api.model.IntOrString)

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