use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequestData in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileDataMapperTest method shouldConvertValueObjectToDto.
@Test
public void shouldConvertValueObjectToDto() {
final GetPowerQualityProfileRequestData source = new GetPowerQualityProfileRequestData("PUBLIC", BEGIN_DATE.toDate(), END_DATE.toDate());
final GetPowerQualityProfileRequestDataDto result = this.mapper.map(source, GetPowerQualityProfileRequestDataDto.class);
assertThat(result.getBeginDate()).withFailMessage(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(BEGIN_DATE.toDate());
assertThat(result.getEndDate()).withFailMessage(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(END_DATE.toDate());
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequestData in project open-smart-grid-platform by OSGP.
the class GetGetPowerQualityProfileRequestMappingTest method shouldConvertGetPowerQualityProfileRequest.
@Test
public void shouldConvertGetPowerQualityProfileRequest() {
final GetPowerQualityProfileRequest source = this.makeRequest();
final GetPowerQualityProfileRequestData result = this.mapper.map(source, GetPowerQualityProfileRequestData.class);
assertThat(result).as(MAPPED_OBJECT_NULL_MESSAGE).isNotNull();
assertThat(result.getProfileType()).as(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(source.getProfileType());
assertThat(this.toGregorianCalendar(new DateTime(result.getBeginDate()))).as(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(source.getBeginDate());
assertThat(this.toGregorianCalendar(new DateTime(result.getEndDate()))).as(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(source.getEndDate());
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequestData in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileRequestDataConverter method convert.
@Override
public GetPowerQualityProfileRequestData convert(final GetPowerQualityProfileRequest source, final Type<? extends GetPowerQualityProfileRequestData> destinationType, final MappingContext context) {
final GetPowerQualityProfileRequestData data = new GetPowerQualityProfileRequestData(source.getProfileType(), source.getBeginDate().toGregorianCalendar().getTime(), source.getEndDate().toGregorianCalendar().getTime());
if (source.getSelectedValues() != null) {
final List<CaptureObjectDefinition> captureObjectDefinitions = source.getSelectedValues().getCaptureObject();
captureObjectDefinitions.forEach(cod -> data.getSelectedValues().add(this.convert(cod)));
}
return data;
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequestData in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileRequestMapperTest method testGetPowerQualityProfileRequest.
@Test
public void testGetPowerQualityProfileRequest() {
final GetPowerQualityProfileRequest getPowerQualityProfileRequest = this.makeRequest();
final GetPowerQualityProfileRequestData result = this.mapper.map(getPowerQualityProfileRequest, GetPowerQualityProfileRequestData.class);
assertThat(result).withFailMessage("mapping GetPowerQualityProfileRequest should not return null").isNotNull();
assertThat(result).withFailMessage("mapping GetPowerQualityProfileRequest should return correct type").isOfAnyClassIn(GetPowerQualityProfileRequestData.class);
assertThat(result.getBeginDate()).withFailMessage(MAPPED_VALUE_MESSAGE).isEqualTo(DATE);
assertThat(result.getEndDate()).withFailMessage(MAPPED_VALUE_MESSAGE).isEqualTo(DATE);
}
Aggregations