use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse in project open-smart-grid-platform by OSGP.
the class ReceivedAlarmNotificationsSteps method aPushNotificationAlarmShouldBeReceived.
@Then("^a push notification alarm should be received$")
public void aPushNotificationAlarmShouldBeReceived() throws Throwable {
/*
* The pushed alarm steps simulate two alarms, retrieve the response twice as well.
*/
GetPushNotificationAlarmResponse pushNotificationAlarm = this.configurationClient.getPushNotificationAlarm();
assertThat(pushNotificationAlarm.getAlarm()).isNotEmpty();
pushNotificationAlarm = this.configurationClient.getPushNotificationAlarm();
assertThat(pushNotificationAlarm.getAlarm()).isNotEmpty();
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getPushNotificationAlarm.
@PayloadRoot(localPart = "GetPushNotificationAlarmAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetPushNotificationAlarmResponse getPushNotificationAlarm(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetPushNotificationAlarmAsyncRequest request) throws OsgpException {
log.info("GetPushNotificationAlarmRequest Request received from organisation {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
final GetPushNotificationAlarmResponse response = new GetPushNotificationAlarmResponse();
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
if (responseData != null) {
final PushNotificationAlarm p = (PushNotificationAlarm) responseData.getMessageData();
response.setDecodedMessage(p.toString());
response.setEncodedMessage(p.getAlarmBytes());
response.getAlarm().addAll(this.configurationMapper.mapAsList(p.getAlarms(), org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AlarmType.class));
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationClient method getPushNotificationAlarm.
public GetPushNotificationAlarmResponse getPushNotificationAlarm() throws WebServiceSecurityException {
final Notification notification = this.waitForNotification(NotificationType.PUSH_NOTIFICATION_ALARM);
final GetPushNotificationAlarmAsyncRequest request = new GetPushNotificationAlarmAsyncRequest();
request.setCorrelationUid(notification.getCorrelationUid());
request.setDeviceIdentification(notification.getDeviceIdentification());
return (GetPushNotificationAlarmResponse) this.getTemplate().marshalSendAndReceive(request);
}
Aggregations