Search in sources :

Example 1 with ResumeScheduleResponse

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

the class ResumeScheduleSteps method getResponseWithCorrelationUID.

private ResumeScheduleResponse getResponseWithCorrelationUID(final String deviceIdentification, final String correlationUID) throws InterruptedException, SoapFaultClientException {
    final ResumeScheduleAsyncRequest request = new ResumeScheduleAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setDeviceId(deviceIdentification);
    asyncRequest.setCorrelationUid(correlationUID);
    request.setAsyncRequest(asyncRequest);
    return Wait.untilAndReturn(() -> {
        final ResumeScheduleResponse retval = this.client.getResumeScheduleResponse(request);
        assertThat(retval).isNotNull();
        return retval;
    });
}
Also used : ResumeScheduleAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.ResumeScheduleAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest) ResumeScheduleAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.ResumeScheduleAsyncRequest) ResumeScheduleResponse(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.ResumeScheduleResponse)

Example 2 with ResumeScheduleResponse

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

the class PublicLightingAdHocManagementEndpoint method getResumeScheduleResponse.

@PayloadRoot(localPart = "ResumeScheduleAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public ResumeScheduleResponse getResumeScheduleResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ResumeScheduleAsyncRequest request) throws OsgpException {
    LOGGER.info("Resume Schedule Async Request received from organisation: {} for device: {}.", organisationIdentification, request.getAsyncRequest().getDeviceId());
    final ResumeScheduleResponse response = new ResumeScheduleResponse();
    try {
        final ResponseMessage message = this.adHocManagementService.dequeueResumeScheduleResponse(request.getAsyncRequest().getCorrelationUid());
        if (message != null) {
            response.setResult(OsgpResultType.fromValue(message.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) ResumeScheduleResponse(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.ResumeScheduleResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 3 with ResumeScheduleResponse

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

the class ResumeScheduleSteps method thenThePlatformBuffersAResumeScheduleResponseMessage.

@Then("^the platform buffers a resume schedule response message for device \"([^\"]*)\"$")
public void thenThePlatformBuffersAResumeScheduleResponseMessage(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
    Wait.until(() -> {
        ResumeScheduleResponse response = null;
        try {
            response = this.getResponseWithCorrelationUID(deviceIdentification, (String) ScenarioContext.current().get(PlatformPubliclightingKeys.KEY_CORRELATION_UID));
        } catch (final Exception e) {
        // do nothing
        }
        assertThat(response).isNotNull();
        assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformPubliclightingKeys.KEY_RESULT)));
    });
}
Also used : OsgpResultType(org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.OsgpResultType) ReadSettingsHelper.getString(org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) ResumeScheduleResponse(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.ResumeScheduleResponse) Then(io.cucumber.java.en.Then)

Aggregations

ResumeScheduleResponse (org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.ResumeScheduleResponse)3 Then (io.cucumber.java.en.Then)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 ResumeScheduleAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.ResumeScheduleAsyncRequest)1 AsyncRequest (org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest)1 OsgpResultType (org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.OsgpResultType)1 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)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 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)1