Search in sources :

Example 1 with DefinableLoadProfileConfigurationDto

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);
}
Also used : DefinableLoadProfileConfigurationData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DefinableLoadProfileConfigurationData) DefinableLoadProfileConfigurationDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.DefinableLoadProfileConfigurationDto) Test(org.junit.jupiter.api.Test)

Example 2 with DefinableLoadProfileConfigurationDto

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());
}
Also used : SmartMeter(org.opensmartgridplatform.domain.core.entities.SmartMeter) DefinableLoadProfileConfigurationDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.DefinableLoadProfileConfigurationDto)

Example 3 with DefinableLoadProfileConfigurationDto

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;
}
Also used : DefinableLoadProfileConfigurationDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.DefinableLoadProfileConfigurationDto)

Aggregations

DefinableLoadProfileConfigurationDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.DefinableLoadProfileConfigurationDto)3 Test (org.junit.jupiter.api.Test)1 SmartMeter (org.opensmartgridplatform.domain.core.entities.SmartMeter)1 DefinableLoadProfileConfigurationData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DefinableLoadProfileConfigurationData)1