Search in sources :

Example 1 with AdministrativeStatusTypeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto in project open-smart-grid-platform by OSGP.

the class AdministrativeStatusTypeMappingTest method testNull.

// check if mapping succeeds if the object is null.
@Test
public void testNull() {
    // build test data
    final AdministrativeStatusType administrativeStatusType = null;
    // actual mapping
    final AdministrativeStatusTypeDto administrativeStatusTypeDto = this.configurationMapper.map(administrativeStatusType, AdministrativeStatusTypeDto.class);
    // check if value is mapped correctly
    assertThat(administrativeStatusTypeDto).isNull();
}
Also used : AdministrativeStatusType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType) AdministrativeStatusTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto) Test(org.junit.jupiter.api.Test)

Example 2 with AdministrativeStatusTypeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto in project open-smart-grid-platform by OSGP.

the class AdministrativeStatusTypeMappingTest method testForValueOn.

// To see if mapping succeeds when a value is set to On.
@Test
public void testForValueOn() {
    // build test data
    final AdministrativeStatusType administrativeStatusType = AdministrativeStatusType.ON;
    // actual mapping
    final AdministrativeStatusTypeDto administrativeStatusTypeDto = this.configurationMapper.map(administrativeStatusType, AdministrativeStatusTypeDto.class);
    // check if value is mapped correctly
    assertThat(administrativeStatusTypeDto).isNotNull();
    assertThat(administrativeStatusTypeDto.name()).isEqualTo(administrativeStatusType.name());
}
Also used : AdministrativeStatusType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType) AdministrativeStatusTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto) Test(org.junit.jupiter.api.Test)

Example 3 with AdministrativeStatusTypeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto in project open-smart-grid-platform by OSGP.

the class ConfigurationService method setAdministrativeStatus.

public void setAdministrativeStatus(final MessageMetadata messageMetadata, final AdministrativeStatusType administrativeStatusType) throws FunctionalException {
    log.info("Set Administrative Status for organisationIdentification: {} for deviceIdentification: {} to status:" + " {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification(), administrativeStatusType);
    final SmartMeter smartMeter = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
    final AdministrativeStatusTypeDto requestDto = this.configurationMapper.map(administrativeStatusType, AdministrativeStatusTypeDto.class);
    this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withIpAddress(smartMeter.getIpAddress()).withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId()).build());
}
Also used : SmartMeter(org.opensmartgridplatform.domain.core.entities.SmartMeter) AdministrativeStatusTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto)

Example 4 with AdministrativeStatusTypeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto in project open-smart-grid-platform by OSGP.

the class ConfigurationService method getAdministrativeStatus.

public void getAdministrativeStatus(final MessageMetadata messageMetadata, final AdministrativeStatusType administrativeStatusType) throws FunctionalException {
    log.info("Get Administrative Status for organisationIdentification: {} for deviceIdentification: {} to status:" + " {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification(), administrativeStatusType);
    final SmartMeter smartMeter = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
    final AdministrativeStatusTypeDto requestDto = this.configurationMapper.map(administrativeStatusType, AdministrativeStatusTypeDto.class);
    this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withIpAddress(smartMeter.getIpAddress()).withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId()).build());
}
Also used : SmartMeter(org.opensmartgridplatform.domain.core.entities.SmartMeter) AdministrativeStatusTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto)

Example 5 with AdministrativeStatusTypeDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto in project open-smart-grid-platform by OSGP.

the class GetAdministrativeStateResponseMessageProcessor method handleMessage.

@Override
protected void handleMessage(final MessageMetadata deviceMessageMetadata, final ResponseMessage responseMessage, final OsgpException osgpException) {
    final AdministrativeStatusTypeDto administrativeStatusTypeDto = (AdministrativeStatusTypeDto) responseMessage.getDataObject();
    this.configurationService.handleGetAdministrativeStatusResponse(deviceMessageMetadata, responseMessage.getResult(), osgpException, administrativeStatusTypeDto);
}
Also used : AdministrativeStatusTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto)

Aggregations

AdministrativeStatusTypeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto)8 Test (org.junit.jupiter.api.Test)4 AdministrativeStatusType (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType)4 SmartMeter (org.opensmartgridplatform.domain.core.entities.SmartMeter)2