use of org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsResponseDto in project open-smart-grid-platform by OSGP.
the class PeriodicMeterReadsresponseMessageProcessor method handleMessage.
@Override
protected void handleMessage(final MessageMetadata deviceMessageMetadata, final ResponseMessage responseMessage, final OsgpException osgpException) {
if (responseMessage.getDataObject() instanceof PeriodicMeterReadsResponseDto) {
final PeriodicMeterReadsResponseDto periodicMeterReadsContainer = (PeriodicMeterReadsResponseDto) responseMessage.getDataObject();
this.monitoringService.handlePeriodicMeterReadsresponse(deviceMessageMetadata, responseMessage.getResult(), osgpException, periodicMeterReadsContainer);
} else if (responseMessage.getDataObject() instanceof PeriodicMeterReadGasResponseDto) {
final PeriodicMeterReadGasResponseDto periodicMeterReadsContainerGas = (PeriodicMeterReadGasResponseDto) responseMessage.getDataObject();
this.monitoringService.handlePeriodicMeterReadsresponse(deviceMessageMetadata, responseMessage.getResult(), osgpException, periodicMeterReadsContainerGas);
}
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsResponseDto in project open-smart-grid-platform by OSGP.
the class PeriodicMeterReadContainerMappingTest method testWithEmptyList.
// Test if mapping with an empty List succeeds
@Test
public void testWithEmptyList() {
final List<PeriodicMeterReadsResponseItemDto> meterReads = new ArrayList<>();
final PeriodTypeDto periodType = PeriodTypeDto.DAILY;
final PeriodicMeterReadsResponseDto periodicMeterReadsContainerDto = new PeriodicMeterReadsResponseDto(periodType, meterReads);
final PeriodicMeterReadsContainer periodicMeterReadContainer = this.monitoringMapper.map(periodicMeterReadsContainerDto, PeriodicMeterReadsContainer.class);
assertThat(periodicMeterReadContainer).isNotNull();
assertThat(periodicMeterReadContainer.getPeriodicMeterReads()).isEmpty();
assertThat(periodicMeterReadContainer.getPeriodType().name()).isEqualTo(periodicMeterReadsContainerDto.getPeriodType().name());
}
Aggregations