use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleAsyncResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringBundleEndpoint method bundleRequest.
@PayloadRoot(localPart = "BundleRequest", namespace = NAMESPACE)
@ResponsePayload
public BundleAsyncResponse bundleRequest(@ResponseUrl final String responseUrl, @MessageMetadata final org.opensmartgridplatform.shared.infra.jms.MessageMetadata messageMetadata, @RequestPayload final BundleRequest request) throws OsgpException {
final String organisationIdentification = messageMetadata.getOrganisationIdentification();
final String deviceIdentification = request.getDeviceIdentification();
log.info("Incoming BundleRequest with responseUrl {} and {} actions. [deviceId={} | organisationId={}]", responseUrl, request.getActions().getActionList().size(), deviceIdentification, organisationIdentification);
BundleAsyncResponse response = null;
try {
response = new BundleAsyncResponse();
final List<ActionRequest> actionRequestList = this.actionMapperService.mapAllActions(request.getActions().getActionList());
final String correlationUid = this.bundleService.enqueueBundleRequest(messageMetadata.builder().withDeviceIdentification(deviceIdentification).withMessageType(MessageType.HANDLE_BUNDLED_ACTIONS.name()).build(), actionRequestList);
log.info("BundleRequest placed on queue [correlationId={} | deviceId={} | organisationId={}]", correlationUid, deviceIdentification, organisationIdentification);
response.setCorrelationUid(correlationUid);
response.setDeviceIdentification(request.getDeviceIdentification());
this.saveResponseUrlIfNeeded(correlationUid, responseUrl);
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleAsyncResponse in project open-smart-grid-platform by OSGP.
the class BundleSteps method theBundleRequestIsReceived.
@When("^the bundle request is received$")
public void theBundleRequestIsReceived() throws Throwable {
final BundleRequest request = (BundleRequest) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_REQUEST);
final BundleAsyncResponse asyncResponse = this.client.sendBundleRequest(request);
assertThat(asyncResponse).isNotNull();
ScenarioContextHelper.saveAsyncResponse(asyncResponse);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleAsyncResponse in project open-smart-grid-platform by OSGP.
the class BundleSteps method theBundleRequestIsReceivedWithHeaders.
@When("^the bundle request is received with headers$")
public void theBundleRequestIsReceivedWithHeaders(final Map<String, String> settings) throws Throwable {
final BundleRequest request = (BundleRequest) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_REQUEST);
/*
* Scenarios containing this step may include a data table with two columns. The first column
* should have the local part of the name of a SOAP header element and the second column should
* have the text value for the named SOAP header element.
*
* These headers can be picked up by classes like those in osgp-adapter-ws-shared package
* org.opensmartgridplatform.adapter.ws.endpointinterceptors, for instance the MessageMetadata
* handling SoapHeaderMessageMetadataInterceptor or configurations of the more generic
* SoapHeaderInterceptor.
*/
final BundleAsyncResponse asyncResponse = this.client.sendBundleRequest(request, this.additionalSoapHeaders(settings));
assertThat(asyncResponse).isNotNull();
ScenarioContextHelper.saveAsyncResponse(asyncResponse);
}
Aggregations