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();
}
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());
}
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());
}
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());
}
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);
}
Aggregations