use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest in project open-smart-grid-platform by OSGP.
the class ResumeScheduleSteps method getResponseWithCorrelationUID.
private ResumeScheduleResponse getResponseWithCorrelationUID(final String deviceIdentification, final String correlationUID) throws InterruptedException, SoapFaultClientException {
final ResumeScheduleAsyncRequest request = new ResumeScheduleAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid(correlationUID);
request.setAsyncRequest(asyncRequest);
return Wait.untilAndReturn(() -> {
final ResumeScheduleResponse retval = this.client.getResumeScheduleResponse(request);
assertThat(retval).isNotNull();
return retval;
});
}
use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest 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.common.AsyncRequest in project open-smart-grid-platform by OSGP.
the class SetLightScheduleSteps method thePlatformBuffersASetLightScheduleResponseMessageForDeviceContainsSoapFault.
@Then("^the platform buffers a set light schedule response message for device \"([^\"]*)\" that contains a soap fault$")
public void thePlatformBuffersASetLightScheduleResponseMessageForDeviceContainsSoapFault(final String deviceIdentification, final Map<String, String> expectedResponseData) throws Throwable {
final SetScheduleAsyncRequest request = new SetScheduleAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformPubliclightingKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.untilAndReturn(() -> {
try {
this.client.getSetSchedule(request);
} catch (final SoapFaultClientException ex) {
LOGGER.info("Received a SOAP fault on setSchedule");
final String faultString = ex.getFaultStringOrReason();
if ("CorrelationUid is unknown.".equals(faultString)) {
throw new Exception("Received a SOAP fault on setSchedule that could be rejected because the CorrelationUid is unknown");
}
ScenarioContext.current().put(PlatformKeys.RESPONSE, ex);
return null;
}
throw new Exception("Received a setSchedule message without a SOAP fault");
});
GenericResponseSteps.verifySoapFault(expectedResponseData);
}
use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest 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)));
});
}
use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest in project open-smart-grid-platform by OSGP.
the class GetStatusSteps method getGetStatusAsyncRequest.
private GetStatusAsyncRequest getGetStatusAsyncRequest(final String deviceIdentification) {
final GetStatusAsyncRequest request = new GetStatusAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformPubliclightingKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
return request;
}
Aggregations