Search in sources :

Example 1 with DisableDebuggingResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.DisableDebuggingResponse in project open-smart-grid-platform by OSGP.

the class SmartMeteringManagementEndpoint method getDisableDebuggingResponse.

@PayloadRoot(localPart = "DisableDebuggingAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public DisableDebuggingResponse getDisableDebuggingResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final DisableDebuggingAsyncRequest request) throws OsgpException {
    log.info("DisableDebugging response for organisation: {} and device: {}.", organisationIdentification, request.getDeviceIdentification());
    DisableDebuggingResponse response = null;
    try {
        response = new DisableDebuggingResponse();
        final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
        this.throwExceptionIfResultNotOk(responseData, "Disable Debugging");
        response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
        if (responseData.getMessageData() instanceof String) {
            response.setDescription((String) responseData.getMessageData());
        }
    } catch (final ConstraintViolationException e) {
        throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new ValidationException(e.getConstraintViolations()));
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) SetDeviceLifecycleStatusByChannelResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.SetDeviceLifecycleStatusByChannelResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) GetGsmDiagnosticResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.GetGsmDiagnosticResponseData) ConstraintViolationException(javax.validation.ConstraintViolationException) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) DisableDebuggingResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.DisableDebuggingResponse) 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)

Example 2 with DisableDebuggingResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.DisableDebuggingResponse in project open-smart-grid-platform by OSGP.

the class EnableAndDisableDebugging method theDisableDebugResponseShouldBe.

@Then("^the disable debug response should be \"([^\"]*)\"$")
public void theDisableDebugResponseShouldBe(final String result) throws Throwable {
    final DisableDebuggingAsyncRequest disableDebuggingAsyncRequest = DisableDebuggingRequestFactory.fromScenarioContext();
    final DisableDebuggingResponse disableDebuggingResponse = this.smartMeteringManagementResponseClientDisableDebugging.getResponse(disableDebuggingAsyncRequest);
    assertThat(disableDebuggingResponse).as("DisableDebugRequestResponse should not be null").isNotNull();
    assertThat(disableDebuggingResponse.getResult()).as("Expected result").isNotNull();
}
Also used : DisableDebuggingAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.DisableDebuggingAsyncRequest) DisableDebuggingResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.DisableDebuggingResponse) Then(io.cucumber.java.en.Then)

Aggregations

DisableDebuggingResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.DisableDebuggingResponse)2 Then (io.cucumber.java.en.Then)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)1 DisableDebuggingAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.DisableDebuggingAsyncRequest)1 GetGsmDiagnosticResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.GetGsmDiagnosticResponseData)1 SetDeviceLifecycleStatusByChannelResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.SetDeviceLifecycleStatusByChannelResponseData)1 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1