Search in sources :

Example 6 with IdmNotificationDto

use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto in project CzechIdMng by bcvsolutions.

the class DefaultNotificationServiceIntegrationTest method parentFilterText.

@Test
public void parentFilterText() {
    IdmNotificationFilter filter = new IdmNotificationFilter();
    IdmNotificationDto notification = new IdmNotificationDto();
    IdmNotificationDto parentNotification = new IdmNotificationDto();
    // prepare template and message
    IdmNotificationTemplateDto template2 = createTestTemplate("TestTemplate5", "testSubject5");
    IdmMessageDto message2 = new IdmMessageDto.Builder().setTemplate(template2).build();
    // set parent
    parentNotification.setMessage(message2);
    IdmNotificationLogDto logDto = notificationManager.send(parentNotification);
    notification.setParent(logDto.getMessage().getId());
    // 
    // send message
    IdmNotificationTemplateDto template = createTestTemplate("TestTemplate4", "testSubject4");
    IdmMessageDto message = new IdmMessageDto.Builder().setTemplate(template).build();
    notification.setMessage(message);
    notificationManager.send(notification);
    // set filter
    filter.setParent(logDto.getId());
    Page<IdmNotificationLogDto> result = notificationLogService.find(filter, null);
    assertEquals("Wrong sender", logDto.getId(), result.getContent().get(0).getParent());
}
Also used : IdmNotificationDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 7 with IdmNotificationDto

use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto in project CzechIdMng by bcvsolutions.

the class DefaultNotificationServiceIntegrationTest method senderFilterTest.

@Test
public void senderFilterTest() {
    IdmIdentityDto sender = helper.createIdentity();
    IdmNotificationFilter filter = new IdmNotificationFilter();
    IdmNotificationDto notification = new IdmNotificationDto();
    notification.setIdentitySender(sender.getId());
    // 
    // create templates
    IdmNotificationTemplateDto template = createTestTemplate("TestTemplate3", "testSubject3");
    IdmMessageDto message = new IdmMessageDto.Builder().setTemplate(template).build();
    notification.setMessage(message);
    notificationManager.send(notification);
    // 
    // filter text BODY
    filter.setSender(sender.getUsername());
    Page<IdmNotificationLogDto> result = notificationLogService.find(filter, null);
    assertEquals("Wrong sender", sender.getId(), result.getContent().get(0).getIdentitySender());
}
Also used : IdmNotificationDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 8 with IdmNotificationDto

use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto in project CzechIdMng by bcvsolutions.

the class DefaultNotificationServiceIntegrationTest method testParentFilterText.

@Test
public void testParentFilterText() {
    IdmNotificationFilter filter = new IdmNotificationFilter();
    IdmNotificationDto notification = new IdmNotificationDto();
    IdmNotificationDto parentNotification = new IdmNotificationDto();
    // prepare template and message
    IdmNotificationTemplateDto template2 = createTestTemplate();
    IdmMessageDto message2 = new IdmMessageDto.Builder().setTemplate(template2).build();
    // set parent
    parentNotification.setMessage(message2);
    IdmNotificationLogDto logDto = notificationManager.send(parentNotification);
    notification.setParent(logDto.getMessage().getId());
    // 
    // send message
    IdmNotificationTemplateDto template = createTestTemplate();
    IdmMessageDto message = new IdmMessageDto.Builder().setTemplate(template).build();
    notification.setMessage(message);
    notificationManager.send(notification);
    // set filter
    filter.setParent(logDto.getId());
    Page<IdmNotificationLogDto> result = notificationLogService.find(filter, null);
    assertEquals("Wrong sender", logDto.getId(), result.getContent().get(0).getParent());
}
Also used : IdmNotificationDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmNotificationDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto)8 IdmMessageDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto)7 Test (org.junit.Test)6 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)4 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)4 IdmNotificationTemplateDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto)4 IdmNotificationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter)4 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)4 DefaultAttachmentManagerIntegrationTest (eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest)2 IdmEmailLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmEmailLogDto)2 AbstractRestTest (eu.bcvsolutions.idm.test.api.AbstractRestTest)2 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 Lists (com.google.common.collect.Lists)1 BaseDtoController (eu.bcvsolutions.idm.core.api.rest.BaseDtoController)1 IdmIdentityService (eu.bcvsolutions.idm.core.api.service.IdmIdentityService)1 InitTestDataProcessor (eu.bcvsolutions.idm.core.model.event.processor.module.InitTestDataProcessor)1 NotificationLevel (eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel)1 IdmNotificationRecipientDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationRecipientDto)1