use of org.opensmartgridplatform.dto.valueobjects.smartmetering.DefinableLoadProfileConfigurationDto in project open-smart-grid-platform by OSGP.
the class DefinableLoadProfileConfigurationDataMapperTest method testDefinableLoadProfileConfigurationMapping.
@Test
public void testDefinableLoadProfileConfigurationMapping() {
final DefinableLoadProfileConfigurationData definableLoadProfileConfigurationData = this.newDefinableLoadProfileConfigurationData();
final DefinableLoadProfileConfigurationDto definableLoadProfileConfigurationDto = this.mapper.map(definableLoadProfileConfigurationData, DefinableLoadProfileConfigurationDto.class);
assertThat(definableLoadProfileConfigurationDto).withFailMessage("Result of mapping DefinableLoadProfileConfigurationData must not be null").isNotNull();
assertThat(definableLoadProfileConfigurationDto.hasCaptureObjects()).withFailMessage("DefinableLoadProfileConfigurationDto should have capture objects: " + definableLoadProfileConfigurationDto).isTrue();
this.assertCaptureObjects(definableLoadProfileConfigurationDto.getCaptureObjects());
assertThat(definableLoadProfileConfigurationDto.hasCapturePeriod()).withFailMessage("DefinableLoadProfileConfigurationDto should have a capture period: " + definableLoadProfileConfigurationDto).isTrue();
assertThat(definableLoadProfileConfigurationDto.getCapturePeriod()).withFailMessage("DefinableLoadProfileConfigurationDto capture period").isEqualTo(CAPTURE_PERIOD);
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.DefinableLoadProfileConfigurationDto in project open-smart-grid-platform by OSGP.
the class ConfigurationService method configureDefinableLoadProfile.
public void configureDefinableLoadProfile(final MessageMetadata messageMetadata, final DefinableLoadProfileConfigurationData definableLoadProfileConfigurationData) throws FunctionalException {
log.info("configureDefinableLoadProfile for organisationIdentification: {} for deviceIdentification: {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification());
final SmartMeter smartMeter = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
final DefinableLoadProfileConfigurationDto requestDto = this.configurationMapper.map(definableLoadProfileConfigurationData, DefinableLoadProfileConfigurationDto.class);
this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withIpAddress(smartMeter.getIpAddress()).withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId()).build());
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.DefinableLoadProfileConfigurationDto in project open-smart-grid-platform by OSGP.
the class ConfigureDefinableLoadProfileRequestMessageProcessor method handleMessage.
@Override
protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable requestObject, final MessageMetadata messageMetadata) throws OsgpException {
this.assertRequestObjectType(DefinableLoadProfileConfigurationDto.class, requestObject);
final DefinableLoadProfileConfigurationDto definableLoadProfileConfiguration = (DefinableLoadProfileConfigurationDto) requestObject;
this.configurationService.configureDefinableLoadProfile(conn, device, definableLoadProfileConfiguration, messageMetadata);
return null;
}
Aggregations