use of org.opensmartgridplatform.domain.core.entities.Device in project open-smart-grid-platform by OSGP.
the class UpdateFirmware method theDatabaseShouldNotBeUpdatedWithTheNewDeviceFirmware.
@Then("^the database should not be updated with the new device firmware$")
public void theDatabaseShouldNotBeUpdatedWithTheNewDeviceFirmware(final Map<String, String> settings) throws Throwable {
final String deviceIdentification = getString(settings, PlatformKeys.KEY_DEVICE_IDENTIFICATION, PlatformDefaults.DEFAULT_SMART_METER_DEVICE_IDENTIFICATION);
final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification);
assertThat(device).as("Device " + deviceIdentification + " not found.").isNotNull();
final FirmwareFile activeFirmwareFile = device.getActiveFirmwareFile();
if (activeFirmwareFile == null) {
/*
* The device has no active firmware in the database, so the
* firmware from the settings has not been linked to the device.
*/
return;
}
final String moduleVersionComm = settings.get(PlatformKeys.FIRMWARE_MODULE_VERSION_COMM);
final String moduleVersionMa = settings.get(PlatformKeys.FIRMWARE_MODULE_VERSION_MA);
final String moduleVersionFunc = settings.get(PlatformKeys.FIRMWARE_MODULE_VERSION_FUNC);
assertThat(Objects.equals(moduleVersionComm, activeFirmwareFile.getModuleVersionComm()) && Objects.equals(moduleVersionMa, activeFirmwareFile.getModuleVersionMa()) && Objects.equals(moduleVersionFunc, activeFirmwareFile.getModuleVersionFunc())).as("Device " + deviceIdentification + " should not have firmware versions from the scenario after an unsuccessful update.").isFalse();
}
use of org.opensmartgridplatform.domain.core.entities.Device in project open-smart-grid-platform by OSGP.
the class AddDeviceSteps method activateDevice.
private Device activateDevice() {
final String deviceIdentification = this.getDeviceIdentificationFromContext();
final Device device = this.findDeviceByDeviceIdentification(deviceIdentification);
assertThat(device).as("Device should be in the core database for identification " + deviceIdentification).isNotNull();
/*
* The default result of adding a device through a service call is that
* the device is configured to have a dynamic IP address to be obtained
* from Jasper Wireless.
*/
this.configureForCommunicationWithDeviceSimulator(device);
return this.deviceRepository.save(device);
}
use of org.opensmartgridplatform.domain.core.entities.Device in project open-smart-grid-platform by OSGP.
the class DlmsDeviceSteps method aDlmsDevice.
@Given("^a dlms device$")
public void aDlmsDevice(final Map<String, String> inputSettings) {
final Device device = this.createDeviceInCoreDatabase(inputSettings);
this.setScenarioContextForDevice(inputSettings, device);
this.createDeviceAuthorisationInCoreDatabase(device);
this.createDlmsDeviceInProtocolAdapterDatabase(inputSettings);
}
use of org.opensmartgridplatform.domain.core.entities.Device in project open-smart-grid-platform by OSGP.
the class DlmsDeviceSteps method theDlmsDeviceWithIdentificationExistsWithDeviceModel.
@Then("^the dlms device with identification \"([^\"]*)\" exists with device model$")
public void theDlmsDeviceWithIdentificationExistsWithDeviceModel(final String deviceIdentification, final Map<String, String> deviceModelAttributes) throws Throwable {
this.theDlmsDeviceWithIdentificationExists(deviceIdentification);
final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification);
final DeviceModel deviceModel = device.getDeviceModel();
assertThat(deviceModel.getModelCode()).as(PlatformKeys.DEVICEMODEL_MODELCODE).isEqualTo(deviceModelAttributes.get(PlatformKeys.DEVICEMODEL_MODELCODE));
final Manufacturer manufacturer = deviceModel.getManufacturer();
assertThat(manufacturer.getCode()).as(PlatformKeys.MANUFACTURER_CODE).isEqualTo(deviceModelAttributes.get(PlatformKeys.MANUFACTURER_CODE));
}
use of org.opensmartgridplatform.domain.core.entities.Device in project open-smart-grid-platform by OSGP.
the class DlmsDeviceSteps method theDlmsDeviceWithIdentificationDoesNotExist.
@Then("^the dlms device with identification \"([^\"]*)\" does not exist$")
public void theDlmsDeviceWithIdentificationDoesNotExist(final String deviceIdentification) {
final DlmsDevice dlmsDevice = this.dlmsDeviceRepository.findByDeviceIdentification(deviceIdentification);
assertThat(dlmsDevice).as("DLMS device with identification " + deviceIdentification + " in protocol database").isNull();
final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification);
assertThat(device).as("DLMS device with identification " + deviceIdentification + " in core database").isNull();
}
Aggregations