use of org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncRequest in project open-smart-grid-platform by OSGP.
the class SetDataRequestBuilder method fromParameterMapAsync.
public static SetDataAsyncRequest fromParameterMapAsync(final Map<String, String> requestParameters) {
final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID);
if (correlationUid == null) {
throw new AssertionError("ScenarioContext must contain the correlation UID for key \"" + PlatformKeys.KEY_CORRELATION_UID + "\" before creating an async request.");
}
final String deviceIdentification = requestParameters.get(PlatformKeys.KEY_DEVICE_IDENTIFICATION);
if (deviceIdentification == null) {
throw new AssertionError("The Step DataTable must contain the device identification for key \"" + PlatformKeys.KEY_DEVICE_IDENTIFICATION + "\" when creating an async request.");
}
final SetDataAsyncRequest setDataAsyncRequest = new SetDataAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setCorrelationUid(correlationUid);
asyncRequest.setDeviceId(deviceIdentification);
setDataAsyncRequest.setAsyncRequest(asyncRequest);
return setDataAsyncRequest;
}
use of org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncRequest in project open-smart-grid-platform by OSGP.
the class SetDataSteps method theSetDataResponseShouldBeReturned.
@Then("^the set data response should be returned$")
public void theSetDataResponseShouldBeReturned(final Map<String, String> responseParameters) throws Throwable {
final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID);
final Map<String, String> extendedParameters = SettingsHelper.addDefault(responseParameters, PlatformKeys.KEY_CORRELATION_UID, correlationUid);
final SetDataAsyncRequest setDataAsyncRequest = SetDataRequestBuilder.fromParameterMapAsync(extendedParameters);
final SetDataResponse response = this.client.setData(setDataAsyncRequest);
final String expectedResult = responseParameters.get(PlatformKeys.KEY_RESULT);
assertThat(response.getResult()).as("Result").isNotNull();
assertThat(response.getResult().name()).as("Result").isEqualTo(expectedResult);
}
Aggregations