use of io.cucumber.java.en.Given in project NoraUi by NoraUi.
the class HelloByeSteps method readBlog.
@RetryOnFailure(attempts = 3)
@Given("me any article, please. {string} of {string}.")
public void readBlog(String jsonArticles, String blog) throws FailureException {
Articles articles = new Articles();
articles.deserialize(jsonArticles);
for (Article article : articles) {
if ("anonymous".equals(article.getAuthor())) {
new Result.Failure<>("anonymous", "anonymous is prohibited in demo blog!!", true, this.demoPage.getCallBack());
} else {
log.info("> " + blog);
log.info(" > " + article.getTitle() + ": " + article.getText());
}
}
}
use of io.cucumber.java.en.Given in project apm-agent-java by elastic.
the class OutcomeStepsDefinitions method httpTransactionWithStatus.
@Given("a HTTP call is received that returns {int}")
public void httpTransactionWithStatus(int code) {
Transaction transaction = state.getTransaction();
transaction.withName(String.format("HTTP transaction status = %d", code));
transaction.withOutcome(ResultUtil.getOutcomeByHttpServerStatus(code));
}
use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.
the class WsCoreResponseDataSteps method aResponseDataRecord.
@Given("^a response data record in ws-core$")
@Transactional("txMgrWsCore")
public ResponseData aResponseDataRecord(final Map<String, String> settings) {
final ResponseData responseData = this.responseDataRepository.save(new ResponseDataBuilder().fromSettings(settings).build());
final Date creationTime = DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toDate();
LOGGER.info("Creating response data record with correlationUid: {} and creationTime: {}", responseData.getCorrelationUid(), creationTime);
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, responseData.getCorrelationUid());
try {
// (as it will be overridden on first save)
if (settings.containsKey(PlatformKeys.KEY_CREATION_TIME)) {
final Field fld = responseData.getClass().getSuperclass().getDeclaredField("creationTime");
fld.setAccessible(true);
fld.set(responseData, creationTime);
this.responseDataRepository.saveAndFlush(responseData);
LOGGER.info("Response data record saved with correlationUid: {} and creationTime: {}", responseData.getCorrelationUid(), creationTime);
}
} catch (final Exception e) {
LOGGER.error("Exception", e);
Assertions.fail("Failed to create response data record in ws-core.");
}
return responseData;
}
use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.
the class GetKeys method anApplicationKeyIsConfigured.
@Given("^an application key is configured$")
public void anApplicationKeyIsConfigured(final Map<String, String> settings) throws Throwable {
final ApplicationDataLookupKey applicationDataLookupKey = new ApplicationDataLookupKey(settings.get(PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION), this.applicationName);
final ApplicationKeyConfiguration applicationKeyConfiguration = new ApplicationKeyConfiguration(applicationDataLookupKey, "/etc/osp/smartmetering/keys/application/smartmetering-rsa-public.key");
this.applicationKeyConfigurationRepository.save(applicationKeyConfiguration);
}
use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.
the class GetDebugInformation method thereIsDebugInformationLoggedForTheDevice.
@Given("^there is debug information logged for the device$")
public void thereIsDebugInformationLoggedForTheDevice() throws Throwable {
final DeviceLogItem deviceLogItem = this.deviceLogItemBuilder.withDeviceIdentification(ScenarioContext.current().get(PlatformKeys.KEY_DEVICE_IDENTIFICATION).toString()).build();
this.logItemRepository.save(deviceLogItem);
}
Aggregations