use of se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage 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);
});
}
use of se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage in project webcert by sklintyg.
the class RouteIT method ensureMessagesAreResentAndDoNotBlockEachOther.
@Test
public void ensureMessagesAreResentAndDoNotBlockEachOther() throws Exception {
final String intygsId1 = FALLERAT_MEDDELANDE + "2";
final String intygsId2 = "korrekt-meddelande-1";
NotificationMessage notificationMessage1 = createNotificationMessage(intygsId1, "fk7263", HandelsekodEnum.SKAPAT);
NotificationMessage notificationMessage2 = createNotificationMessage(intygsId2, "fk7263", HandelsekodEnum.ANDRAT);
sendMessage(notificationMessage1);
sendMessage(notificationMessage2);
await().atMost(SECONDS_TO_WAIT, TimeUnit.SECONDS).until(() -> {
int numberOfSuccessfulMessages = certificateStatusUpdateForCareResponderStub.getNumberOfSentMessages();
if (numberOfSuccessfulMessages == 2) {
List<String> utlatandeIds = certificateStatusUpdateForCareResponderStub.getIntygsIdsInOrder();
System.err.println(utlatandeIds);
return (utlatandeIds.size() == 2 && utlatandeIds.get(0).equals(intygsId2) && utlatandeIds.get(1).equals(intygsId1));
}
return false;
});
}
use of se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage 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);
});
}
use of se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage in project webcert by sklintyg.
the class RouteIT method ensureRouting.
@Test
public void ensureRouting() throws Exception {
// 2 messages
NotificationMessage luaefs1 = createNotificationMessage("intyg1", LocalDateTime.now(), HandelsekodEnum.SKAPAT, "luae_fs", SchemaVersion.VERSION_3);
NotificationMessage luaefs2 = createNotificationMessage("intyg1", LocalDateTime.now(), HandelsekodEnum.ANDRAT, "luae_fs", SchemaVersion.VERSION_3);
NotificationMessage luaefs3 = createNotificationMessage("intyg1", LocalDateTime.now(), HandelsekodEnum.ANDRAT, "luae_fs", SchemaVersion.VERSION_3);
// 3 messages
NotificationMessage fk1 = createNotificationMessage("intyg2", "fk7263", HandelsekodEnum.SKAPAT);
NotificationMessage fk2 = createNotificationMessage("intyg2", "fk7263", HandelsekodEnum.ANDRAT);
NotificationMessage fk3 = createNotificationMessage("intyg2", "fk7263", HandelsekodEnum.SIGNAT);
// 2 messages
NotificationMessage luaefs4 = createNotificationMessage("intyg3", LocalDateTime.now(), HandelsekodEnum.MAKULE, "luae_fs", SchemaVersion.VERSION_3);
NotificationMessage luaefs5 = createNotificationMessage("intyg4", LocalDateTime.now(), HandelsekodEnum.SKICKA, "luae_fs", SchemaVersion.VERSION_3);
sendMessage(luaefs1);
sendMessage(fk1);
sendMessage(luaefs2);
sendMessage(luaefs3);
sendMessage(fk2);
sendMessage(luaefs4);
sendMessage(fk3);
sendMessage(luaefs5);
await().atMost(SECONDS_TO_WAIT, TimeUnit.SECONDS).until(() -> {
int numberOfReceivedMessagesV1 = certificateStatusUpdateForCareResponderStub.getNumberOfReceivedMessages();
int numberOfReceivedMessagesV3 = certificateStatusUpdateForCareResponderV3.getNumberOfReceivedMessages();
return (numberOfReceivedMessagesV1 == 3 && numberOfReceivedMessagesV3 == 4);
});
}
use of se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage in project webcert by sklintyg.
the class RouteIT method setupConverter.
private void setupConverter() throws ModuleException {
when(mockFk7263Transform.createCertificateStatusUpdateForCareType(any(NotificationMessage.class))).thenAnswer(invocation -> {
NotificationMessage msg = (NotificationMessage) invocation.getArguments()[0];
if (msg == null) {
return null;
}
CertificateStatusUpdateForCareType request = new CertificateStatusUpdateForCareType();
UtlatandeType utlatande = new UtlatandeType();
UtlatandeId id = new UtlatandeId();
id.setExtension(msg.getIntygsId());
utlatande.setUtlatandeId(id);
request.setUtlatande(utlatande);
return request;
});
}
Aggregations