Search in sources :

Example 1 with GetFirmwareVersionGasResponse

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;
}
Also used : FirmwareVersionGasResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse) GetFirmwareVersionGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse) FirmwareVersionGas(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.FirmwareVersionGas) GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) GetFirmwareVersionGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse) IOException(java.io.IOException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 2 with GetFirmwareVersionGasResponse

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);
}
Also used : FirmwareVersionGas(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.FirmwareVersionGas) GetFirmwareVersionGasAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasAsyncRequest) GetFirmwareVersionGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse) Then(io.cucumber.java.en.Then)

Aggregations

FirmwareVersionGas (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.FirmwareVersionGas)2 GetFirmwareVersionGasResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse)2 Then (io.cucumber.java.en.Then)1 IOException (java.io.IOException)1 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)1 GetFirmwareVersionGasAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasAsyncRequest)1 GetKeysResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData)1 FirmwareVersionGasResponse (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1