Search in sources :

Example 6 with AmrProfileStatusCodeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.AmrProfileStatusCodeDto in project open-smart-grid-platform by OSGP.

the class PeriodicMeterReadContainerMappingTest method mapsPeriodicMeterReadsResponseItemDto.

@Test
public void mapsPeriodicMeterReadsResponseItemDto() {
    final Date logTime = new Date();
    final ActiveEnergyValuesDto valuesDto = new ActiveEnergyValuesDto(new DlmsMeterValueDto(new BigDecimal("12.34"), DlmsUnitTypeDto.M3), new DlmsMeterValueDto(new BigDecimal("12.35"), DlmsUnitTypeDto.M3), new DlmsMeterValueDto(new BigDecimal("12.36"), DlmsUnitTypeDto.M3), new DlmsMeterValueDto(new BigDecimal("12.37"), DlmsUnitTypeDto.M3), new DlmsMeterValueDto(new BigDecimal("12.38"), DlmsUnitTypeDto.M3), new DlmsMeterValueDto(new BigDecimal("12.39"), DlmsUnitTypeDto.M3));
    final AmrProfileStatusCodeDto amrProfileStatusCodeDto = new AmrProfileStatusCodeDto(new HashSet<>(asList(AmrProfileStatusCodeFlagDto.CRITICAL_ERROR, AmrProfileStatusCodeFlagDto.CLOCK_ADJUSTED)));
    final PeriodicMeterReadsResponseItemDto source = new PeriodicMeterReadsResponseItemDto(logTime, valuesDto, amrProfileStatusCodeDto);
    final PeriodicMeterReads readsResult = this.monitoringMapper.map(source, PeriodicMeterReads.class);
    final ActiveEnergyValues expectedValues = new ActiveEnergyValues(new OsgpMeterValue(new BigDecimal("12.340"), OsgpUnit.M3), new OsgpMeterValue(new BigDecimal("12.350"), OsgpUnit.M3), new OsgpMeterValue(new BigDecimal("12.360"), OsgpUnit.M3), new OsgpMeterValue(new BigDecimal("12.370"), OsgpUnit.M3), new OsgpMeterValue(new BigDecimal("12.380"), OsgpUnit.M3), new OsgpMeterValue(new BigDecimal("12.390"), OsgpUnit.M3));
    final AmrProfileStatusCode amrProfileStatusCode = new AmrProfileStatusCode(new HashSet<>(asList(AmrProfileStatusCodeFlag.CRITICAL_ERROR, AmrProfileStatusCodeFlag.CLOCK_ADJUSTED)));
    final PeriodicMeterReads expectedReads = new PeriodicMeterReads(logTime, expectedValues, amrProfileStatusCode);
    assertThat(readsResult).usingRecursiveComparison().isEqualTo(expectedReads);
}
Also used : AmrProfileStatusCodeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AmrProfileStatusCodeDto) PeriodicMeterReadsResponseItemDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsResponseItemDto) AmrProfileStatusCode(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AmrProfileStatusCode) PeriodicMeterReads(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PeriodicMeterReads) ActiveEnergyValuesDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ActiveEnergyValuesDto) ActiveEnergyValues(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActiveEnergyValues) Date(java.util.Date) BigDecimal(java.math.BigDecimal) OsgpMeterValue(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.OsgpMeterValue) DlmsMeterValueDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.DlmsMeterValueDto) Test(org.junit.jupiter.api.Test)

Aggregations

AmrProfileStatusCodeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.AmrProfileStatusCodeDto)6 Date (java.util.Date)5 DlmsMeterValueDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.DlmsMeterValueDto)4 BigDecimal (java.math.BigDecimal)3 Test (org.junit.jupiter.api.Test)3 PeriodicMeterReadsResponseItemDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsResponseItemDto)3 ArrayList (java.util.ArrayList)2 TreeSet (java.util.TreeSet)2 AmrProfileStatusCodeFlagDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.AmrProfileStatusCodeFlagDto)2 PeriodTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodTypeDto)2 PeriodicMeterReadsGasResponseItemDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadsGasResponseItemDto)2 DataObject (org.openmuc.jdlms.datatypes.DataObject)1 ActiveEnergyValues (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActiveEnergyValues)1 AmrProfileStatusCode (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AmrProfileStatusCode)1 OsgpMeterValue (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.OsgpMeterValue)1 PeriodicMeterReads (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PeriodicMeterReads)1 PeriodicMeterReadsContainer (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PeriodicMeterReadsContainer)1 PeriodicMeterReadsContainerGas (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PeriodicMeterReadsContainerGas)1 ActiveEnergyValuesDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ActiveEnergyValuesDto)1 PeriodicMeterReadGasResponseDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PeriodicMeterReadGasResponseDto)1