use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfile in project open-smart-grid-platform by OSGP.
the class ActivityCalendarMappingTest method checkListMapping.
// method to test mapping of Filled Lists
private void checkListMapping(final List<SeasonProfile> seasonProfileList, final List<SeasonProfileDto> seasonProfileDtoList) {
assertThat(seasonProfileList).isNotNull();
assertThat(seasonProfileDtoList).isNotNull();
assertThat(seasonProfileList.isEmpty()).isFalse();
assertThat(seasonProfileDtoList.isEmpty()).isFalse();
final SeasonProfile seasonProfile = seasonProfileList.get(0);
final SeasonProfileDto seasonProfileDto = seasonProfileDtoList.get(0);
assertThat(seasonProfileDto.getSeasonProfileName()).isEqualTo(seasonProfile.getSeasonProfileName());
this.checkCosemDateTimeMapping(seasonProfile.getSeasonStart(), seasonProfileDto.getSeasonStart());
final WeekProfile weekProfile = seasonProfile.getWeekProfile();
final WeekProfileDto weekProfileDto = seasonProfileDto.getWeekProfile();
assertThat(weekProfileDto.getWeekProfileName()).isEqualTo(weekProfile.getWeekProfileName());
final DayProfile dayProfile = weekProfile.getMonday();
final DayProfileDto dayProfileDto = weekProfileDto.getMonday();
assertThat(dayProfileDto.getDayId()).isEqualTo(dayProfile.getDayId());
assertThat(dayProfile.getDayProfileActionList().size()).isEqualTo(dayProfile.getDayProfileActionList().size());
final DayProfileAction dayProfileAction = dayProfile.getDayProfileActionList().get(0);
final DayProfileActionDto dayProfileActionDto = dayProfileDto.getDayProfileActionList().get(0);
assertThat(dayProfileActionDto.getScriptSelector()).isEqualTo(dayProfileAction.getScriptSelector());
final CosemTime cosemTime = dayProfileAction.getStartTime();
final CosemTimeDto cosemTimeDto = dayProfileActionDto.getStartTime();
assertThat(cosemTimeDto.getHour()).isEqualTo(cosemTime.getHour());
assertThat(cosemTimeDto.getMinute()).isEqualTo(cosemTime.getMinute());
assertThat(cosemTimeDto.getSecond()).isEqualTo(cosemTime.getSecond());
assertThat(cosemTimeDto.getHundredths()).isEqualTo(cosemTime.getHundredths());
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfile in project open-smart-grid-platform by OSGP.
the class ActivityCalendarBuilder method withFilledList.
public ActivityCalendarBuilder withFilledList() {
final CosemDate date = new CosemDate(2016, 3, 16);
final CosemTime time = new CosemTime(11, 45, 33);
final int deviation = 1;
final ClockStatus clockStatus = new ClockStatus(ClockStatus.STATUS_NOT_SPECIFIED);
final CosemDateTime seasonStart = new CosemDateTime(date, time, deviation, clockStatus);
final CosemTime startTime = time;
final DayProfileAction dayProfileAction = new DayProfileAction(new Integer(10), startTime);
final List<DayProfileAction> dayProfileActionList = new ArrayList<>();
dayProfileActionList.add(dayProfileAction);
final DayProfile dayProfile = new DayProfile(new Integer(10), dayProfileActionList);
final WeekProfile weekProfile = WeekProfile.newBuilder().withWeekProfileName("weekProfile1").withMonday(dayProfile).withTuesday(dayProfile).withWednesday(dayProfile).withThursday(dayProfile).withFriday(dayProfile).withSaturday(dayProfile).withSunday(dayProfile).build();
final SeasonProfile seasonProfile = new SeasonProfile("profile1", seasonStart, weekProfile);
this.seasonProfileList.add(seasonProfile);
return this;
}
Aggregations