Search in sources :

Example 1 with MeasurementReportHeaderDto

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

the class MeasurementReportFactory method getMeasurementReportDto.

public static MeasurementReportDto getMeasurementReportDto() {
    final MeasurementReportHeaderDto mrh = new MeasurementReportHeaderDto("M_SP_NA_1", "INTERROGATED_BY_STATION", 0, 0);
    final MeasurementGroupDto mg1 = getMeasurementGroup(Iec60870DeviceFactory.LMD_1_IOA, LMD_1_ON);
    final MeasurementGroupDto mg2 = getMeasurementGroup(Iec60870DeviceFactory.LMD_2_IOA, LMD_2_ON);
    return new MeasurementReportDto(mrh, Arrays.asList(mg1, mg2));
}
Also used : MeasurementReportDto(org.opensmartgridplatform.dto.da.measurements.MeasurementReportDto) MeasurementGroupDto(org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto) MeasurementReportHeaderDto(org.opensmartgridplatform.dto.da.measurements.MeasurementReportHeaderDto)

Example 2 with MeasurementReportHeaderDto

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

the class SinglePointWithQualityAsduHandlerTest method createMeasurementReportDto.

private MeasurementReportDto createMeasurementReportDto() {
    final MeasurementReportHeaderDto mrh = new MeasurementReportHeaderDto(MEASUREMENT_TYPE, MEASUREMENT_REASON, MEASUREMENT_ORIGINATOR_ADDRESS, MEASUREMENT_COMMON_ADDRESS);
    final MeasurementGroupDto mg1 = this.createMeasurementGroup(Integer.toString(LMD_1_IOA), LMD_1_ON);
    final MeasurementGroupDto mg2 = this.createMeasurementGroup(Integer.toString(LMD_2_IOA), LMD_2_ON);
    return new MeasurementReportDto(mrh, Arrays.asList(mg1, mg2));
}
Also used : MeasurementReportDto(org.opensmartgridplatform.dto.da.measurements.MeasurementReportDto) MeasurementGroupDto(org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto) MeasurementReportHeaderDto(org.opensmartgridplatform.dto.da.measurements.MeasurementReportHeaderDto)

Example 3 with MeasurementReportHeaderDto

use of org.opensmartgridplatform.dto.da.measurements.MeasurementReportHeaderDto 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)

Example 4 with MeasurementReportHeaderDto

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

the class DomainDistributionAutomationMapperTest method testMeasurementReportHeaderMapping.

@Test
public void testMeasurementReportHeaderMapping() {
    // Arrange
    final int commonAddress = 234;
    final MeasurementReportHeader expected = DomainMeasurementsFactory.spontaneousReportHeader(commonAddress);
    final MeasurementReportHeaderDto dtoMeasurementReportHeader = DtoMeasurementsFactory.spontaneousReportHeader(commonAddress);
    // Act
    final MeasurementReportHeader actual = this.mapper.map(dtoMeasurementReportHeader, MeasurementReportHeader.class);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : MeasurementReportHeader(org.opensmartgridplatform.domain.da.measurements.MeasurementReportHeader) MeasurementReportHeaderDto(org.opensmartgridplatform.dto.da.measurements.MeasurementReportHeaderDto) Test(org.junit.jupiter.api.Test)

Aggregations

MeasurementReportHeaderDto (org.opensmartgridplatform.dto.da.measurements.MeasurementReportHeaderDto)4 MeasurementGroupDto (org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto)3 MeasurementReportDto (org.opensmartgridplatform.dto.da.measurements.MeasurementReportDto)3 Test (org.junit.jupiter.api.Test)2 ArrayList (java.util.ArrayList)1 MeasurementGroup (org.opensmartgridplatform.domain.da.measurements.MeasurementGroup)1 MeasurementReport (org.opensmartgridplatform.domain.da.measurements.MeasurementReport)1 MeasurementReportHeader (org.opensmartgridplatform.domain.da.measurements.MeasurementReportHeader)1