use of org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.UpdateFirmwareResponse in project open-smart-grid-platform by OSGP.
the class UpdateFirmwareSteps method thePlatformBuffersAUpdateFirmwareResponseMessage.
@Then("^the platform buffers a update firmware response message for device \"([^\"]*)\"$")
public void thePlatformBuffersAUpdateFirmwareResponseMessage(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
final UpdateFirmwareAsyncRequest request = new UpdateFirmwareAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformPubliclightingKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
UpdateFirmwareResponse response = null;
try {
response = this.client.getUpdateFirmware(request);
} catch (final Exception e) {
// do nothing
}
assertThat(response).isNotNull();
assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformPubliclightingKeys.KEY_RESULT)));
});
}
use of org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.UpdateFirmwareResponse in project open-smart-grid-platform by OSGP.
the class FirmwareManagementEndpoint method getUpdateFirmwareResponse.
@PayloadRoot(localPart = "UpdateFirmwareAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public UpdateFirmwareResponse getUpdateFirmwareResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final UpdateFirmwareAsyncRequest request) throws OsgpException {
LOGGER.info("GetUpdateFirmwareResponse Request received from organisation {} for device: {}.", organisationIdentification, request.getAsyncRequest().getDeviceId());
final UpdateFirmwareResponse response = new UpdateFirmwareResponse();
try {
final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
if (responseMessage != null) {
throwExceptionIfResultNotOk(responseMessage, "updating firmware");
response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations