use of eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationRecipientFilter in project CzechIdMng by bcvsolutions.
the class IdmNotificationRecipientControllerTest method testFindByIdentityRecipient.
@Test
public void testFindByIdentityRecipient() {
IdmNotificationRecipientDto recipentOne = createDto();
// other
createDto();
//
IdmNotificationRecipientFilter filter = new IdmNotificationRecipientFilter();
filter.setIdentityRecipient(recipentOne.getIdentityRecipient());
List<IdmNotificationRecipientDto> attachments = find(filter);
Assert.assertEquals(1, attachments.size());
Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(recipentOne.getId())));
}
use of eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationRecipientFilter in project CzechIdMng by bcvsolutions.
the class IdmNotificationRecipientControllerTest method testFindByNotification.
@Test
public void testFindByNotification() {
IdmNotificationRecipientDto recipentOne = createDto();
// other
createDto();
//
IdmNotificationRecipientFilter filter = new IdmNotificationRecipientFilter();
filter.setNotification(recipentOne.getNotification());
List<IdmNotificationRecipientDto> attachments = find(filter);
Assert.assertEquals(1, attachments.size());
Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(recipentOne.getId())));
}
use of eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationRecipientFilter in project CzechIdMng by bcvsolutions.
the class IdmNotificationRecipientControllerTest method testFindByRealRecipient.
@Test
public void testFindByRealRecipient() {
IdmNotificationRecipientDto recipentOne = createDto();
// other
createDto();
//
IdmNotificationRecipientFilter filter = new IdmNotificationRecipientFilter();
filter.setRealRecipient(recipentOne.getRealRecipient());
List<IdmNotificationRecipientDto> attachments = find(filter);
Assert.assertEquals(1, attachments.size());
Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(recipentOne.getId())));
}
use of eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationRecipientFilter in project CzechIdMng by bcvsolutions.
the class IdmNotificationRecipientController method toFilter.
@Override
protected IdmNotificationRecipientFilter toFilter(MultiValueMap<String, Object> parameters) {
IdmNotificationRecipientFilter filter = new IdmNotificationRecipientFilter(parameters, getParameterConverter());
filter.setIdentityRecipient(getParameterConverter().toEntityUuid(parameters, IdmNotificationRecipientFilter.PARAMETER_IDENTITY_RECIPIENT, IdmIdentityDto.class));
//
return filter;
}
use of eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationRecipientFilter in project CzechIdMng by bcvsolutions.
the class DefaultRptReportManagerIntegrationTest method testSendConfiguredRedirectNotificationAfterEnd.
@Test
public void testSendConfiguredRedirectNotificationAfterEnd() throws Exception {
IdmIdentityDto identity = getHelper().createIdentity();
String recipient = getHelper().createName() + "@test-bcvsolutions.eu";
NotificationConfigurationDto config = createConfig(recipient, true);
//
try {
// report is sent to logged identity by default
getHelper().login(identity);
//
RptReportDto report = new RptReportDto();
report.setExecutorName(TestReportExecutor.REPORT_NAME);
IdmFormDto filter = new IdmFormDto();
TestReportExecutor testReportExecutor = context.getAutowireCapableBeanFactory().createBean(TestReportExecutor.class);
IdmFormDefinitionDto definition = testReportExecutor.getFormDefinition();
IdmFormValueDto topic = new IdmFormValueDto(definition.getMappedAttributeByCode(AbstractReportExecutor.PROPERTY_TOPIC_REPORT_GENERATE_SUCCESS));
topic.setValue(config.getTopic());
filter.getValues().add(topic);
filter.setFormDefinition(definition.getId());
report.setFilter(filter);
report = manager.generate(report);
UUID reportId = report.getId();
Assert.assertNotNull(reportId);
Assert.assertNotNull(report.getData());
//
try (InputStream is = attachmentManager.getAttachmentData(report.getData())) {
Assert.assertEquals(mapper.writeValueAsString(TestReportExecutor.identities), IOUtils.toString(is));
}
reportService.delete(report);
attachmentManager.deleteAttachments(report);
//
// test notification is sent
IdmNotificationFilter notificationFilter = new IdmNotificationFilter();
notificationFilter.setTopic(config.getTopic());
notificationFilter.setRecipient(identity.getUsername());
notificationFilter.setNotificationType(IdmNotificationLog.class);
List<IdmNotificationLogDto> notifications = notificationService.find(notificationFilter, null).getContent();
Assert.assertTrue(notifications.isEmpty());
//
IdmNotificationRecipientFilter recipientFilter = new IdmNotificationRecipientFilter();
recipientFilter.setRealRecipient(recipient);
List<IdmNotificationRecipientDto> recipients = notificationRecipientService.find(recipientFilter, null).getContent();
Assert.assertFalse(recipients.isEmpty());
Assert.assertEquals(config.getTopic(), notificationService.get(recipients.get(0).getNotification()).getTopic());
} finally {
logout();
}
}
Aggregations