Search in sources :

Example 1 with GetPushNotificationAlarmResponse

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();
}
Also used : GetPushNotificationAlarmResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse) Then(io.cucumber.java.en.Then)

Example 2 with GetPushNotificationAlarmResponse

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;
}
Also used : GetPushNotificationAlarmResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse) PushNotificationAlarm(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PushNotificationAlarm) GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) IOException(java.io.IOException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 3 with GetPushNotificationAlarmResponse

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);
}
Also used : GetPushNotificationAlarmResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse) GetPushNotificationAlarmAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmAsyncRequest) Notification(org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification)

Aggregations

GetPushNotificationAlarmResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse)3 Then (io.cucumber.java.en.Then)1 IOException (java.io.IOException)1 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)1 GetKeysResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData)1 GetPushNotificationAlarmAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmAsyncRequest)1 Notification (org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification)1 PushNotificationAlarm (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PushNotificationAlarm)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1