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