use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionResponse in project open-smart-grid-platform by OSGP.
the class GetFirmwareVersion method theFirmwareVersionResultShouldBeReturned.
@Then("^the firmware version result should be returned$")
public void theFirmwareVersionResultShouldBeReturned(final Map<String, String> settings) throws Throwable {
final GetFirmwareVersionAsyncRequest getFirmwareVersionAsyncRequest = FirmwareVersionRequestFactory.fromScenarioContext();
final GetFirmwareVersionResponse getFirmwareVersionResponse = this.smartMeteringConfigurationClient.retrieveGetFirmwareVersionResponse(getFirmwareVersionAsyncRequest);
assertThat(getFirmwareVersionResponse.getResult()).as("Get firmware version response has result null").isNotNull();
assertThat(getFirmwareVersionResponse.getResult()).as("Response should be OK").isEqualTo(OsgpResultType.OK);
final List<FirmwareVersion> firmwareVersions = getFirmwareVersionResponse.getFirmwareVersion();
this.checkFirmwareVersionResult(settings, firmwareVersions);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getGetFirmwareVersionResponse.
/**
* Gets the Firmware version response from the database (if it is there) and returns {@link
* GetFirmwareVersionResponse} containing those firmware versions.
*
* @param organisationIdentification {@link String} containing the identification of the
* organization
* @param request {@link GetFirmwareVersionAsyncRequest} containing the correlation id as the
* response identifier
* @return {@link GetFirmwareVersionResponse} containing the firmware version(s) for the device.
* @throws OsgpException is thrown when the correlationId cannot be found in the database
*/
@PayloadRoot(localPart = "GetFirmwareVersionAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetFirmwareVersionResponse getGetFirmwareVersionResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetFirmwareVersionAsyncRequest request) throws OsgpException {
log.info("GetFirmwareVersionResponse Request received from organisation {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
final GetFirmwareVersionResponse response = new GetFirmwareVersionResponse();
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 List<FirmwareVersion> target = response.getFirmwareVersion();
final FirmwareVersionResponse firmwareVersionResponse = (FirmwareVersionResponse) responseData.getMessageData();
target.addAll(this.configurationMapper.mapAsList(firmwareVersionResponse.getFirmwareVersions(), FirmwareVersion.class));
} else {
log.info("Get Firmware Version firmware is null");
}
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations