use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.UpdateDeviceCdmaSettingsResponse in project open-smart-grid-platform by OSGP.
the class UpdateDeviceCdmaSettingsSteps method thePlatformShouldBufferAnUpdateDeviceCdmaSettingsResponseMessage.
@Then("^the platform should buffer an update device CDMA settings response message$")
public void thePlatformShouldBufferAnUpdateDeviceCdmaSettingsResponseMessage(final Map<String, String> responseParameters) {
final String deviceIdentification = (String) ScenarioContext.current().get(PlatformKeys.KEY_DEVICE_IDENTIFICATION);
final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID);
final OsgpResultType expectedResult = Enum.valueOf(OsgpResultType.class, responseParameters.get(PlatformKeys.KEY_RESULT));
LOGGER.info("THEN: Buffer UpdateCdmaSettingsResponse [correlationUid={}, deviceIdentification={}, result={}]", correlationUid, deviceIdentification, expectedResult);
final UpdateDeviceCdmaSettingsAsyncRequest request = new UpdateDeviceCdmaSettingsAsyncRequest();
request.setDeviceId(deviceIdentification);
request.setCorrelationUid(correlationUid);
Wait.until(() -> {
UpdateDeviceCdmaSettingsResponse response = null;
try {
response = this.client.getUpdateDeviceCdmaSettingsResponse(request);
} catch (final WebServiceSecurityException e) {
// do nothing
}
assertThat(response).isNotNull();
assertThat(response.getResult()).isEqualTo(expectedResult);
});
}
use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.UpdateDeviceCdmaSettingsResponse in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method getUpdateDeviceCdmaSettingsResponse.
@PayloadRoot(localPart = "UpdateDeviceCdmaSettingsAsyncRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public UpdateDeviceCdmaSettingsResponse getUpdateDeviceCdmaSettingsResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final UpdateDeviceCdmaSettingsAsyncRequest asyncRequest) throws OsgpException {
LOGGER.info("GetUpdateDeviceCdmaSettingsResponse received from organisation: {} with correlationUid: {}.", organisationIdentification, asyncRequest.getCorrelationUid());
final UpdateDeviceCdmaSettingsResponse response = new UpdateDeviceCdmaSettingsResponse();
try {
final ResponseMessage responseMessage = this.getResponseMessage(asyncRequest);
if (responseMessage != null) {
throwExceptionIfResultNotOk(responseMessage, "updating CDMA settings for device");
response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations