use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class IntegrationSteps method waitForIntegrationState.
/*
* State != starting state
* State is state of integration. e.g. "Running", "Stopped"
*/
@Then("^wait until integration \"([^\"]*)\" gets into \"([^\"]*)\" state$")
public void waitForIntegrationState(String integrationName, String integrationStatus) {
commonSteps.navigateTo("Integrations");
SelenideElement integration = integrations.getIntegration(integrationName);
TestUtils.sleepForJenkinsDelayIfHigher(10);
if ("camelk".equalsIgnoreCase(TestConfiguration.syndesisRuntime())) {
ResourceFactory.get(CamelK.class).waitForContextToBuild(integrationName);
Selenide.refresh();
log.info("Integration platform status: {}", OpenShiftUtils.binary().execute("get", "integrationplatforms", "-o yaml"));
}
assertThat(TestUtils.waitForEvent(status -> status.contains(integrationStatus), () -> integrations.getIntegrationItemStatus(integrationName), TimeUnit.MINUTES, 10, TimeUnit.SECONDS, 20)).isTrue();
}
use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class OperatorValidationSteps method checkDbPvCapacity.
@Then("check that {string} persistent volume capacity is greater or equals to {string}")
public void checkDbPvCapacity(String pvc, String expected) {
try {
OpenShiftWaitUtils.waitFor(() -> OpenShiftUtils.getInstance().getPersistentVolumeClaim(pvc) != null);
OpenShiftWaitUtils.waitFor(() -> OpenShiftUtils.getInstance().getPersistentVolumeClaim(pvc).getStatus().getPhase().equals("Bound"));
} catch (TimeoutException | InterruptedException e) {
fail("Unable to get " + pvc + " pvc: ", e);
}
final Quantity capacity = OpenShiftUtils.getInstance().getPersistentVolumeClaim(pvc).getStatus().getCapacity().get("storage");
assertThat(capacity.getFormat()).isEqualTo("Gi");
assertThat(Integer.parseInt(capacity.getAmount())).isGreaterThanOrEqualTo(Integer.parseInt(expected.replaceAll("[a-zA-Z]", "")));
}
use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class OperatorValidationSteps method checkRepositories.
@Then("check repositories used in integration {string} build")
public void checkRepositories(String build, DataTable expectedRepositories) {
String log = OpenShiftUtils.getInstance().getBuildLog(OpenShiftUtils.getInstance().builds().list().getItems().stream().filter(b -> b.getMetadata().getName().contains(build)).findFirst().get());
Pattern regex = Pattern.compile(".*Downloading .*https:\\/\\/(.*)\\/org.*");
Set<String> downloads = Arrays.stream(log.split("\\n")).filter(line -> line.contains("Downloading ") && line.contains("camel-lzf")).map(line -> {
Matcher matcher = regex.matcher(line);
if (matcher.find()) {
return matcher.group(1);
} else {
fail("Unable to parse line: " + line);
return "";
}
}).collect(Collectors.toSet());
SoftAssertions asserts = new SoftAssertions();
for (String repository : expectedRepositories.asList()) {
String repo = StringUtils.substringAfter(repository, "https://");
asserts.assertThat(downloads).contains(repo);
downloads.remove(repo);
}
asserts.assertThat(downloads).as("The artifact shouldn't be downloaded from other repositories than defined").isEmpty();
asserts.assertAll();
}
use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class ConditionalFlowSteps method validateConditionalFlowDropdown.
@Then("^validate conditional flow dropdown content$")
public void validateConditionalFlowDropdown(DataTable data) {
openDropdownWithConditions();
ElementsCollection dropdownElements = $$(EditFlowStepElements.FLOW_DROPDOWN_ITEM);
int current = 0;
for (List<String> row : data.cells()) {
assertThat(dropdownElements.get(current).getText().replaceAll("\n", " ")).isEqualToIgnoringCase(row.get(0));
current++;
}
}
use of io.cucumber.java.en.Then 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");
}
Aggregations