Search in sources :

Example 1 with AsyncRequest

use of org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest 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;
}
Also used : SetDataAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest) SetDataAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncRequest)

Example 2 with AsyncRequest

use of org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest in project open-smart-grid-platform by OSGP.

the class ReportingSteps method doGetDataRequest.

private void doGetDataRequest(final Map<String, String> settings) throws Throwable {
    final GetDataRequest getDataRequest = new GetDataRequest();
    getDataRequest.setDeviceIdentification(settings.get(PlatformMicrogridsKeys.KEY_DEVICE_IDENTIFICATION));
    GetDataAsyncResponse asyncResponse;
    asyncResponse = this.adHocManagementClient.getDataAsync(getDataRequest);
    final GetDataAsyncRequest getDataAsyncRequest = new GetDataAsyncRequest();
    final AsyncRequest value = new AsyncRequest();
    value.setCorrelationUid(asyncResponse.getAsyncResponse().getCorrelationUid());
    value.setDeviceId(asyncResponse.getAsyncResponse().getDeviceId());
    getDataAsyncRequest.setAsyncRequest(value);
    this.adHocManagementClient.getData(getDataAsyncRequest);
}
Also used : GetDataAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest) GetDataAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncRequest) GetDataRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataRequest) GetDataAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse)

Example 3 with AsyncRequest

use of org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest in project open-smart-grid-platform by OSGP.

the class GetDataRequestBuilder method fromParameterMapAsync.

public static GetDataAsyncRequest 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 GetDataAsyncRequest getDataAsyncRequest = new GetDataAsyncRequest();
    final AsyncRequest asyncRequest = new AsyncRequest();
    asyncRequest.setCorrelationUid(correlationUid);
    asyncRequest.setDeviceId(deviceIdentification);
    getDataAsyncRequest.setAsyncRequest(asyncRequest);
    return getDataAsyncRequest;
}
Also used : AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest) GetDataAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncRequest) GetDataAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncRequest)

Aggregations

AsyncRequest (org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest)3 GetDataAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncRequest)2 GetDataAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse)1 GetDataRequest (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataRequest)1 SetDataAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncRequest)1