use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class ActivitySteps method checkAllTimeOfStep.
/**
* Check that time in step is between start and end time of request
*
* @param indexActivity from 1 , first activity = 1
*/
@Then("^check that all steps in the (\\w+). activity has valid time with (\\w+) second accuracy$")
public void checkAllTimeOfStep(int indexActivity, int accuracy) throws ParseException {
int numberOfRow = activityTab.getActivityLogRows(indexActivity - 1).size();
for (int indexRow = 0; indexRow < numberOfRow; indexRow++) {
String timeLabel = activityTab.getColumnInRowInActivityLog(indexActivity - 1, indexRow, Activity.COLUMN.TIME);
assertThat(timeLabel).matches("^\\d{1,2}/\\d{1,2}/\\d{4}, \\d{1,2}:\\d{1,2}:\\d{2} (AM|PM)$");
Date dateOfStep = new SimpleDateFormat("MM/dd/yyyy, hh:mm:ss a").parse(timeLabel);
checkDateIsMiddle(dateOfStep, accuracy);
}
}
use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class ActivitySteps method checkDateAndTime.
/**
* Check that activity date and time is between start and end time of request
*
* @param index from 1 , first activity = 1
*/
@Then("^check that (\\w+). activity date and time is valid with (\\w+) second accuracy$")
public void checkDateAndTime(int index, int accuracy) throws ParseException {
refresh();
String timeLabel = activityTab.getActivityTime(index - 1);
String dateLabel = activityTab.getActivityDate(index - 1);
assertThat(timeLabel).matches("^\\d{1,2}:\\d{2}:\\d{2} (AM|PM)$");
assertThat(dateLabel).matches("^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$");
Date activityDate = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a").parse(dateLabel + " " + timeLabel);
checkDateIsMiddle(activityDate, accuracy);
}
use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class MetricsSteps method checkLastProcessed.
/**
* Check that last processed is valid and it is between start and end time of request
*/
@Then("^check that last processed date is valid$")
public void checkLastProcessed() throws ParseException {
refresh();
String dateLabel = metricsTab.getLastProcessed();
if (metricsTab.getNumberOfTotalMessages() == 0) {
assertThat(dateLabel).matches("^No Data Available$");
return;
}
assertThat(dateLabel).matches("^\\d{1,2}/\\d{1,2}/\\d{4}, \\d{1,2}:\\d{2}:\\d{2} (AM|PM)$");
Date dateWhenProcessed = new SimpleDateFormat("MM/dd/yyyy, hh:mm:ss a").parse(dateLabel);
Calendar processedCalendar = Calendar.getInstance();
processedCalendar.setTime(dateWhenProcessed);
/*clear milliseconds because UI last processed label contains only minutes and seconds*/
Calendar beforeRequest = calendarUtils.getLastBeforeRequest();
beforeRequest.clear(Calendar.MILLISECOND);
Calendar afterRequest = calendarUtils.getLastAfterRequest();
afterRequest.clear(Calendar.MILLISECOND);
// 5sec accuracy
beforeRequest.add(Calendar.SECOND, -5);
afterRequest.add(Calendar.SECOND, +5);
SimpleDateFormat outFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (!processedCalendar.equals(beforeRequest)) {
// if not same then it tests whether it was after
assertThat(processedCalendar.after(beforeRequest)).as("Check that processed date and time \"%s\" is after %s", outFormat.format(processedCalendar.getTime()), outFormat.format(beforeRequest.getTime())).isTrue();
}
if (!processedCalendar.equals(afterRequest)) {
// if not same then it tests whether it was before
assertThat(processedCalendar.before(afterRequest)).as("Check that processed date and time \"%s\" is before %s", outFormat.format(processedCalendar.getTime()), outFormat.format(afterRequest.getTime())).isTrue();
}
}
use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class CommonValidationSteps method verifyWarningOnIntegration.
@Then("check that integration {word} contains warning {string}")
public void verifyWarningOnIntegration(String integrationName, String warning) {
IntegrationOverview overview = integrationOverviewEndpoint.getOverview(integrationsEndpoint.getIntegrationId(integrationName).get());
Assertions.assertThat(integrationOverviewEndpoint.getOverview(integrationsEndpoint.getIntegrationId(integrationName).get()).getBoard().getWarnings().getAsInt()).isGreaterThan(0);
Assertions.assertThat(overview.getBoard().getMessages().stream().filter(leveledMessage -> leveledMessage.getDetail().get().contains(warning)).findFirst()).isNotEmpty();
}
use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.
the class FhirValidationSteps method validateThatLastBasicsLanguageHasBeenChangedInFHIR.
@Then("validate that last inserted basics language has been changed to {string} in FHIR")
public void validateThatLastBasicsLanguageHasBeenChangedInFHIR(String lang) {
MyBasicSpecification newBs = new MyBasicSpecification(lang);
newBs.setId(fhirUtils.getLastBasicId());
assertThat(fhirUtils.isBasicInFhir(newBs)).isTrue();
}
Aggregations