Search in sources :

Example 1 with SetDeviceLifecycleStatusAsyncResponse

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

the class DeviceManagementEndpoint method setDeviceLifecycleRequest.

@PayloadRoot(localPart = "SetDeviceLifecycleStatusRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public SetDeviceLifecycleStatusAsyncResponse setDeviceLifecycleRequest(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetDeviceLifecycleStatusRequest request) throws OsgpException {
    LOGGER.info("SetDeviceLifecycleStatusRequest received for device: {} and organisation: {}.", request.getDeviceIdentification(), organisationIdentification);
    final SetDeviceLifecycleStatusAsyncResponse asyncResponse = new SetDeviceLifecycleStatusAsyncResponse();
    try {
        final String correlationUid = this.deviceManagementService.enqueueSetDeviceLifecycleStatusRequest(organisationIdentification, request.getDeviceIdentification(), request.getDeviceLifecycleStatus());
        asyncResponse.setCorrelationUid(correlationUid);
        asyncResponse.setDeviceId(request.getDeviceIdentification());
    } catch (final Exception e) {
        this.handleException(e);
    }
    return asyncResponse;
}
Also used : SetDeviceLifecycleStatusAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetDeviceLifecycleStatusAsyncResponse) 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 SetDeviceLifecycleStatusAsyncResponse

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

the class DeviceLifecycleStatusSteps method aSetDeviceLifecycleStatusRequestIsReceived.

@When("^a SetDeviceLifecycleStatus request is received$")
public void aSetDeviceLifecycleStatusRequestIsReceived(final Map<String, String> settings) throws Throwable {
    final SetDeviceLifecycleStatusRequest request = new SetDeviceLifecycleStatusRequest();
    request.setDeviceIdentification(settings.get(PlatformKeys.KEY_DEVICE_IDENTIFICATION));
    request.setDeviceLifecycleStatus(DeviceLifecycleStatus.valueOf(settings.get(PlatformKeys.KEY_DEVICE_LIFECYCLE_STATUS)));
    final SetDeviceLifecycleStatusAsyncResponse asyncResponse = this.deviceManagementClient.setDeviceLifecycleStatus(request);
    assertThat(asyncResponse).as("AsyncResponse should not be null").isNotNull();
    ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid());
}
Also used : SetDeviceLifecycleStatusAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetDeviceLifecycleStatusAsyncResponse) SetDeviceLifecycleStatusRequest(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetDeviceLifecycleStatusRequest) When(io.cucumber.java.en.When)

Aggregations

SetDeviceLifecycleStatusAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetDeviceLifecycleStatusAsyncResponse)2 When (io.cucumber.java.en.When)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 SetDeviceLifecycleStatusRequest (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetDeviceLifecycleStatusRequest)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