use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.
the class DeviceFirmwareFileSteps method aDeviceFirmware.
/**
* Generic method which adds a device firmware using the settings.
*
* @param settings The settings for the device to be used.
*/
@Given("^a device firmware$")
public void aDeviceFirmware(final Map<String, String> settings) {
// Get the device
final Device device = this.deviceRepository.findByDeviceIdentification(getString(settings, PlatformKeys.KEY_DEVICE_IDENTIFICATION, PlatformDefaults.DEFAULT_DEVICE_IDENTIFICATION));
// Get the firmware file
final FirmwareFile firmwareFile = this.getFirmwareFile(getString(settings, PlatformKeys.FIRMWARE_FILE_FILENAME));
final Date installationDate = getDateTime2(getString(settings, PlatformKeys.FIRMWARE_INSTALLATION_DATE), DateTime.now()).toDate();
final String installedBy = getString(settings, PlatformKeys.FIRMWARE_INSTALLED_BY, PlatformDefaults.FIRMWARE_INSTALLED_BY);
final DeviceFirmwareFile deviceFirmwareFile = new DeviceFirmwareFile(device, firmwareFile, installationDate, installedBy);
this.deviceFirmwareFileRepository.save(deviceFirmwareFile);
}
use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.
the class ScheduledTaskSteps method givenAScheduledTask.
@Given("a scheduled {string} task")
public void givenAScheduledTask(final String messageType, final Map<String, String> settings) {
final ScheduledTask scheduledTask = SCHEDULED_TASK_CREATOR_MAP.get(messageType).apply(settings);
this.scheduledTaskRepository.save(scheduledTask);
}
use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.
the class BundledGetSpecificAttributeValueSteps method theBundleRequestContainsAGetSpecificAttributeValueAction.
@Given("^the bundle request contains a get specific attribute value action with parameters$")
public void theBundleRequestContainsAGetSpecificAttributeValueAction(final Map<String, String> parameters) throws Throwable {
final GetSpecificAttributeValueRequest action = new GetSpecificAttributeValueRequestBuilder().fromParameterMap(parameters).build();
this.addActionToBundleRequest(action);
}
use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.
the class BundledReplaceKeySteps method theBundleRequestContainsASetClockConfigurationAction.
@Given("^the bundle request contains a replace keys action$")
public void theBundleRequestContainsASetClockConfigurationAction(final Map<String, String> settings) throws Throwable {
final SetKeysRequest action = this.mapperFacade.map(SetKeysRequestDataFactory.fromParameterMap(settings), SetKeysRequest.class);
this.addActionToBundleRequest(action);
}
use of io.cucumber.java.en.Given in project open-smart-grid-platform by OSGP.
the class BundledReplaceKeySteps method theBundleRequestContainsAGenerateAndReplaceKeysAction.
@Given("the bundle request contains a generate and replace keys action")
public void theBundleRequestContainsAGenerateAndReplaceKeysAction() {
final GenerateAndReplaceKeysRequest action = new GenerateAndReplaceKeysRequest();
this.addActionToBundleRequest(action);
}
Aggregations