use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getGetFirmwareVersionGasResponse.
@PayloadRoot(localPart = "GetFirmwareVersionGasAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetFirmwareVersionGasResponse getGetFirmwareVersionGasResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetFirmwareVersionGasAsyncRequest request) throws OsgpException {
log.info("GetFirmwareVersionGasResponse request received from organisation {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
final GetFirmwareVersionGasResponse response = new GetFirmwareVersionGasResponse();
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
if (responseData != null) {
response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
if (responseData.getMessageData() != null) {
final FirmwareVersionGasResponse firmwareVersionGasResponse = (FirmwareVersionGasResponse) responseData.getMessageData();
final FirmwareVersionGas firmwareVersionGas = this.configurationMapper.map(firmwareVersionGasResponse.getFirmwareVersion(), FirmwareVersionGas.class);
response.setFirmwareVersion(firmwareVersionGas);
} else {
log.info("GetFirmwareVersionGas: firmware is null");
}
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse in project open-smart-grid-platform by OSGP.
the class GetFirmwareVersion method theFirmwareVersionGasResultShouldBeReturned.
@Then("^the firmware version gas result should be returned$")
public void theFirmwareVersionGasResultShouldBeReturned(final Map<String, String> settings) throws Throwable {
final GetFirmwareVersionGasAsyncRequest gasAsyncRequest = new GetFirmwareVersionGasAsyncRequest();
gasAsyncRequest.setCorrelationUid(RequestFactoryHelper.getCorrelationUidFromScenarioContext());
gasAsyncRequest.setDeviceIdentification(settings.get(PlatformSmartmeteringKeys.DEVICE_IDENTIFICATION));
final GetFirmwareVersionGasResponse gasResponse = this.smartMeteringConfigurationClient.retrieveGetFirmwareVersionGasResponse(gasAsyncRequest);
assertThat(gasResponse.getResult()).as("Get firmware version response has result null").isNotNull();
assertThat(gasResponse.getResult()).as("Response should be OK").isEqualTo(OsgpResultType.OK);
final FirmwareVersionGas firmwareVersion = gasResponse.getFirmwareVersion();
this.checkFirmwareVersionGasResult(settings, firmwareVersion);
}
Aggregations