use of org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationResponse in project open-smart-grid-platform by OSGP.
the class SetConfigurationSteps method thePlatformBufferesASetConfigurationResponseMessageForDevice.
@Then("^the platform buffers a set configuration response message for device \"([^\"]*)\"$")
public void thePlatformBufferesASetConfigurationResponseMessageForDevice(final String deviceIdentification, final Map<String, String> expectedResponseData) throws Throwable {
final SetConfigurationAsyncRequest request = new SetConfigurationAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
final SetConfigurationResponse response = Wait.untilAndReturn(() -> {
final SetConfigurationResponse retval = this.client.getSetConfiguration(request);
assertThat(retval).isNotNull();
return retval;
});
assertThat(response.getResult()).isEqualTo(getEnum(expectedResponseData, PlatformKeys.KEY_RESULT, OsgpResultType.class));
}
use of org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.SetConfigurationResponse in project open-smart-grid-platform by OSGP.
the class ConfigurationManagementEndpoint method getSetConfigurationResponse.
@PayloadRoot(localPart = "SetConfigurationAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SetConfigurationResponse getSetConfigurationResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetConfigurationAsyncRequest request) throws OsgpException {
LOGGER.info("Get Set Configuration Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
final SetConfigurationResponse response = new SetConfigurationResponse();
try {
final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
if (responseMessage != null) {
throwExceptionIfResultNotOk(responseMessage, "setting configuration");
response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
}
} catch (final Exception e) {
this.handleException(e);
}
if (OsgpResultType.OK.equals(response.getResult())) {
try {
this.notificationService.sendNotification(organisationIdentification, request.getAsyncRequest().getDeviceId(), response.getResult().name(), request.getAsyncRequest().getCorrelationUid(), null, NotificationType.DEVICE_UPDATED);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
return response;
}
Aggregations