Search in sources :

Example 11 with BitmaskMeasurementElementDto

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

the class IeQualityConverterTest method shouldConvertIeQualitySubstitutedToByte.

@Test
public void shouldConvertIeQualitySubstitutedToByte() {
    // Arrange
    final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_SUBSTITUTED);
    final IeQuality source = new IeQuality(false, false, true, false, false);
    // Act
    final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : IeQuality(org.openmuc.j60870.ie.IeQuality) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) Test(org.junit.jupiter.api.Test)

Example 12 with BitmaskMeasurementElementDto

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

the class DomainDistributionAutomationMapperTest method testBitmaskMeasurementElementMapping.

@Test
public void testBitmaskMeasurementElementMapping() {
    // Arrange
    final byte value = (byte) 40;
    final BitmaskMeasurementElement expected = new BitmaskMeasurementElement(value);
    final BitmaskMeasurementElementDto dtoMeasurementElement = new BitmaskMeasurementElementDto(value);
    // Act
    final BitmaskMeasurementElement actual = this.mapper.map(dtoMeasurementElement, BitmaskMeasurementElement.class);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : BitmaskMeasurementElement(org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) Test(org.junit.jupiter.api.Test)

Example 13 with BitmaskMeasurementElementDto

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

the class IeSinglePointWithQualityConverterTest method testConvertIeSinglePointWithQualityInvalid.

@Test
public void testConvertIeSinglePointWithQualityInvalid() {
    // Arrange
    final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_INVALID);
    final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, false, false, false, true);
    // Act
    final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : IeSinglePointWithQuality(org.openmuc.j60870.ie.IeSinglePointWithQuality) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) Test(org.junit.jupiter.api.Test)

Example 14 with BitmaskMeasurementElementDto

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

the class IeSinglePointWithQualityConverterTest method testConvertIeSinglePointWithQualityNotTopical.

@Test
public void testConvertIeSinglePointWithQualityNotTopical() {
    // Arrange
    final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_NOT_TOPICAL);
    final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, false, false, true, false);
    // Act
    final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : IeSinglePointWithQuality(org.openmuc.j60870.ie.IeSinglePointWithQuality) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) Test(org.junit.jupiter.api.Test)

Example 15 with BitmaskMeasurementElementDto

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

the class IeQualityConverterTest method shouldConvertIeQualityBlockedToByte.

@Test
public void shouldConvertIeQualityBlockedToByte() {
    // Arrange
    final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_BLOCKED);
    final IeQuality source = new IeQuality(false, true, false, false, false);
    // Act
    final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null);
    // Assert
    assertThat(actual).isEqualTo(expected);
}
Also used : IeQuality(org.openmuc.j60870.ie.IeQuality) BitmaskMeasurementElementDto(org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto) Test(org.junit.jupiter.api.Test)

Aggregations

BitmaskMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.BitmaskMeasurementElementDto)18 Test (org.junit.jupiter.api.Test)15 IeQuality (org.openmuc.j60870.ie.IeQuality)7 IeSinglePointWithQuality (org.openmuc.j60870.ie.IeSinglePointWithQuality)7 MeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.MeasurementElementDto)3 MeasurementDto (org.opensmartgridplatform.dto.da.measurements.MeasurementDto)2 MeasurementGroupDto (org.opensmartgridplatform.dto.da.measurements.MeasurementGroupDto)2 ArrayList (java.util.ArrayList)1 BitmaskMeasurementElement (org.opensmartgridplatform.domain.da.measurements.elements.BitmaskMeasurementElement)1 FloatMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto)1 TimestampMeasurementElementDto (org.opensmartgridplatform.dto.da.measurements.elements.TimestampMeasurementElementDto)1