use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetLightResponse in project open-smart-grid-platform by OSGP.
the class PublicLightingAdHocManagementEndpoint method getSetLightResponse.
@PayloadRoot(localPart = "SetLightAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SetLightResponse getSetLightResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetLightAsyncRequest request) throws OsgpException {
LOGGER.info("Get Set Light Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
final SetLightResponse response = new SetLightResponse();
try {
final ResponseMessage message = this.adHocManagementService.dequeueSetLightResponse(request.getAsyncRequest().getCorrelationUid());
if (message != null) {
response.setResult(OsgpResultType.fromValue(message.getResult().getValue()));
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetLightResponse in project open-smart-grid-platform by OSGP.
the class SetLightSteps method thePlatformBuffersASetLightResponseMessage.
@Then("^the platform buffers a set light response message for device \"([^\"]*)\"$")
public void thePlatformBuffersASetLightResponseMessage(final String deviceIdentification, final Map<String, String> expectedResult) {
final SetLightAsyncRequest request = new SetLightAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
SetLightResponse response = null;
try {
response = this.client.getSetLightResponse(request);
} catch (final Exception e) {
// do nothing
}
assertThat(response).isNotNull();
assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformKeys.KEY_RESULT)));
});
}
Aggregations