use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ClockStatus in project open-smart-grid-platform by OSGP.
the class PushSetupAlarmMappingTest method testPushSetupAlarmMappingWithLists.
// To test Mapping if lists contain values
@Test
public void testPushSetupAlarmMappingWithLists() {
// build test data
final CosemObisCode logicalName = new CosemObisCode(new int[] { 1, 2, 3, 4, 5, 6 });
final CosemObjectDefinition cosemObjectDefinition = new CosemObjectDefinition(1, logicalName, 2);
final CosemDateTime startTime = new CosemDateTime(new CosemDate(2016, 3, 17), new CosemTime(11, 52, 45), 0, new ClockStatus(ClockStatus.STATUS_NOT_SPECIFIED));
final CosemDateTime endTime = new CosemDateTime(new CosemDate(2016, 3, 17), new CosemTime(11, 52, 45), 0, new ClockStatus(ClockStatus.STATUS_NOT_SPECIFIED));
final WindowElement windowElement = new WindowElement(startTime, endTime);
final PushSetupAlarm pushSetupAlarm = new PushSetupAlarmBuilder().withFilledLists(cosemObjectDefinition, windowElement).build();
// actual mapping
final PushSetupAlarmDto pushSetupAlarmDto = this.configurationMapper.map(pushSetupAlarm, PushSetupAlarmDto.class);
// check values
this.checkCosemObisCodeMapping(pushSetupAlarm.getLogicalName(), pushSetupAlarmDto.getLogicalName());
this.checkSendDestinationAndMethodMapping(pushSetupAlarm, pushSetupAlarmDto);
this.checkIntegerMapping(pushSetupAlarm, pushSetupAlarmDto);
this.checkNonEmptyListMapping(pushSetupAlarm, pushSetupAlarmDto);
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ClockStatus 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);
}
Aggregations