use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionResponse in project open-smart-grid-platform by OSGP.
the class SetTransitionSteps method thePlatformDoesNotBufferASetTransitionResponseMessage.
@Then("^the platform does not buffer a set transition response message for device \"([^\"]*)\"$")
public void thePlatformDoesNotBufferASetTransitionResponseMessage(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
final SetTransitionAsyncRequest request = new SetTransitionAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformPubliclightingKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
SetTransitionResponse response = null;
try {
response = this.client.getSetTransitionResponse(request);
} catch (final Exception e) {
// do nothing
}
assertThat(response).isNotNull();
assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformPubliclightingKeys.KEY_RESULT)));
});
}
use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetTransitionResponse in project open-smart-grid-platform by OSGP.
the class PublicLightingAdHocManagementEndpoint method getSetTransitionResponse.
@PayloadRoot(localPart = "SetTransitionAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public SetTransitionResponse getSetTransitionResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetTransitionAsyncRequest request) throws OsgpException {
LOGGER.info("Get Set Transition Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
final SetTransitionResponse response = new SetTransitionResponse();
try {
final ResponseMessage message = this.adHocManagementService.dequeueSetTransitionResponse(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.SetTransitionResponse in project open-smart-grid-platform by OSGP.
the class SetTransitionSteps method thePlatformBuffersASetTransitionResponseMessage.
@Then("^the platform buffers a set transition response message for device \"([^\"]*)\"$")
public void thePlatformBuffersASetTransitionResponseMessage(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
final SetTransitionAsyncRequest request = new SetTransitionAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformPubliclightingKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
SetTransitionResponse response = null;
try {
response = this.client.getSetTransitionResponse(request);
} catch (final Exception e) {
// do nothing
}
assertThat(response).isNotNull();
assertThat(response.getResult()).isEqualTo(Enum.valueOf(OsgpResultType.class, expectedResult.get(PlatformPubliclightingKeys.KEY_RESULT)));
});
}
Aggregations