Search in sources :

Example 1 with SetRebootResponse

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

the class AdHocManagementEndpoint method getSetRebootResponse.

@PayloadRoot(localPart = "SetRebootAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SetRebootResponse getSetRebootResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetRebootAsyncRequest request) throws OsgpException {
    LOGGER.info("Get Set Reboot Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
    final SetRebootResponse response = new SetRebootResponse();
    try {
        final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
        if (responseMessage != null) {
            throwExceptionIfResultNotOk(responseMessage, "rebooting");
            response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
        }
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : SetRebootResponse(org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootResponse) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 2 with SetRebootResponse

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

the class SetRebootSteps method thenThePlatformBuffersASetRebootResponseMessage.

@Then("^the platform buffers a set reboot response message for device \"([^\"]*)\"$")
public void thenThePlatformBuffersASetRebootResponseMessage(final String deviceIdentification, final Map<String, String> expectedResult) {
    final SetRebootAsyncRequest request = new SetRebootAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setDeviceId(deviceIdentification);
    asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
    request.setAsyncRequest(asyncRequest);
    Wait.until(() -> {
        SetRebootResponse response = null;
        try {
            response = this.client.getSetRebootResponse(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 : AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest) SetRebootAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootAsyncRequest) SetRebootAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootAsyncRequest) OsgpResultType(org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType) SetRebootResponse(org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootResponse) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) Then(io.cucumber.java.en.Then)

Aggregations

SetRebootResponse (org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootResponse)2 Then (io.cucumber.java.en.Then)1 SetRebootAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.adhocmanagement.SetRebootAsyncRequest)1 AsyncRequest (org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest)1 OsgpResultType (org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType)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