use of org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncRequest in project open-smart-grid-platform by OSGP.
the class StopDeviceSteps method thePlatformBuffersAStopDeviceResponseMessageForDevice.
@Then("the platform buffers a stop device response message for device {string}")
public void thePlatformBuffersAStopDeviceResponseMessageForDevice(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
final StopDeviceTestAsyncRequest request = new StopDeviceTestAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
StopDeviceTestResponse response = null;
try {
response = this.client.getStopDeviceTestResponse(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.core.common.AsyncRequest in project open-smart-grid-platform by OSGP.
the class GetFirmwareVersionSteps method thePlatformBuffersAGetFirmwareVersionResponseMessage.
@Then("^the platform buffers a get firmware version response message for device \"([^\"]*)\"$")
public void thePlatformBuffersAGetFirmwareVersionResponseMessage(final String deviceIdentification, final Map<String, String> expectedResponseData) {
final GetFirmwareVersionAsyncRequest request = new GetFirmwareVersionAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
final GetFirmwareVersionResponse response = Wait.untilAndReturn(() -> {
final GetFirmwareVersionResponse retval = this.client.getGetFirmwareVersion(request);
assertThat(retval).isNotNull();
assertThat(retval.getResult()).isEqualTo(getEnum(expectedResponseData, PlatformKeys.KEY_RESULT, OsgpResultType.class));
return retval;
});
if (response.getFirmwareVersion() != null) {
final FirmwareVersion fwv = response.getFirmwareVersion().get(0);
if (fwv.getVersion() != null) {
assertThat(fwv.getVersion()).isEqualTo(getString(expectedResponseData, PlatformKeys.FIRMWARE_VERSION));
}
if (fwv.getFirmwareModuleType() != null) {
assertThat(fwv.getFirmwareModuleType()).isEqualTo(getEnum(expectedResponseData, PlatformKeys.KEY_FIRMWARE_MODULE_TYPE, FirmwareModuleType.class));
}
}
}
Aggregations