use of org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootAsyncResponse in project open-smart-grid-platform by OSGP.
the class SetRebootSteps method theSetRebootAsyncResponseContains.
/**
* 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 set reboot async response contains$")
public void theSetRebootAsyncResponseContains(final Map<String, String> expectedResponseData) {
final SetRebootAsyncResponse asyncResponse = (SetRebootAsyncResponse) ScenarioContext.current().get(PlatformKeys.RESPONSE);
assertThat(asyncResponse.getAsyncResponse().getCorrelationUid()).isNotNull();
assertThat(asyncResponse.getAsyncResponse().getDeviceId()).isEqualTo(getString(expectedResponseData, PlatformKeys.KEY_DEVICE_IDENTIFICATION));
// 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.adhocmanagement.SetRebootAsyncResponse in project open-smart-grid-platform by OSGP.
the class AdHocManagementEndpoint method setReboot.
// === SET REBOOT ===
@PayloadRoot(localPart = "SetRebootRequest", namespace = NAMESPACE)
@ResponsePayload
public SetRebootAsyncResponse setReboot(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetRebootRequest request, @MessagePriority final String messagePriority) throws OsgpException {
LOGGER.info("Set Reboot received from organisation: {} for device: {} with message priority: {}.", organisationIdentification, request.getDeviceIdentification(), messagePriority);
final SetRebootAsyncResponse response = new SetRebootAsyncResponse();
try {
final String correlationUid = this.adHocManagementService.enqueueSetRebootRequest(organisationIdentification, request.getDeviceIdentification(), MessagePriorityEnum.getMessagePriority(messagePriority));
final AsyncResponse asyncResponse = new AsyncResponse();
asyncResponse.setCorrelationUid(correlationUid);
asyncResponse.setDeviceId(request.getDeviceIdentification());
response.setAsyncResponse(asyncResponse);
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations