Search in sources :

Example 1 with StartDeviceTestResponse

use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse in project open-smart-grid-platform by OSGP.

the class StartDeviceSteps method thePlatformBuffersNoStartDeviceTestResponseMessageForDevice.

@Then("^the platform buffers no start device test response message for device \"([^\"]*)\"$")
public void thePlatformBuffersNoStartDeviceTestResponseMessageForDevice(final String deviceIdentification) throws InterruptedException {
    final StartDeviceTestAsyncRequest request = new StartDeviceTestAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setDeviceId(deviceIdentification);
    asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
    request.setAsyncRequest(asyncRequest);
    Wait.until(() -> {
        StartDeviceTestResponse response = null;
        try {
            response = this.client.getStartDeviceTestResponse(request);
        } catch (final Exception e) {
        // do nothing
        }
        assertThat(response).isNotNull();
        assertThat(response.getResult()).isNotEqualTo(OsgpResultType.NOT_FOUND);
    });
}
Also used : StartDeviceTestAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) IOException(java.io.IOException) WebServiceSecurityException(org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException) GeneralSecurityException(java.security.GeneralSecurityException) StartDeviceTestAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestAsyncRequest) StartDeviceTestResponse(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse) Then(io.cucumber.java.en.Then)

Example 2 with StartDeviceTestResponse

use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse in project open-smart-grid-platform by OSGP.

the class StartDeviceSteps method thePlatformBuffersAStartDeviceResponseMessageForDevice.

@Then("^the platform buffers a start device response message for device \"([^\"]*)\"$")
public void thePlatformBuffersAStartDeviceResponseMessageForDevice(final String deviceIdentification, final Map<String, String> expectedResult) throws InterruptedException {
    final StartDeviceTestAsyncRequest request = new StartDeviceTestAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setDeviceId(deviceIdentification);
    asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
    request.setAsyncRequest(asyncRequest);
    Wait.until(() -> {
        StartDeviceTestResponse response = null;
        try {
            response = this.client.getStartDeviceTestResponse(request);
        } catch (final Exception e) {
        // do nothing
        }
        assertThat(response).isNotNull();
        assertThat(response.getResult()).isEqualTo(getEnum(expectedResult, PlatformKeys.KEY_RESULT, OsgpResultType.class));
    });
}
Also used : StartDeviceTestAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest) OsgpResultType(org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) IOException(java.io.IOException) WebServiceSecurityException(org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException) GeneralSecurityException(java.security.GeneralSecurityException) StartDeviceTestAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestAsyncRequest) StartDeviceTestResponse(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse) Then(io.cucumber.java.en.Then)

Example 3 with StartDeviceTestResponse

use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse in project open-smart-grid-platform by OSGP.

the class DeviceInstallationEndpoint method getStartDeviceTestResponse.

@PayloadRoot(localPart = "StartDeviceTestAsyncRequest", namespace = DEVICE_INSTALLATION_NAMESPACE)
@ResponsePayload
public StartDeviceTestResponse getStartDeviceTestResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final StartDeviceTestAsyncRequest request) throws OsgpException {
    LOGGER.info("Get Start Device Test Response received from organisation: {} for device: {}.", organisationIdentification, request.getAsyncRequest().getDeviceId());
    final StartDeviceTestResponse response = new StartDeviceTestResponse();
    try {
        final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
        if (responseMessage != null) {
            throwExceptionIfResultNotOk(responseMessage, "starting device test");
            response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
        }
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ConstraintViolationException(javax.validation.ConstraintViolationException) StartDeviceTestResponse(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

StartDeviceTestResponse (org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse)3 Then (io.cucumber.java.en.Then)2 IOException (java.io.IOException)2 GeneralSecurityException (java.security.GeneralSecurityException)2 AsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest)2 StartDeviceTestAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestAsyncRequest)2 WebServiceSecurityException (org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException)2 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)2 ConstraintViolationException (javax.validation.ConstraintViolationException)1 OsgpResultType (org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType)1 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)1 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1