use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse in project open-smart-grid-platform by OSGP.
the class AddDeviceSteps method theAddDeviceResponseShouldBeReturned.
@Then("^the add device response should be returned$")
public void theAddDeviceResponseShouldBeReturned(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 AddDeviceAsyncRequest addDeviceAsyncRequest = AddDeviceRequestFactory.fromParameterMapAsync(extendedParameters);
final AddDeviceResponse response = this.smartMeteringInstallationClient.getAddDeviceResponse(addDeviceAsyncRequest);
final String expectedResult = responseParameters.get(PlatformKeys.KEY_RESULT);
assertThat(response.getResult()).as("Result").isNotNull();
assertThat(response.getResult().name()).as("Result").isEqualTo(expectedResult);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringInstallationClient method getAddDeviceResponse.
public AddDeviceResponse getAddDeviceResponse(final AddDeviceAsyncRequest asyncRequest) throws WebServiceSecurityException {
final String correlationUid = asyncRequest.getCorrelationUid();
this.waitForNotification(correlationUid);
final WebServiceTemplate webServiceTemplate = this.smartMeteringInstallationWebServiceTemplateFactory.getTemplate(this.getOrganizationIdentification(), this.getUserName());
return (AddDeviceResponse) webServiceTemplate.marshalSendAndReceive(asyncRequest);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringInstallationEndpoint method getAddDeviceResponse.
@PayloadRoot(localPart = "AddDeviceAsyncRequest", namespace = SMARTMETER_INSTALLATION_NAMESPACE)
@ResponsePayload
public AddDeviceResponse getAddDeviceResponse(@RequestPayload final AddDeviceAsyncRequest request) throws OsgpException {
AddDeviceResponse response = null;
try {
response = new AddDeviceResponse();
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "Add Device");
response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
if (responseData.getMessageData() instanceof String) {
response.setDescription((String) responseData.getMessageData());
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations