use of org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto in project open-smart-grid-platform by OSGP.
the class IeShortFloatConverterTest method shouldConvertIeShortFloatToFloatMeasurementElementDto.
@Test
public void shouldConvertIeShortFloatToFloatMeasurementElementDto() {
// Arrange
final float value = 10.0f;
final FloatMeasurementElementDto expected = new FloatMeasurementElementDto(value);
final IeShortFloat source = new IeShortFloat(value);
// Act
final FloatMeasurementElementDto actual = this.converter.convert(source, null, null);
// Assert
assertThat(actual).isEqualTo(expected);
}
use of org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto in project open-smart-grid-platform by OSGP.
the class DomainDistributionAutomationMapperTest method testFloatingPointMeasurementElementMapping.
@Test
public void testFloatingPointMeasurementElementMapping() {
// Arrange
final float value = 83.4999f;
final FloatMeasurementElement expected = new FloatMeasurementElement(value);
final FloatMeasurementElementDto dtoMeasurementElement = new FloatMeasurementElementDto(value);
// Act
final FloatMeasurementElement actual = this.mapper.map(dtoMeasurementElement, FloatMeasurementElement.class);
// Assert
assertThat(actual).isEqualTo(expected);
}
use of org.opensmartgridplatform.dto.da.measurements.elements.FloatMeasurementElementDto in project open-smart-grid-platform by OSGP.
the class DtoMeasurementsFactory method gasFlowMeasurement.
public static MeasurementDto gasFlowMeasurement(final float gasFlow) {
final BitmaskMeasurementElementDto flags = new BitmaskMeasurementElementDto((byte) 96);
final TimestampMeasurementElementDto from = new TimestampMeasurementElementDto(1546800000501L);
final TimestampMeasurementElementDto until = new TimestampMeasurementElementDto(1546700000444L);
final FloatMeasurementElementDto cubicMeters = new FloatMeasurementElementDto(gasFlow);
final List<MeasurementElementDto> measurementElements = new ArrayList<>();
measurementElements.add(flags);
measurementElements.add(from);
measurementElements.add(until);
measurementElements.add(cubicMeters);
return DtoMeasurementsFactory.measurementFrom(measurementElements);
}
Aggregations