use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse in project open-smart-grid-platform by OSGP.
the class StartDeviceSteps method thePlatformBuffersNoStartDeviceTestResponseMessageForDevice.
@Then("^the platform buffers no start device test response message for device \"([^\"]*)\"$")
public void thePlatformBuffersNoStartDeviceTestResponseMessageForDevice(final String deviceIdentification) throws InterruptedException {
final StartDeviceTestAsyncRequest request = new StartDeviceTestAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
StartDeviceTestResponse response = null;
try {
response = this.client.getStartDeviceTestResponse(request);
} catch (final Exception e) {
// do nothing
}
assertThat(response).isNotNull();
assertThat(response.getResult()).isNotEqualTo(OsgpResultType.NOT_FOUND);
});
}
use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse in project open-smart-grid-platform by OSGP.
the class StartDeviceSteps method thePlatformBuffersAStartDeviceResponseMessageForDevice.
@Then("^the platform buffers a start device response message for device \"([^\"]*)\"$")
public void thePlatformBuffersAStartDeviceResponseMessageForDevice(final String deviceIdentification, final Map<String, String> expectedResult) throws InterruptedException {
final StartDeviceTestAsyncRequest request = new StartDeviceTestAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
StartDeviceTestResponse response = null;
try {
response = this.client.getStartDeviceTestResponse(request);
} catch (final Exception e) {
// do nothing
}
assertThat(response).isNotNull();
assertThat(response.getResult()).isEqualTo(getEnum(expectedResult, PlatformKeys.KEY_RESULT, OsgpResultType.class));
});
}
use of org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.StartDeviceTestResponse in project open-smart-grid-platform by OSGP.
the class DeviceInstallationEndpoint method getStartDeviceTestResponse.
@PayloadRoot(localPart = "StartDeviceTestAsyncRequest", namespace = DEVICE_INSTALLATION_NAMESPACE)
@ResponsePayload
public StartDeviceTestResponse getStartDeviceTestResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final StartDeviceTestAsyncRequest request) throws OsgpException {
LOGGER.info("Get Start Device Test Response received from organisation: {} for device: {}.", organisationIdentification, request.getAsyncRequest().getDeviceId());
final StartDeviceTestResponse response = new StartDeviceTestResponse();
try {
final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
if (responseMessage != null) {
throwExceptionIfResultNotOk(responseMessage, "starting device test");
response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations