Search in sources :

Example 1 with SetEventNotificationsResponse

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

the class SetEventNotificationsSteps method thePlatformBuffersASetEventNotificationResponseMessageForDevice.

@Then("^the platform buffers a set event notification response message for device \"([^\"]*)\"")
public void thePlatformBuffersASetEventNotificationResponseMessageForDevice(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
    final SetEventNotificationsAsyncRequest request = new SetEventNotificationsAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setDeviceId(deviceIdentification);
    asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
    request.setAsyncRequest(asyncRequest);
    Wait.until(() -> {
        SetEventNotificationsResponse response = null;
        try {
            response = this.client.getSetEventNotificationsResponse(request);
        } catch (final Exception e) {
        // do nothing
        }
        assertThat(response).isNotNull();
        assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformKeys.KEY_RESULT)));
    });
}
Also used : SetEventNotificationsResponse(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetEventNotificationsResponse) SetEventNotificationsAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetEventNotificationsAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest) OsgpResultType(org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType) SetEventNotificationsAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetEventNotificationsAsyncRequest) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) Then(io.cucumber.java.en.Then)

Example 2 with SetEventNotificationsResponse

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

the class DeviceManagementEndpoint method getSetEventNotificationsResponse.

@PayloadRoot(localPart = "SetEventNotificationsAsyncRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public SetEventNotificationsResponse getSetEventNotificationsResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetEventNotificationsAsyncRequest request) throws OsgpException {
    LOGGER.info("Get Set Event Notifications Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
    final SetEventNotificationsResponse response = new SetEventNotificationsResponse();
    try {
        final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
        if (responseMessage != null) {
            throwExceptionIfResultNotOk(responseMessage, "setting event notifications");
            response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
        }
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : SetEventNotificationsResponse(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetEventNotificationsResponse) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) 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

SetEventNotificationsResponse (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetEventNotificationsResponse)2 Then (io.cucumber.java.en.Then)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 AsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest)1 OsgpResultType (org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType)1 SetEventNotificationsAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetEventNotificationsAsyncRequest)1 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)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 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)1