Search in sources :

Example 1 with SetTransitionResponse

use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionResponse in project open-smart-grid-platform by OSGP.

the class SetTransitionSteps method thePlatformDoesNotBufferASetTransitionResponseMessage.

@Then("^the platform does not buffer a set transition response message for device \"([^\"]*)\"$")
public void thePlatformDoesNotBufferASetTransitionResponseMessage(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
    final SetTransitionAsyncRequest request = new SetTransitionAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setDeviceId(deviceIdentification);
    asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformPubliclightingKeys.KEY_CORRELATION_UID));
    request.setAsyncRequest(asyncRequest);
    Wait.until(() -> {
        SetTransitionResponse response = null;
        try {
            response = this.client.getSetTransitionResponse(request);
        } catch (final Exception e) {
        // do nothing
        }
        assertThat(response).isNotNull();
        assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformPubliclightingKeys.KEY_RESULT)));
    });
}
Also used : SetTransitionAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionAsyncRequest) SetTransitionAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest) OsgpResultType(org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.OsgpResultType) SetTransitionResponse(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionResponse) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) Then(io.cucumber.java.en.Then)

Example 2 with SetTransitionResponse

use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionResponse in project open-smart-grid-platform by OSGP.

the class PublicLightingAdHocManagementEndpoint method getSetTransitionResponse.

@PayloadRoot(localPart = "SetTransitionAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SetTransitionResponse getSetTransitionResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetTransitionAsyncRequest request) throws OsgpException {
    LOGGER.info("Get Set Transition Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
    final SetTransitionResponse response = new SetTransitionResponse();
    try {
        final ResponseMessage message = this.adHocManagementService.dequeueSetTransitionResponse(request.getAsyncRequest().getCorrelationUid());
        if (message != null) {
            response.setResult(OsgpResultType.fromValue(message.getResult().getValue()));
        }
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : SetTransitionResponse(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionResponse) 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) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 3 with SetTransitionResponse

use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionResponse in project open-smart-grid-platform by OSGP.

the class SetTransitionSteps method thePlatformBuffersASetTransitionResponseMessage.

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

Aggregations

SetTransitionResponse (org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionResponse)3 Then (io.cucumber.java.en.Then)2 SetTransitionAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionAsyncRequest)2 AsyncRequest (org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest)2 OsgpResultType (org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.OsgpResultType)2 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)2 ConstraintViolationException (javax.validation.ConstraintViolationException)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