Search in sources :

Example 66 with Given

use of io.cucumber.java.en.Given in project syndesis-qe by syndesisio.

the class Connections method createConnection.

@Given("create connection")
public void createConnection(DataTable connectionProperties) {
    List<List<String>> cells = connectionProperties.cells();
    Map<String, String> connectionPropertiesMap = new HashMap<>();
    for (List<String> cell : cells) {
        connectionPropertiesMap.put(cell.get(0), cell.get(1));
    }
    final String connectorName = connectionPropertiesMap.get("connector").toUpperCase();
    final String connectorId = RestTestsUtils.Connector.valueOf(connectorName).getId();
    final String connectionId = connectionPropertiesMap.get("connectionId");
    final String connectionName = connectionPropertiesMap.get("name");
    final Connector connector = connectorsEndpoint.get(connectorId);
    connectionPropertiesMap.remove("connector");
    connectionPropertiesMap.remove("connectionId");
    connectionPropertiesMap.remove("account");
    connectionPropertiesMap.remove("name");
    for (Map.Entry<String, String> keyValue : connectionPropertiesMap.entrySet()) {
        if ("$ACCOUNT$".equals(keyValue.getValue())) {
            keyValue.setValue(accountsDirectory.get(connectionPropertiesMap.get("account")).getProperty(keyValue.getKey()));
        }
    }
    final Connection connection = new Connection.Builder().connector(connector).connectorId(getConnectorId(connector)).id(connectionId != null ? connectionId : RestTestsUtils.Connection.valueOf(connectorName).getId()).name(connectionName != null ? connectionName : "Fuse QE " + connectorName).configuredProperties(connectionPropertiesMap).icon(connector.getIcon()).tags(Collections.singletonList(connectorId)).build();
    log.info("Creating {} connection with properties {}", connectorId, connectionPropertiesMap);
    connectionsEndpoint.create(connection);
}
Also used : Connector(io.syndesis.common.model.connection.Connector) HashMap(java.util.HashMap) S3BucketNameBuilder(io.syndesis.qe.utils.aws.S3BucketNameBuilder) Connection(io.syndesis.common.model.connection.Connection) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) Given(io.cucumber.java.en.Given)

Example 67 with Given

use of io.cucumber.java.en.Given in project syndesis-qe by syndesisio.

the class ExtensionHandler method importExtensionsFromSyndesisExtensionsFolder.

@Given("import extensions from syndesis-extensions folder through API")
public void importExtensionsFromSyndesisExtensionsFolder(DataTable properties) {
    List<String> extensions = properties.asList(String.class);
    for (String ext : extensions) {
        String defaultPath = "../syndesis-extensions/" + ext + "/target/";
        File[] files = new File(defaultPath).listFiles((dir, name) -> !name.contains("original") && name.endsWith(".jar"));
        assertThat(files).hasSize(1).doesNotContainNull();
        importExtensionFromPath(files[0].getAbsolutePath());
    }
}
Also used : File(java.io.File) Given(io.cucumber.java.en.Given)

Example 68 with Given

use of io.cucumber.java.en.Given in project syndesis-qe by syndesisio.

the class JiraSteps method createNewIssue.

@Given("create a new jira issue in project \"([^\"]*)\"")
public void createNewIssue(String project) {
    IssueInputBuilder issueBuilder = new IssueInputBuilder("MTP", BUG_ISSUE_TYPE);
    issueBuilder.setSummary("test issue");
    issueBuilder.setDescription("this is the test issue");
    BasicIssue result = jiraRestClient.getIssueClient().createIssue(issueBuilder.build()).claim();
    sharedIssueKey = result.getKey();
}
Also used : BasicIssue(com.atlassian.jira.rest.client.api.domain.BasicIssue) IssueInputBuilder(com.atlassian.jira.rest.client.api.domain.input.IssueInputBuilder) Given(io.cucumber.java.en.Given)

Example 69 with Given

use of io.cucumber.java.en.Given 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 70 with Given

use of io.cucumber.java.en.Given in project grakn by graknlabs.

the class TypeQLSteps method typeql_update.

@Given("typeql update")
public void typeql_update(String updateQueryStatements) {
    TypeQLUpdate typeQLQuery = TypeQL.parseQuery(String.join("\n", updateQueryStatements)).asUpdate();
    tx().query().update(typeQLQuery);
}
Also used : TypeQLUpdate(com.vaticle.typeql.lang.query.TypeQLUpdate) Given(io.cucumber.java.en.Given)

Aggregations

Given (io.cucumber.java.en.Given)125 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)27 ArrayList (java.util.ArrayList)11 Transactional (org.springframework.transaction.annotation.Transactional)11 Ssld (org.opensmartgridplatform.domain.core.entities.Ssld)8 Date (java.util.Date)7 DeviceOutputSetting (org.opensmartgridplatform.domain.core.entities.DeviceOutputSetting)6 ActivityCalendar (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar)5 Device (org.opensmartgridplatform.domain.core.entities.Device)5 RelayType (org.opensmartgridplatform.domain.core.valueobjects.RelayType)5 ByteString (com.google.protobuf.ByteString)4 Account (io.syndesis.qe.account.Account)4 File (java.io.File)4 List (java.util.List)4 ElementsCollection (com.codeborne.selenide.ElementsCollection)3 Field (java.lang.reflect.Field)3 HashMap (java.util.HashMap)3 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)3 ResponseDataBuilder (org.opensmartgridplatform.cucumber.platform.glue.steps.database.ws.ResponseDataBuilder)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2