Search in sources :

Example 96 with Given

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);
}
Also used : DeviceFirmwareFile(org.opensmartgridplatform.domain.core.entities.DeviceFirmwareFile) Device(org.opensmartgridplatform.domain.core.entities.Device) ReadSettingsHelper.getString(org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString) DeviceFirmwareFile(org.opensmartgridplatform.domain.core.entities.DeviceFirmwareFile) FirmwareFile(org.opensmartgridplatform.domain.core.entities.FirmwareFile) Date(java.util.Date) Given(io.cucumber.java.en.Given)

Example 97 with Given

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);
}
Also used : ScheduledTask(org.opensmartgridplatform.domain.core.entities.ScheduledTask) Given(io.cucumber.java.en.Given)

Example 98 with Given

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);
}
Also used : GetSpecificAttributeValueRequestBuilder(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.GetSpecificAttributeValueRequestBuilder) GetSpecificAttributeValueRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetSpecificAttributeValueRequest) Given(io.cucumber.java.en.Given)

Example 99 with Given

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);
}
Also used : SetKeysRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetKeysRequest) Given(io.cucumber.java.en.Given)

Example 100 with Given

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);
}
Also used : GenerateAndReplaceKeysRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GenerateAndReplaceKeysRequest) Given(io.cucumber.java.en.Given)

Aggregations

Given (io.cucumber.java.en.Given)125 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)27 ArrayList (java.util.ArrayList)11 Transactional (org.springframework.transaction.annotation.Transactional)11 Ssld (org.opensmartgridplatform.domain.core.entities.Ssld)8 Date (java.util.Date)7 DeviceOutputSetting (org.opensmartgridplatform.domain.core.entities.DeviceOutputSetting)6 ActivityCalendar (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.ActivityCalendar)5 Device (org.opensmartgridplatform.domain.core.entities.Device)5 RelayType (org.opensmartgridplatform.domain.core.valueobjects.RelayType)5 ByteString (com.google.protobuf.ByteString)4 Account (io.syndesis.qe.account.Account)4 File (java.io.File)4 List (java.util.List)4 ElementsCollection (com.codeborne.selenide.ElementsCollection)3 Field (java.lang.reflect.Field)3 HashMap (java.util.HashMap)3 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)3 ResponseDataBuilder (org.opensmartgridplatform.cucumber.platform.glue.steps.database.ws.ResponseDataBuilder)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2