Search in sources :

Example 1 with ProfileEntryValue

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue in project open-smart-grid-platform by OSGP.

the class PowerQualityProfileResponseDataMappingTest method testConvertProfileEntryValueDto.

@Test
public void testConvertProfileEntryValueDto() {
    final ProfileEntryValue result = this.mapper.map(this.profileEntryDtoDate(), ProfileEntryValue.class);
    assertThat(result).withFailMessage("mapping ProfileEntryValueDto should not return null").isNotNull();
    assertThat(result).withFailMessage("mapping ProfileEntryValueDto should return correct type").isOfAnyClassIn(ProfileEntryValue.class);
}
Also used : ProfileEntryValue(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue) Test(org.junit.jupiter.api.Test)

Example 2 with ProfileEntryValue

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue in project open-smart-grid-platform by OSGP.

the class PowerQualityProfileResponseDataMapperTest method testConvertGetPowerQualityProfileResponseVo.

@Test
public void testConvertGetPowerQualityProfileResponseVo() {
    final PowerQualityProfileDataDto responseDto = this.makeResponseDataDto();
    final PowerQualityProfileData responseVo = this.mapper.map(responseDto, PowerQualityProfileData.class);
    assertThat(responseVo).withFailMessage("response object should not be null").isNotNull();
    assertThat(responseVo.getProfileEntries().get(0).getProfileEntryValues().size()).withFailMessage("response object should return same number of profilentries").isEqualTo(EXPECTED_CLASS.length);
    int i = 0;
    for (final ProfileEntryValue profileEntryValueVo : responseVo.getProfileEntries().get(0).getProfileEntryValues()) {
        final Class<?> clazz = profileEntryValueVo.getValue().getClass();
        assertThat(clazz).withFailMessage("the return class should be of the same type").isEqualTo(EXPECTED_CLASS[i++]);
    }
}
Also used : PowerQualityProfileDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.PowerQualityProfileDataDto) ProfileEntryValue(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue) PowerQualityProfileData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PowerQualityProfileData) Test(org.junit.jupiter.api.Test)

Example 3 with ProfileEntryValue

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue in project open-smart-grid-platform by OSGP.

the class GetPowerQualityProfileDtoConverter method makeProfileEntries.

private List<ProfileEntry> makeProfileEntries(final PowerQualityProfileDataDto responseDataDto) {
    final List<ProfileEntry> profileEntries = new ArrayList<>();
    for (final ProfileEntryDto profileEntryDto : responseDataDto.getProfileEntries()) {
        final List<ProfileEntryValue> profileEntryValues = new ArrayList<>();
        for (final ProfileEntryValueDto profileEntryValueDto : profileEntryDto.getProfileEntryValues()) {
            final ProfileEntryValue profileEntryValue = this.mapperFactory.getMapperFacade().map(profileEntryValueDto, ProfileEntryValue.class);
            profileEntryValues.add(profileEntryValue);
        }
        profileEntries.add(new ProfileEntry(profileEntryValues));
    }
    return profileEntries;
}
Also used : ProfileEntryValueDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ProfileEntryValueDto) ProfileEntryDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ProfileEntryDto) ProfileEntryValue(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue) ProfileEntry(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntry) ArrayList(java.util.ArrayList)

Aggregations

ProfileEntryValue (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue)3 Test (org.junit.jupiter.api.Test)2 ArrayList (java.util.ArrayList)1 PowerQualityProfileData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PowerQualityProfileData)1 ProfileEntry (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntry)1 PowerQualityProfileDataDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.PowerQualityProfileDataDto)1 ProfileEntryDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ProfileEntryDto)1 ProfileEntryValueDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.ProfileEntryValueDto)1