use of org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto in project open-smart-grid-platform by OSGP.
the class ActivityCalendarMappingTest method checkCosemDateTimeMapping.
// method to test mapping of CosemDateTime objects
private void checkCosemDateTimeMapping(final CosemDateTime cosemDateTime, final CosemDateTimeDto cosemDateTimeDto) {
// make sure neither is null
assertThat(cosemDateTime).isNotNull();
assertThat(cosemDateTimeDto).isNotNull();
// check variables
assertThat(cosemDateTimeDto.getDeviation()).isEqualTo(cosemDateTime.getDeviation());
final ClockStatus clockStatus = cosemDateTime.getClockStatus();
final ClockStatusDto clockStatusDto = cosemDateTimeDto.getClockStatus();
assertThat(clockStatusDto.getStatus()).isEqualTo(clockStatus.getStatus());
assertThat(clockStatusDto.isSpecified()).isEqualTo(clockStatus.isSpecified());
final CosemDate cosemDate = cosemDateTime.getDate();
final CosemDateDto cosemDateDto = cosemDateTimeDto.getDate();
assertThat(cosemDateDto.getYear()).isEqualTo(cosemDate.getYear());
assertThat(cosemDateDto.getMonth()).isEqualTo(cosemDate.getMonth());
assertThat(cosemDateDto.getDayOfMonth()).isEqualTo(cosemDate.getDayOfMonth());
assertThat(cosemDateDto.getDayOfWeek()).isEqualTo(cosemDate.getDayOfWeek());
final CosemTime cosemTime = cosemDateTime.getTime();
final CosemTimeDto cosemTimeDto = cosemDateTimeDto.getTime();
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.dto.valueobjects.smartmetering.CosemTimeDto in project open-smart-grid-platform by OSGP.
the class PushSetupSmsMappingTest method checkCosemDateTimeMapping.
// method to test mapping of CosemDateTime objects
private void checkCosemDateTimeMapping(final CosemDateTime cosemDateTime, final CosemDateTimeDto cosemDateTimeDto) {
// make sure neither is null
assertThat(cosemDateTime).isNotNull();
assertThat(cosemDateTimeDto).isNotNull();
// check variables
assertThat(cosemDateTimeDto.getDeviation()).isEqualTo(cosemDateTime.getDeviation());
final ClockStatus clockStatus = cosemDateTime.getClockStatus();
final ClockStatusDto clockStatusDto = cosemDateTimeDto.getClockStatus();
assertThat(clockStatusDto.getStatus()).isEqualTo(clockStatus.getStatus());
assertThat(clockStatusDto.isSpecified()).isEqualTo(clockStatus.isSpecified());
final CosemDate cosemDate = cosemDateTime.getDate();
final CosemDateDto cosemDateDto = cosemDateTimeDto.getDate();
assertThat(cosemDateDto).isEqualToComparingFieldByField(cosemDate);
final CosemTime cosemTime = cosemDateTime.getTime();
final CosemTimeDto cosemTimeDto = cosemDateTimeDto.getTime();
assertThat(cosemTimeDto).isEqualToComparingFieldByField(cosemTime);
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto in project open-smart-grid-platform by OSGP.
the class PushSetupAlarmMappingTest method checkCosemDateTimeMapping.
// method to test mapping of CosemDateTime objects
private void checkCosemDateTimeMapping(final CosemDateTime cosemDateTime, final CosemDateTimeDto cosemDateTimeDto) {
// make sure neither is null
assertThat(cosemDateTime).isNotNull();
assertThat(cosemDateTimeDto).isNotNull();
// check variables
assertThat(cosemDateTimeDto.getDeviation()).isEqualTo(cosemDateTime.getDeviation());
final ClockStatus clockStatus = cosemDateTime.getClockStatus();
final ClockStatusDto clockStatusDto = cosemDateTimeDto.getClockStatus();
assertThat(clockStatusDto.getStatus()).isEqualTo(clockStatus.getStatus());
assertThat(clockStatusDto.isSpecified()).isEqualTo(clockStatus.isSpecified());
final CosemDate cosemDate = cosemDateTime.getDate();
final CosemDateDto cosemDateDto = cosemDateTimeDto.getDate();
assertThat(cosemDateDto).isEqualToComparingFieldByField(cosemDate);
final CosemTime cosemTime = cosemDateTime.getTime();
final CosemTimeDto cosemTimeDto = cosemDateTimeDto.getTime();
assertThat(cosemTimeDto).isEqualToComparingFieldByField(cosemTime);
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto in project open-smart-grid-platform by OSGP.
the class CosemDateTimeConverter method convertTo.
@Override
public org.openmuc.jdlms.datatypes.CosemDateTime convertTo(final CosemDateTimeDto source, final Type<org.openmuc.jdlms.datatypes.CosemDateTime> destinationType, final MappingContext context) {
final CosemTimeDto time = source.getTime();
final CosemDateDto date = source.getDate();
final Set<ClockStatus> clockStatus = ClockStatus.clockStatusFrom((byte) source.getClockStatus().getStatus());
return new org.openmuc.jdlms.datatypes.CosemDateTime(date.getYear(), date.getMonth(), date.getDayOfMonth(), date.getDayOfWeek(), time.getHour(), time.getMinute(), time.getSecond(), time.getHundredths(), source.getDeviation(), clockStatus.toArray(new ClockStatus[clockStatus.size()]));
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto in project open-smart-grid-platform by OSGP.
the class SetActivityCalendarCommandExecutorTest method createDefaultActivityCalendar.
private ActivityCalendarDto createDefaultActivityCalendar() {
final List<Short> dayIds = Collections.singletonList((short) 1);
final List<CosemTimeDto> actionStartTimes = Collections.singletonList(new CosemTimeDto(0, 0, 0, 0));
final List<String> weekNames = Collections.singletonList("1");
final List<String> seasonNames = Collections.singletonList("1");
final List<CosemDateDto> seasonStarts = Collections.singletonList(new CosemDateDto(0xFFFF, 1, 1));
return this.createActivityCalendar(seasonNames, seasonStarts, weekNames, dayIds, actionStartTimes);
}
Aggregations