Search in sources :

Example 1 with NotificationStubEntry

use of se.inera.intyg.webcert.notification_sender.mocks.NotificationStubEntry in project webcert by sklintyg.

the class RouteIT method ensureWiretapWorks.

@Test
public void ensureWiretapWorks() throws Exception {
    LocalDateTime first = LocalDateTime.now().minusSeconds(15);
    LocalDateTime second = LocalDateTime.now().minusSeconds(10);
    NotificationMessage notificationMessage2 = createNotificationMessage("intyg1", first, HandelsekodEnum.ANDRAT, "luae_fs", SchemaVersion.VERSION_3);
    NotificationMessage notificationMessage3 = createNotificationMessage("intyg1", second, HandelsekodEnum.SIGNAT, "luae_fs", SchemaVersion.VERSION_3);
    sendMessage(notificationMessage2);
    sendMessage(notificationMessage3);
    await().atMost(SECONDS_TO_WAIT, TimeUnit.SECONDS).until(() -> {
        int numberOfReceivedMessages = certificateStatusUpdateForCareResponderV3.getNumberOfReceivedMessages();
        if (numberOfReceivedMessages == 1) {
            List<NotificationStubEntry> notificationMessages = certificateStatusUpdateForCareResponderV3.getNotificationMessages();
            for (NotificationStubEntry nse : notificationMessages) {
                if (nse.handelseTyp.equals(HandelsekodEnum.SIGNAT.value())) {
                    assertEquals(second, nse.handelseTid);
                }
            }
        }
        return (numberOfReceivedMessages == 1);
    });
}
Also used : LocalDateTime(java.time.LocalDateTime) NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) NotificationStubEntry(se.inera.intyg.webcert.notification_sender.mocks.NotificationStubEntry) Test(org.junit.Test)

Example 2 with NotificationStubEntry

use of se.inera.intyg.webcert.notification_sender.mocks.NotificationStubEntry in project webcert by sklintyg.

the class RouteIT method ensureAggregatorFiltersOutOldestAndratMessages.

@Test
public void ensureAggregatorFiltersOutOldestAndratMessages() throws Exception {
    LocalDateTime first = LocalDateTime.now().minusSeconds(15);
    LocalDateTime second = LocalDateTime.now().minusSeconds(10);
    LocalDateTime third = LocalDateTime.now().minusSeconds(5);
    NotificationMessage notificationMessage1 = createNotificationMessage("intyg1", LocalDateTime.now(), HandelsekodEnum.SKAPAT, "luae_fs", SchemaVersion.VERSION_3);
    NotificationMessage notificationMessage2 = createNotificationMessage("intyg1", first, HandelsekodEnum.ANDRAT, "luae_fs", SchemaVersion.VERSION_3);
    NotificationMessage notificationMessage3 = createNotificationMessage("intyg1", second, HandelsekodEnum.ANDRAT, "luae_fs", SchemaVersion.VERSION_3);
    NotificationMessage notificationMessage4 = createNotificationMessage("intyg1", third, HandelsekodEnum.ANDRAT, "luae_fs", SchemaVersion.VERSION_3);
    sendMessage(notificationMessage1);
    sendMessage(notificationMessage2);
    sendMessage(notificationMessage3);
    sendMessage(notificationMessage4);
    await().atMost(SECONDS_TO_WAIT, TimeUnit.SECONDS).until(() -> {
        int numberOfReceivedMessages = certificateStatusUpdateForCareResponderV3.getNumberOfReceivedMessages();
        if (numberOfReceivedMessages == 2) {
            List<NotificationStubEntry> notificationMessages = certificateStatusUpdateForCareResponderV3.getNotificationMessages();
            for (NotificationStubEntry nse : notificationMessages) {
                if (nse.handelseTyp.equals(HandelsekodEnum.ANDRAT.value())) {
                    assertEquals(third, nse.handelseTid);
                }
            }
        }
        return (numberOfReceivedMessages == 2);
    });
}
Also used : LocalDateTime(java.time.LocalDateTime) NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) NotificationStubEntry(se.inera.intyg.webcert.notification_sender.mocks.NotificationStubEntry) Test(org.junit.Test)

Example 3 with NotificationStubEntry

use of se.inera.intyg.webcert.notification_sender.mocks.NotificationStubEntry in project webcert by sklintyg.

the class RouteIT method ensureAggregatorFiltersOutAndratMessagesWhenSigned.

@Test
public void ensureAggregatorFiltersOutAndratMessagesWhenSigned() throws Exception {
    NotificationMessage notificationMessage1 = createNotificationMessage("intyg1", LocalDateTime.now(), HandelsekodEnum.SKAPAT, "luae_fs", SchemaVersion.VERSION_3);
    NotificationMessage notificationMessage2 = createNotificationMessage("intyg1", LocalDateTime.now(), HandelsekodEnum.ANDRAT, "luae_fs", SchemaVersion.VERSION_3);
    NotificationMessage notificationMessage3 = createNotificationMessage("intyg1", LocalDateTime.now(), HandelsekodEnum.ANDRAT, "luae_fs", SchemaVersion.VERSION_3);
    NotificationMessage notificationMessage4 = createNotificationMessage("intyg1", LocalDateTime.now(), HandelsekodEnum.SIGNAT, "luae_fs", SchemaVersion.VERSION_3);
    sendMessage(notificationMessage1);
    sendMessage(notificationMessage2);
    sendMessage(notificationMessage3);
    sendMessage(notificationMessage4);
    await().atMost(SECONDS_TO_WAIT, TimeUnit.SECONDS).until(() -> {
        int numberOfReceivedMessages = certificateStatusUpdateForCareResponderV3.getNumberOfReceivedMessages();
        if (numberOfReceivedMessages == 2) {
            List<NotificationStubEntry> notificationMessages = certificateStatusUpdateForCareResponderV3.getNotificationMessages();
            for (NotificationStubEntry nse : notificationMessages) {
                if (nse.handelseTyp.equals(HandelsekodEnum.ANDRAT.value())) {
                    fail("No ANDRAT messages are allowed when intyg has been signed");
                }
            }
        }
        return (numberOfReceivedMessages == 2);
    });
}
Also used : NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) NotificationStubEntry(se.inera.intyg.webcert.notification_sender.mocks.NotificationStubEntry) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 NotificationMessage (se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage)3 NotificationStubEntry (se.inera.intyg.webcert.notification_sender.mocks.NotificationStubEntry)3 LocalDateTime (java.time.LocalDateTime)2