use of org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootResponse in project open-smart-grid-platform by OSGP.
the class AdHocManagementEndpoint method getSetRebootResponse.
@PayloadRoot(localPart = "SetRebootAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SetRebootResponse getSetRebootResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetRebootAsyncRequest request) throws OsgpException {
LOGGER.info("Get Set Reboot Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
final SetRebootResponse response = new SetRebootResponse();
try {
final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
if (responseMessage != null) {
throwExceptionIfResultNotOk(responseMessage, "rebooting");
response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootResponse in project open-smart-grid-platform by OSGP.
the class SetRebootSteps method thenThePlatformBuffersASetRebootResponseMessage.
@Then("^the platform buffers a set reboot response message for device \"([^\"]*)\"$")
public void thenThePlatformBuffersASetRebootResponseMessage(final String deviceIdentification, final Map<String, String> expectedResult) {
final SetRebootAsyncRequest request = new SetRebootAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
SetRebootResponse response = null;
try {
response = this.client.getSetRebootResponse(request);
} catch (final Exception e) {
// do nothing
}
assertThat(response).isNotNull();
assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformKeys.KEY_RESULT)));
});
}
Aggregations