Search in sources :

Example 6 with PeriodicMeterReadsResponseDto

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

Example 7 with PeriodicMeterReadsResponseDto

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());
}
Also used : PeriodicMeterReadsResponseItemDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsResponseItemDto) PeriodTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodTypeDto) PeriodicMeterReadsContainer(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PeriodicMeterReadsContainer) ArrayList(java.util.ArrayList) PeriodicMeterReadsResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsResponseDto) Test(org.junit.jupiter.api.Test)

Aggregations

PeriodicMeterReadsResponseDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsResponseDto)7 PeriodTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodTypeDto)6 PeriodicMeterReadsResponseItemDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsResponseItemDto)6 ArrayList (java.util.ArrayList)5 Test (org.junit.jupiter.api.Test)5 Date (java.util.Date)3 DateTime (org.joda.time.DateTime)3 AttributeAddress (org.openmuc.jdlms.AttributeAddress)3 DataObject (org.openmuc.jdlms.datatypes.DataObject)3 GetResult (org.openmuc.jdlms.GetResult)2 AttributeAddressForProfile (org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.dlmsobjectconfig.AttributeAddressForProfile)2 Protocol (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.Protocol)2 PeriodicMeterReadsRequestDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsRequestDto)2 BigDecimal (java.math.BigDecimal)1 Arrays (java.util.Arrays)1 Calendar (java.util.Calendar)1 Collections (java.util.Collections)1 GregorianCalendar (java.util.GregorianCalendar)1 List (java.util.List)1 TimeZone (java.util.TimeZone)1