use of org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataResponse in project open-smart-grid-platform by OSGP.
the class AdHocManagementEndpoint method getSetDataResponse.
@PayloadRoot(localPart = "SetDataAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SetDataResponse getSetDataResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetDataAsyncRequest request) throws OsgpException {
LOGGER.info("Get Set Data Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
final SetDataResponse response = new SetDataResponse();
try {
final EmptyResponse setDataResponse = this.service.dequeueSetDataResponse(request.getAsyncRequest().getCorrelationUid());
if (setDataResponse != null) {
response.setResult(OsgpResultType.OK);
} else {
response.setResult(OsgpResultType.NOT_FOUND);
}
} catch (final ResponseNotFoundException e) {
LOGGER.warn("ResponseNotFoundException for getSetDataResponse", e);
response.setResult(OsgpResultType.NOT_FOUND);
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataResponse in project open-smart-grid-platform by OSGP.
the class AdHocManagementClient method setData.
public SetDataResponse setData(final SetDataAsyncRequest request) throws WebServiceSecurityException {
final String correlationUid = request.getAsyncRequest().getCorrelationUid();
this.waitForNotification(correlationUid);
final WebServiceTemplate webServiceTemplate = this.webServiceTemplateFactoryMicrogridsAdHocManagement.getTemplate(this.getOrganizationIdentification(), this.getUserName());
return (SetDataResponse) webServiceTemplate.marshalSendAndReceive(request);
}
use of org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataResponse in project open-smart-grid-platform by OSGP.
the class SetDataSteps method theSetDataResponseShouldBeReturned.
@Then("^the set data response should be returned$")
public void theSetDataResponseShouldBeReturned(final Map<String, String> responseParameters) throws Throwable {
final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID);
final Map<String, String> extendedParameters = SettingsHelper.addDefault(responseParameters, PlatformKeys.KEY_CORRELATION_UID, correlationUid);
final SetDataAsyncRequest setDataAsyncRequest = SetDataRequestBuilder.fromParameterMapAsync(extendedParameters);
final SetDataResponse response = this.client.setData(setDataAsyncRequest);
final String expectedResult = responseParameters.get(PlatformKeys.KEY_RESULT);
assertThat(response.getResult()).as("Result").isNotNull();
assertThat(response.getResult().name()).as("Result").isEqualTo(expectedResult);
}
Aggregations