use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.SetEventNotificationsResponse in project open-smart-grid-platform by OSGP.
the class SetEventNotificationsSteps method thePlatformBuffersASetEventNotificationResponseMessageForDevice.
@Then("^the platform buffers a set event notification response message for device \"([^\"]*)\"")
public void thePlatformBuffersASetEventNotificationResponseMessageForDevice(final String deviceIdentification, final Map<String, String> expectedResult) throws Throwable {
final SetEventNotificationsAsyncRequest request = new SetEventNotificationsAsyncRequest();
final AsyncRequest asyncRequest = new AsyncRequest();
asyncRequest.setDeviceId(deviceIdentification);
asyncRequest.setCorrelationUid((String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID));
request.setAsyncRequest(asyncRequest);
Wait.until(() -> {
SetEventNotificationsResponse response = null;
try {
response = this.client.getSetEventNotificationsResponse(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.devicemanagement.SetEventNotificationsResponse in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method getSetEventNotificationsResponse.
@PayloadRoot(localPart = "SetEventNotificationsAsyncRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public SetEventNotificationsResponse getSetEventNotificationsResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetEventNotificationsAsyncRequest request) throws OsgpException {
LOGGER.info("Get Set Event Notifications Response received from organisation: {} with correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
final SetEventNotificationsResponse response = new SetEventNotificationsResponse();
try {
final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
if (responseMessage != null) {
throwExceptionIfResultNotOk(responseMessage, "setting event notifications");
response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations