Search in sources :

Example 1 with AddDeviceResponse

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);
}
Also used : AddDeviceAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncRequest) AddDeviceResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse) Then(io.cucumber.java.en.Then)

Example 2 with AddDeviceResponse

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);
}
Also used : WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) AddDeviceResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse)

Example 3 with AddDeviceResponse

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;
}
Also used : ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) AddDeviceResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse) ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ConstraintViolationException(javax.validation.ConstraintViolationException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

AddDeviceResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse)3 Then (io.cucumber.java.en.Then)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)1 AddDeviceAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceAsyncRequest)1 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 WebServiceTemplate (org.springframework.ws.client.core.WebServiceTemplate)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1