Search in sources :

Example 1 with Notification

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification in project open-smart-grid-platform by OSGP.

the class SmartMeteringBaseClient method waitForNotification.

protected Notification waitForNotification(final NotificationType notificationType, final int nextWait) {
    LOGGER.info("Waiting for a notification for notification type {} for at most {} milliseconds.", notificationType, nextWait);
    final Notification notification = this.notificationService.getNotification(notificationType, nextWait, TimeUnit.MILLISECONDS);
    return notification;
}
Also used : Notification(org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification)

Example 2 with Notification

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification in project open-smart-grid-platform by OSGP.

the class SmartMeteringBaseClient method waitForNotification.

protected Notification waitForNotification(final int nextWait) {
    LOGGER.info("Waiting for a notification for at most {} milliseconds.", nextWait);
    final Notification notification = this.notificationService.getNotification(nextWait, TimeUnit.MILLISECONDS);
    if (notification == null) {
        LOGGER.info("Did not receive a notification within " + nextWait + " milliseconds");
    }
    return notification;
}
Also used : Notification(org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification)

Example 3 with Notification

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification in project open-smart-grid-platform by OSGP.

the class SmartMeteringBaseClient method waitForNotification.

protected void waitForNotification(final String correlationUid) {
    final int nextWait = this.getNextWait();
    LOGGER.info("Waiting for a notification for correlation UID {} for at most {} milliseconds.", correlationUid, nextWait);
    final Notification notification = this.notificationService.getNotification(correlationUid, nextWait, TimeUnit.MILLISECONDS);
    if (notification == null) {
        throw new AssertionError("Did not receive a notification for correlation UID: " + correlationUid + " within " + nextWait + " milliseconds");
    }
}
Also used : Notification(org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification)

Example 4 with Notification

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification in project open-smart-grid-platform by OSGP.

the class SmartMeteringBaseClient method waitForNotification.

protected Notification waitForNotification(final NotificationType notificationType) {
    final int nextWait = this.getNextWait();
    final Notification notification = this.waitForNotification(notificationType, nextWait);
    if (notification == null) {
        throw new AssertionError("Did not receive a notification for notification type: " + notificationType + " within " + nextWait + " milliseconds");
    }
    return notification;
}
Also used : Notification(org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification)

Example 5 with Notification

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification in project open-smart-grid-platform by OSGP.

the class SmartMeteringNotificationSteps method waitForNotification.

private void waitForNotification(final int maxTimeOut, final String correlationUid, final boolean expectCorrelationUid) throws Throwable {
    LOGGER.info("Waiting to make sure {} notification is received for correlation UID {} for at most {} milliseconds.", expectCorrelationUid ? "a" : "no", correlationUid, maxTimeOut);
    final Notification notification = this.notificationService.getNotification(correlationUid, maxTimeOut, TimeUnit.MILLISECONDS);
    final boolean gotExpectedNotification = expectCorrelationUid && notification != null;
    final boolean didNotGetUnexpectedNotification = !expectCorrelationUid && notification == null;
    if (gotExpectedNotification || didNotGetUnexpectedNotification) {
        return;
    }
    if (expectCorrelationUid) {
        Assertions.fail("Did not receive a notification for correlation UID: " + correlationUid + " within " + maxTimeOut + " milliseconds");
    } else {
        Assertions.fail("Received notification for correlation UID: " + correlationUid);
    }
}
Also used : Notification(org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification)

Aggregations

Notification (org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification)9 GenericNotification (org.opensmartgridplatform.adapter.ws.schema.shared.notification.GenericNotification)2 Test (org.junit.jupiter.api.Test)1 GenericSendNotificationRequest (org.opensmartgridplatform.adapter.ws.schema.shared.notification.GenericSendNotificationRequest)1 GetPushNotificationAlarmAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmAsyncRequest)1 GetPushNotificationAlarmResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse)1 SendNotificationRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.SendNotificationRequest)1