Search in sources :

Example 6 with MeasurementGroupDto

use of org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto in project open-smart-grid-platform by OSGP.

the class DomainDistributionAutomationMapperTest method testMeasurementGroupMapping.

@Test
public void testMeasurementGroupMapping() {
    // Arrange
    final String groupIdentification = "215";
    final float[] gasFlowMeasurements = { 401.70001f, 88.575f };
    final MeasurementGroup expected = DomainMeasurementsFactory.gasFlowMeasurementGroup(groupIdentification, gasFlowMeasurements);
    final MeasurementGroupDto dtoMeasurementGroup = DtoMeasurementsFactory.gasFlowMeasurementGroup(groupIdentification, gasFlowMeasurements);
    // Act
    final MeasurementGroup actual = this.mapper.map(dtoMeasurementGroup, MeasurementGroup.class);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : MeasurementGroupDto(org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto) MeasurementGroup(org.opensmartgridplatform.domain.da.measurements.MeasurementGroup) Test(org.junit.jupiter.api.Test)

Example 7 with MeasurementGroupDto

use of org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto in project open-smart-grid-platform by OSGP.

the class DomainDistributionAutomationMapperTest method testMeasurementReportMapping.

@Test
public void testMeasurementReportMapping() {
    // Arrange
    final int commonAddress = 55;
    final String groupIdentification = "137";
    final float[] gasFlowMeasurements = { 78.733f, 21.000f };
    // Arrange domain
    final MeasurementGroup expectedGroup = DomainMeasurementsFactory.gasFlowMeasurementGroup(groupIdentification, gasFlowMeasurements);
    final List<MeasurementGroup> expectedGroups = new ArrayList<>();
    expectedGroups.add(expectedGroup);
    final MeasurementReport expected = new MeasurementReport(DomainMeasurementsFactory.spontaneousReportHeader(commonAddress), expectedGroups);
    // Arrange DTO
    final MeasurementReportHeaderDto dtoHeader = DtoMeasurementsFactory.spontaneousReportHeader(commonAddress);
    final MeasurementGroupDto dtoGroup = DtoMeasurementsFactory.gasFlowMeasurementGroup(groupIdentification, gasFlowMeasurements);
    final List<MeasurementGroupDto> dtoGroups = new ArrayList<>();
    dtoGroups.add(dtoGroup);
    final MeasurementReportDto dtoReport = new MeasurementReportDto(dtoHeader, dtoGroups);
    // Act
    final MeasurementReport actual = this.mapper.map(dtoReport, MeasurementReport.class);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : MeasurementReportDto(org.opensmartgridplatform.dto.da.measurements.MeasurementReportDto) ArrayList(java.util.ArrayList) MeasurementGroupDto(org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto) MeasurementReport(org.opensmartgridplatform.domain.da.measurements.MeasurementReport) MeasurementGroup(org.opensmartgridplatform.domain.da.measurements.MeasurementGroup) MeasurementReportHeaderDto(org.opensmartgridplatform.dto.da.measurements.MeasurementReportHeaderDto) Test(org.junit.jupiter.api.Test)

Aggregations

MeasurementGroupDto (org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto)7 Test (org.junit.jupiter.api.Test)3 MeasurementReportDto (org.opensmartgridplatform.dto.da.measurements.MeasurementReportDto)3 MeasurementReportHeaderDto (org.opensmartgridplatform.dto.da.measurements.MeasurementReportHeaderDto)3 MeasurementGroup (org.opensmartgridplatform.domain.da.measurements.MeasurementGroup)2 MeasurementDto (org.opensmartgridplatform.dto.da.measurements.MeasurementDto)2 MeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.MeasurementElementDto)2 BitmaskMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto)2 ArrayList (java.util.ArrayList)1 InformationObject (org.openmuc.j60870.ie.InformationObject)1 MeasurementReport (org.opensmartgridplatform.domain.da.measurements.MeasurementReport)1