use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.LightMeasurementDevice in project open-smart-grid-platform by OSGP.
the class CreateLightMeasurementDeviceSteps method createLightMeasurementDevice.
private LightMeasurementDevice createLightMeasurementDevice(final Map<String, String> settings) {
final LightMeasurementDevice lmd = new LightMeasurementDevice();
lmd.setAlias(getString(settings, PlatformKeys.ALIAS, PlatformCommonDefaults.DEFAULT_ALIAS));
lmd.setContainerAddress(new AddressBuilder().withSettings(settings).build());
lmd.setDeviceIdentification(getString(settings, PlatformKeys.KEY_DEVICE_IDENTIFICATION, PlatformCommonDefaults.DEFAULT_DEVICE_IDENTIFICATION));
final DeviceModel deviceModel = new DeviceModel();
deviceModel.setManufacturer(getString(settings, PlatformKeys.KEY_DEVICE_MODEL_MANUFACTURER, PlatformCommonDefaults.DEFAULT_DEVICE_MODEL_MANUFACTURER));
deviceModel.setModelCode(getString(settings, PlatformKeys.KEY_DEVICE_MODEL_MODELCODE, PlatformCommonDefaults.DEFAULT_DEVICE_MODEL_MODEL_CODE));
lmd.setDeviceModel(deviceModel);
lmd.setGpsLatitude(getFloat(settings, PlatformKeys.KEY_LATITUDE, PlatformCommonDefaults.DEFAULT_LATITUDE));
lmd.setGpsLongitude(getFloat(settings, PlatformKeys.KEY_LONGITUDE, PlatformCommonDefaults.DEFAULT_LONGITUDE));
lmd.setOwner(getString(settings, PlatformKeys.KEY_OWNER, PlatformCommonDefaults.DEFAULT_OWNER));
lmd.setActivated(getBoolean(settings, PlatformKeys.KEY_ACTIVATED, PlatformCommonDefaults.DEFAULT_ACTIVATED));
lmd.setDescription(getString(settings, PlatformKeys.KEY_LMD_DESCRIPTION, PlatformCommonDefaults.DEFAULT_LMD_DESCRIPTION));
lmd.setCode(getString(settings, PlatformKeys.KEY_LMD_CODE, PlatformCommonDefaults.DEFAULT_LMD_CODE));
lmd.setColor(getString(settings, PlatformKeys.KEY_LMD_COLOR, PlatformCommonDefaults.DEFAULT_LMD_COLOR));
lmd.setDigitalInput(getShort(settings, PlatformKeys.KEY_LMD_DIGITAL_INPUT, PlatformCommonDefaults.DEFAULT_LMD_DIGITAL_INPUT));
return lmd;
}
use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.LightMeasurementDevice in project open-smart-grid-platform by OSGP.
the class CreateLightMeasurementDeviceSteps method receivingAnAddLightMeasurementDeviceRequest.
@When("^receiving an add light measurement device request$")
public void receivingAnAddLightMeasurementDeviceRequest(final Map<String, String> settings) {
final AddLightMeasurementDeviceRequest request = new AddLightMeasurementDeviceRequest();
final LightMeasurementDevice lmd = this.createLightMeasurementDevice(settings);
request.setLightMeasurementDevice(lmd);
try {
ScenarioContext.current().put(PlatformKeys.RESPONSE, this.client.addLightMeasurementDevice(request));
} catch (final Exception ex) {
ScenarioContext.current().put(PlatformKeys.RESPONSE, ex);
}
}
use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.LightMeasurementDevice in project open-smart-grid-platform by OSGP.
the class CreateLightMeasurementDeviceSteps method receivingAnUpdateLightMeasurementDeviceRequest.
@When("^receiving an update light measurement device request$")
public void receivingAnUpdateLightMeasurementDeviceRequest(final Map<String, String> settings) {
final UpdateLightMeasurementDeviceRequest request = new UpdateLightMeasurementDeviceRequest();
final String deviceIdentification = getString(settings, PlatformKeys.KEY_DEVICE_IDENTIFICATION, PlatformCommonDefaults.DEFAULT_DEVICE_IDENTIFICATION);
request.setDeviceIdentification(deviceIdentification);
final LightMeasurementDevice lmd = this.createLightMeasurementDevice(settings);
request.setUpdatedLightMeasurementDevice(lmd);
try {
ScenarioContext.current().put(PlatformKeys.RESPONSE, this.client.updateLightMeasurementDevice(request));
} catch (final Exception ex) {
ScenarioContext.current().put(PlatformKeys.RESPONSE, ex);
}
}
use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.LightMeasurementDevice in project open-smart-grid-platform by OSGP.
the class DeviceInstallationMapperTest method testConversionFromWsLmdToLmd.
@Test
public void testConversionFromWsLmdToLmd() {
// Arrange
final LightMeasurementDevice lmd = this.createWsLmd();
final org.opensmartgridplatform.domain.core.entities.LightMeasurementDevice expected = this.createLmd();
// Act
final org.opensmartgridplatform.domain.core.entities.LightMeasurementDevice actual = this.mapper.map(lmd, org.opensmartgridplatform.domain.core.entities.LightMeasurementDevice.class);
// Assert
assertThat(actual).isEqualToIgnoringGivenFields(expected, "creationTime", "modificationTime");
}
use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.LightMeasurementDevice in project open-smart-grid-platform by OSGP.
the class DeviceInstallationMapperTest method createWsLmd.
private LightMeasurementDevice createWsLmd() {
final LightMeasurementDevice lmd = new LightMeasurementDevice();
lmd.setDeviceIdentification(DEVICE_IDENTIFICATION);
lmd.setAlias(ALIAS);
lmd.setContainerAddress(this.createWsAddress());
lmd.setGpsLatitude(GPS_LATITUDE);
lmd.setGpsLongitude(GPS_LONGITUDE);
lmd.setDescription(DESCRIPTION);
lmd.setCode(CODE);
lmd.setColor(COLOR);
lmd.setDigitalInput(DIGITAL_INPUT);
return lmd;
}
Aggregations