use of org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.GetConfigurationAsyncResponse in project open-smart-grid-platform by OSGP.
the class GetConfigurationSteps method theGetConfigurationResponseContains.
/**
* 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.
* @throws Throwable
*/
@Then("^the get configuration async response contains$")
public void theGetConfigurationResponseContains(final Map<String, String> expectedResponseData) throws Throwable {
final GetConfigurationAsyncResponse asyncResponse = (GetConfigurationAsyncResponse) 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.configurationmanagement.GetConfigurationAsyncResponse in project open-smart-grid-platform by OSGP.
the class ConfigurationManagementEndpoint method getConfiguration.
@PayloadRoot(localPart = "GetConfigurationRequest", namespace = NAMESPACE)
@ResponsePayload
public GetConfigurationAsyncResponse getConfiguration(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetConfigurationRequest request, @MessagePriority final String messagePriority) throws OsgpException {
LOGGER.info("Get Configuration Request received from organisation: {} for device: {} with message priority: {}.", organisationIdentification, request.getDeviceIdentification(), messagePriority);
final GetConfigurationAsyncResponse response = new GetConfigurationAsyncResponse();
try {
final String correlationUid = this.configurationManagementService.enqueueGetConfigurationRequest(organisationIdentification, request.getDeviceIdentification(), MessagePriorityEnum.getMessagePriority(messagePriority));
final AsyncResponse asyncResponse = new AsyncResponse();
asyncResponse.setCorrelationUid(correlationUid);
asyncResponse.setDeviceId(request.getDeviceIdentification());
response.setAsyncResponse(asyncResponse);
} catch (final ConstraintViolationException e) {
throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations()));
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations