use of org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto in project open-smart-grid-platform by OSGP.
the class GetMbusEncryptionKeyStatusRequestMessageProcessor method handleMessage.
@Override
protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable requestObject, final MessageMetadata messageMetadata) throws OsgpException {
this.assertRequestObjectType(GetMbusEncryptionKeyStatusRequestDto.class, requestObject);
final GetMbusEncryptionKeyStatusRequestDto request = (GetMbusEncryptionKeyStatusRequestDto) requestObject;
return this.configurationService.requestGetMbusEncryptionKeyStatus(conn, device, request, messageMetadata);
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto in project open-smart-grid-platform by OSGP.
the class GetMbusEncryptionKeyStatusRequestDataMapperTest method shouldConvertValueObjectToDto.
@Test
public void shouldConvertValueObjectToDto() {
final GetMbusEncryptionKeyStatusRequestData source = this.makeRequest();
final GetMbusEncryptionKeyStatusRequestDto result = this.mapper.map(source, GetMbusEncryptionKeyStatusRequestDto.class);
assertThat(result).withFailMessage(MAPPED_OBJECT_VALUE_MESSAGE).isNotNull();
assertThat(result.getMbusDeviceIdentification()).withFailMessage(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(source.getMbusDeviceIdentification());
assertThat(result.getChannel()).withFailMessage(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(source.getChannel());
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto in project open-smart-grid-platform by OSGP.
the class ConfigurationService method getMbusEncryptionKeyStatus.
public void getMbusEncryptionKeyStatus(final MessageMetadata messageMetadata) throws FunctionalException {
log.info("getMbusEncryptionKeyStatus for organisationIdentification: {} for deviceIdentification: {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification());
final SmartMeter mbusDevice = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
final Device gatewayDevice = mbusDevice.getGatewayDevice();
if (gatewayDevice == null) {
throw new FunctionalException(FunctionalExceptionType.GATEWAY_DEVICE_NOT_SET_FOR_MBUS_DEVICE, ComponentType.DOMAIN_SMART_METERING, new GatewayDeviceNotSetForMbusDeviceException());
}
final GetMbusEncryptionKeyStatusRequestDto requestDto = new GetMbusEncryptionKeyStatusRequestDto(mbusDevice.getDeviceIdentification(), mbusDevice.getChannel());
this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withDeviceIdentification(gatewayDevice.getDeviceIdentification()).withIpAddress(gatewayDevice.getIpAddress()).withNetworkSegmentIds(gatewayDevice.getBtsId(), gatewayDevice.getCellId()).build());
}
Aggregations