Search in sources :

Example 6 with SpecialDaysRequest

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

the class SetSpecialDaysRequestMappingTest method testSpecialDaysRequestMappingEmptyList.

/**
 * Tests mapping of a SetSpecialDaysRequest, when its SpecialDaysRequestData object has an empty
 * List.
 */
@Test
public void testSpecialDaysRequestMappingEmptyList() {
    // build test data
    // No-arg constructor for SpecialDaysRequestData takes care of creating
    // a empty List.
    final SpecialDaysRequestData specialDaysRequestData = new SpecialDaysRequestData();
    final SetSpecialDaysRequest setSpecialDaysRequest = new SetSpecialDaysRequest();
    setSpecialDaysRequest.setDeviceIdentification(DEVICE_ID);
    setSpecialDaysRequest.setSpecialDaysRequestData(specialDaysRequestData);
    // actual mapping
    final SpecialDaysRequest specialDaysRequest = this.configurationMapper.map(setSpecialDaysRequest, SpecialDaysRequest.class);
    // check mapping
    assertThat(specialDaysRequest).isNotNull();
    assertThat(specialDaysRequest.getDeviceIdentification()).isNotNull();
    assertThat(specialDaysRequest.getSpecialDaysRequestData()).isNotNull();
    assertThat(specialDaysRequest.getSpecialDaysRequestData().getSpecialDays()).isNotNull();
    assertThat(specialDaysRequest.getDeviceIdentification()).isEqualTo(DEVICE_ID);
    assertThat(specialDaysRequest.getSpecialDaysRequestData().getSpecialDays().isEmpty()).isTrue();
}
Also used : SpecialDaysRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest) SetSpecialDaysRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetSpecialDaysRequest) SetSpecialDaysRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetSpecialDaysRequest) SpecialDaysRequestData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SpecialDaysRequestData) Test(org.junit.jupiter.api.Test)

Example 7 with SpecialDaysRequest

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

the class SpecialDaysRequestMappingTest method testSpecialDaysRequestMappingEmptyList.

// To check mapping of SpecialDaysRequest, when its SpecialDaysRequestData
// has an empty List.
@Test
public void testSpecialDaysRequestMappingEmptyList() {
    final String deviceIdentification = "nr1";
    final SpecialDaysRequestData specialDaysRequestData = new SpecialDaysRequestDataBuilder().build();
    final SpecialDaysRequest specialDaysRequestValueObject = new SpecialDaysRequest(deviceIdentification, specialDaysRequestData);
    final SpecialDaysRequestDto specialDaysRequestDto = this.configurationMapper.map(specialDaysRequestValueObject, SpecialDaysRequestDto.class);
    assertThat(specialDaysRequestDto.getDeviceIdentification()).isEqualTo(deviceIdentification);
    assertThat(specialDaysRequestDto.getSpecialDaysRequestData()).isNotNull();
}
Also used : SpecialDaysRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest) SpecialDaysRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDto) SpecialDaysRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequestData) Test(org.junit.jupiter.api.Test)

Example 8 with SpecialDaysRequest

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

the class SpecialDaysRequestMappingTest method testSpecialDaysRequestMappingNull.

// To check mapping of SpecialDaysRequest, when its SpecialDaysRequestData
// is null
@Test
public void testSpecialDaysRequestMappingNull() {
    final String deviceIdentification = "nr1";
    final SpecialDaysRequestData specialDaysRequestData = null;
    final SpecialDaysRequest specialDaysRequestValueObject = new SpecialDaysRequest(deviceIdentification, specialDaysRequestData);
    final SpecialDaysRequestDto specialDaysRequestDto = this.configurationMapper.map(specialDaysRequestValueObject, SpecialDaysRequestDto.class);
    assertThat(specialDaysRequestDto).isNotNull();
    assertThat(specialDaysRequestDto.getDeviceIdentification()).isEqualTo(deviceIdentification);
    assertThat(specialDaysRequestDto.getSpecialDaysRequestData()).isNull();
}
Also used : SpecialDaysRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest) SpecialDaysRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDto) SpecialDaysRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequestData) Test(org.junit.jupiter.api.Test)

Aggregations

SpecialDaysRequest (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest)8 Test (org.junit.jupiter.api.Test)7 SpecialDaysRequestData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequestData)4 SpecialDaysRequestDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDto)4 SetSpecialDaysRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetSpecialDaysRequest)3 SpecialDaysRequestData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SpecialDaysRequestData)3 CosemDate (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemDate)2 SpecialDay (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDay)2 CosemDateDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemDateDto)2 SpecialDayDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDayDto)2 SpecialDaysRequestDataDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDataDto)2 SpecialDay (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SpecialDay)1