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;
}
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());
}
Aggregations