use of org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.GetFirmwareVersionAsyncResponse in project open-smart-grid-platform by OSGP.
the class GetFirmwareVersionSteps method theGetFirmwareVersionResponseContains.
/**
* The check for the response from the Platform.
*
* @param expectedResponseData The table with the expected fields in the response.
* @apiNote The response will contain the correlation uid, so store that in the current scenario
* context for later use.
*/
@Then("^the get firmware version async response contains$")
public void theGetFirmwareVersionResponseContains(final Map<String, String> expectedResponseData) {
final GetFirmwareVersionAsyncResponse asyncResponse = (GetFirmwareVersionAsyncResponse) ScenarioContext.current().get(PlatformKeys.RESPONSE);
assertThat(asyncResponse.getAsyncResponse().getDeviceId()).isEqualTo(getString(expectedResponseData, PlatformKeys.KEY_DEVICE_IDENTIFICATION));
assertThat(asyncResponse.getAsyncResponse().getCorrelationUid()).isNotNull();
// Save the returned CorrelationUid in the Scenario related context for
// further use.
saveCorrelationUidInScenarioContext(asyncResponse.getAsyncResponse().getCorrelationUid(), getString(expectedResponseData, PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION, PlatformDefaults.DEFAULT_ORGANIZATION_IDENTIFICATION));
LOGGER.info("Got CorrelationUid: [" + ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID) + "]");
}
use of org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.GetFirmwareVersionAsyncResponse in project open-smart-grid-platform by OSGP.
the class FirmwareManagementEndpoint method getFirmwareVersion.
// === GET FIRMWARE VERSION ===
@PayloadRoot(localPart = "GetFirmwareVersionRequest", namespace = NAMESPACE)
@ResponsePayload
public GetFirmwareVersionAsyncResponse getFirmwareVersion(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetFirmwareVersionRequest request, @MessagePriority final String messagePriority) throws OsgpException {
LOGGER.info("GetFirmwareVersion Request received from organisation {} for device {} with message priority: {}.", organisationIdentification, request.getDeviceIdentification(), messagePriority);
final GetFirmwareVersionAsyncResponse response = new GetFirmwareVersionAsyncResponse();
try {
final AsyncResponse asyncResponse = new AsyncResponse();
final String correlationUid = this.firmwareManagementService.enqueueGetFirmwareRequest(organisationIdentification, request.getDeviceIdentification(), MessagePriorityEnum.getMessagePriority(messagePriority));
asyncResponse.setCorrelationUid(correlationUid);
asyncResponse.setDeviceId(request.getDeviceIdentification());
response.setAsyncResponse(asyncResponse);
} catch (final ConstraintViolationException e) {
LOGGER.error("Exception getting firmware version", e);
this.handleException(e);
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations