Search in sources :

Example 1 with IdmNotificationAttachmentFilter

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

the class IdmNotificationAttachmentControllerTest method testDownload.

@Test
public void testDownload() throws Exception {
    NotificationConfigurationDto config = createConfig();
    IdmNotificationTemplateDto template = createTestTemplate();
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    // 
    IdmAttachmentDto attachmentOne = DefaultAttachmentManagerIntegrationTest.prepareDtoWithoutContent();
    // prepared attachment
    attachmentOne.setInputData(IOUtils.toInputStream(getHelper().createName()));
    IdmAttachmentDto attachment = DefaultAttachmentManagerIntegrationTest.prepareDtoWithoutContent();
    String content = getHelper().createName();
    attachment.setInputData(IOUtils.toInputStream(content));
    IdmAttachmentDto attachmentTwo = attachmentManager.saveAttachment(identity, attachment);
    List<IdmAttachmentDto> attachments = Lists.newArrayList(attachmentOne, attachmentTwo);
    // 
    List<IdmNotificationLogDto> notifications = notificationManager.send(config.getTopic(), new IdmMessageDto.Builder().setTemplate(template).build(), null, Lists.newArrayList(identity), attachments);
    Assert.assertEquals(1, notifications.size());
    Assert.assertTrue(notifications.stream().anyMatch(n -> n.getType().equals(IdmEmailLog.NOTIFICATION_TYPE)));
    // 
    IdmNotificationLogDto notification = notifications.get(0);
    // 
    IdmNotificationAttachmentFilter notificationAttachmentFilter = new IdmNotificationAttachmentFilter();
    notificationAttachmentFilter.setNotification(notification.getId());
    List<IdmNotificationAttachmentDto> notificationAttachments = notificationAttachmentService.find(notificationAttachmentFilter, null).getContent();
    Assert.assertEquals(2, notificationAttachments.size());
    Assert.assertTrue(notificationAttachments.stream().allMatch(na -> na.getAttachment() != null));
    Assert.assertTrue(notificationAttachments.stream().anyMatch(na -> na.getAttachment().equals(attachmentTwo.getId())));
    IdmNotificationAttachmentDto notificationAttachment = notificationAttachments.stream().filter(na -> na.getAttachment().equals(attachmentTwo.getId())).findFirst().get();
    // 
    // download attachment
    String response = getMockMvc().perform(MockMvcRequestBuilders.get(getDetailUrl(notificationAttachment.getId()) + "/download").with(authentication(getAdminAuthentication()))).andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
    Assert.assertEquals(content, response);
    // 
    // 404 - notification attachment not found
    getMockMvc().perform(MockMvcRequestBuilders.get(getDetailUrl(UUID.randomUUID()) + "/download").with(authentication(getAdminAuthentication()))).andExpect(status().isNotFound());
    // 
    // 404 - delete attachment (e.g. simulate ecm store purge)
    attachmentManager.delete(attachmentTwo);
    getMockMvc().perform(MockMvcRequestBuilders.get(getDetailUrl(notificationAttachment.getId()) + "/download").with(authentication(getAdminAuthentication()))).andExpect(status().isNotFound());
}
Also used : IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) NotificationManager(eu.bcvsolutions.idm.core.notification.api.service.NotificationManager) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) Autowired(org.springframework.beans.factory.annotation.Autowired) AbstractReadWriteDtoControllerRestTest(eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest) IdmNotificationConfigurationService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationConfigurationService) Lists(com.google.common.collect.Lists) AbstractReadWriteDtoController(eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoController) SecurityMockMvcRequestPostProcessors.authentication(org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication) MockMvcResultMatchers.status(org.springframework.test.web.servlet.result.MockMvcResultMatchers.status) NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) UUID(java.util.UUID) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) MockMvcRequestBuilders(org.springframework.test.web.servlet.request.MockMvcRequestBuilders) IdmNotificationLogService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationLogService) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) IdmNotificationTemplateService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationTemplateService) IdmEmailLog(eu.bcvsolutions.idm.core.notification.entity.IdmEmailLog) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) Assert(org.junit.Assert) IdmNotificationAttachmentService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationAttachmentService) NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AbstractReadWriteDtoControllerRestTest(eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) Test(org.junit.Test)

Example 2 with IdmNotificationAttachmentFilter

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

the class IdmNotificationAttachmentControllerTest method testFindByNotification.

@Test
public void testFindByNotification() {
    IdmNotificationAttachmentDto attachmentOne = createDto();
    // other
    createDto();
    // 
    IdmNotificationAttachmentFilter filter = new IdmNotificationAttachmentFilter();
    filter.setNotification(attachmentOne.getNotification());
    List<IdmNotificationAttachmentDto> attachments = find(filter);
    Assert.assertEquals(1, attachments.size());
    Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(attachmentOne.getId())));
}
Also used : IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) NotificationManager(eu.bcvsolutions.idm.core.notification.api.service.NotificationManager) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) Autowired(org.springframework.beans.factory.annotation.Autowired) AbstractReadWriteDtoControllerRestTest(eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest) IdmNotificationConfigurationService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationConfigurationService) Lists(com.google.common.collect.Lists) AbstractReadWriteDtoController(eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoController) SecurityMockMvcRequestPostProcessors.authentication(org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication) MockMvcResultMatchers.status(org.springframework.test.web.servlet.result.MockMvcResultMatchers.status) NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) UUID(java.util.UUID) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) MockMvcRequestBuilders(org.springframework.test.web.servlet.request.MockMvcRequestBuilders) IdmNotificationLogService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationLogService) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) IdmNotificationTemplateService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationTemplateService) IdmEmailLog(eu.bcvsolutions.idm.core.notification.entity.IdmEmailLog) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) Assert(org.junit.Assert) IdmNotificationAttachmentService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationAttachmentService) IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) AbstractReadWriteDtoControllerRestTest(eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) Test(org.junit.Test)

Example 3 with IdmNotificationAttachmentFilter

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

the class DefaultRptReportManagerIntegrationTest method testSendDefaultNotificationAfterEnd.

@Test
public void testSendDefaultNotificationAfterEnd() throws Exception {
    IdmIdentityDto identity = getHelper().createIdentity();
    // 
    try {
        // report is sent to logged identity by default
        getHelper().login(identity);
        // 
        RptReportDto report = new RptReportDto();
        report.setExecutorName(TestReportExecutor.REPORT_NAME);
        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));
        }
        // 
        // test notification is sent
        IdmNotificationFilter notificationFilter = new IdmNotificationFilter();
        notificationFilter.setTopic(RptModuleDescriptor.TOPIC_REPORT_GENERATE_SUCCESS);
        notificationFilter.setRecipient(identity.getUsername());
        notificationFilter.setNotificationType(IdmNotificationLog.class);
        List<IdmNotificationLogDto> notifications = notificationService.find(notificationFilter, null).getContent();
        Assert.assertEquals(1, notifications.size());
        // 
        // test notification attachments
        IdmNotificationAttachmentFilter notificationAttachmentFilter = new IdmNotificationAttachmentFilter();
        notificationAttachmentFilter.setNotification(notifications.get(0).getId());
        List<IdmNotificationAttachmentDto> notificationAttachments = notificationAttachmentService.find(notificationAttachmentFilter, null).getContent();
        Assert.assertEquals(1, notificationAttachments.size());
        Assert.assertNotNull(notificationAttachments.get(0).getAttachment());
        // 
        reportService.delete(report);
        attachmentManager.deleteAttachments(report);
    } finally {
        logout();
    }
}
Also used : IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) InputStream(java.io.InputStream) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) RptReportDto(eu.bcvsolutions.idm.rpt.api.dto.RptReportDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 4 with IdmNotificationAttachmentFilter

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

the class DefaultNotificationServiceIntegrationTest method testSendWithWrongAttachments.

@Test
public void testSendWithWrongAttachments() {
    NotificationConfigurationDto config = createConfig();
    IdmNotificationTemplateDto template = createTestTemplate();
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    // attachment without content
    IdmAttachmentDto attachment = attachmentManager.save(DefaultAttachmentManagerIntegrationTest.prepareDto());
    // 
    List<IdmNotificationLogDto> notifications = notificationManager.send(config.getTopic(), new IdmMessageDto.Builder().setTemplate(template).build(), null, Lists.newArrayList(identity), Lists.newArrayList(attachment));
    Assert.assertEquals(1, notifications.size());
    Assert.assertTrue(notifications.stream().anyMatch(n -> n.getType().equals(IdmEmailLog.NOTIFICATION_TYPE)));
    // 
    IdmNotificationLogDto notification = notifications.get(0);
    Assert.assertEquals(NotificationState.NOT, notification.getState());
    // 
    IdmNotificationAttachmentFilter notificationAttachmentFilter = new IdmNotificationAttachmentFilter();
    notificationAttachmentFilter.setNotification(notification.getId());
    List<IdmNotificationAttachmentDto> notificationAttachments = notificationAttachmentService.find(notificationAttachmentFilter, null).getContent();
    Assert.assertEquals(1, notificationAttachments.size());
    Assert.assertTrue(notificationAttachments.stream().allMatch(na -> na.getAttachment() != null));
    Assert.assertTrue(notificationAttachments.stream().anyMatch(na -> na.getAttachment().equals(attachment.getId())));
    // 
    notificationLogService.delete(notification);
}
Also used : IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) Arrays(java.util.Arrays) IdmNotificationRecipientService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationRecipientService) NotificationManager(eu.bcvsolutions.idm.core.notification.api.service.NotificationManager) ZonedDateTime(java.time.ZonedDateTime) Autowired(org.springframework.beans.factory.annotation.Autowired) NotificationState(eu.bcvsolutions.idm.core.notification.api.domain.NotificationState) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmNotificationConfiguration(eu.bcvsolutions.idm.core.notification.entity.IdmNotificationConfiguration) IdmEmailLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmEmailLogDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) IdmNotificationDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto) IdmEmailLogService(eu.bcvsolutions.idm.core.notification.api.service.IdmEmailLogService) Page(org.springframework.data.domain.Page) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) IdmEmailLogRepository(eu.bcvsolutions.idm.core.notification.repository.IdmEmailLogRepository) IdmNotificationTemplateService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationTemplateService) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) IdmConsoleLog(eu.bcvsolutions.idm.core.notification.entity.IdmConsoleLog) IdmNotificationLogRepository(eu.bcvsolutions.idm.core.notification.repository.IdmNotificationLogRepository) IdmNotificationConfigurationRepository(eu.bcvsolutions.idm.core.notification.repository.IdmNotificationConfigurationRepository) IdmNotificationConfigurationService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationConfigurationService) Lists(com.google.common.collect.Lists) NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) InitTestDataProcessor(eu.bcvsolutions.idm.core.model.event.processor.module.InitTestDataProcessor) IdmNotificationRecipientDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationRecipientDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) EmailNotificationSender(eu.bcvsolutions.idm.core.notification.api.service.EmailNotificationSender) Before(org.junit.Before) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) IdmNotificationRecipientFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationRecipientFilter) IdmNotificationLog(eu.bcvsolutions.idm.core.notification.entity.IdmNotificationLog) IdmNotificationLogService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationLogService) IdmEmailLog(eu.bcvsolutions.idm.core.notification.entity.IdmEmailLog) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) Assert(org.junit.Assert) Assert.assertEquals(org.junit.Assert.assertEquals) IdmNotificationAttachmentService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationAttachmentService) Transactional(org.springframework.transaction.annotation.Transactional) NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 5 with IdmNotificationAttachmentFilter

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

the class DefaultNotificationServiceIntegrationTest method testSendWithAttachments.

@Test
public void testSendWithAttachments() {
    NotificationConfigurationDto config = createConfig();
    IdmNotificationTemplateDto template = createTestTemplate();
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    // 
    IdmAttachmentDto attachmentOne = DefaultAttachmentManagerIntegrationTest.prepareDtoWithoutContent();
    // prepared attachment
    attachmentOne.setInputData(IOUtils.toInputStream("mock-content"));
    IdmAttachmentDto attachment = DefaultAttachmentManagerIntegrationTest.prepareDtoWithoutContent();
    attachment.setInputData(IOUtils.toInputStream("mock-content"));
    IdmAttachmentDto attachmentTwo = attachmentManager.saveAttachment(identity, attachment);
    List<IdmAttachmentDto> attachments = Lists.newArrayList(attachmentOne, attachmentTwo);
    // 
    List<IdmNotificationLogDto> notifications = notificationManager.send(config.getTopic(), new IdmMessageDto.Builder().setTemplate(template).build(), null, Lists.newArrayList(identity), attachments);
    Assert.assertEquals(1, notifications.size());
    Assert.assertTrue(notifications.stream().anyMatch(n -> n.getType().equals(IdmEmailLog.NOTIFICATION_TYPE)));
    // 
    IdmNotificationLogDto notification = notifications.get(0);
    // 
    IdmNotificationAttachmentFilter notificationAttachmentFilter = new IdmNotificationAttachmentFilter();
    notificationAttachmentFilter.setNotification(notification.getId());
    List<IdmNotificationAttachmentDto> notificationAttachments = notificationAttachmentService.find(notificationAttachmentFilter, null).getContent();
    Assert.assertEquals(2, notificationAttachments.size());
    Assert.assertTrue(notificationAttachments.stream().allMatch(na -> na.getAttachment() != null));
    Assert.assertTrue(notificationAttachments.stream().anyMatch(na -> na.getAttachment().equals(attachmentTwo.getId())));
    // 
    notificationLogService.delete(notification);
}
Also used : IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) Arrays(java.util.Arrays) IdmNotificationRecipientService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationRecipientService) NotificationManager(eu.bcvsolutions.idm.core.notification.api.service.NotificationManager) ZonedDateTime(java.time.ZonedDateTime) Autowired(org.springframework.beans.factory.annotation.Autowired) NotificationState(eu.bcvsolutions.idm.core.notification.api.domain.NotificationState) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmNotificationConfiguration(eu.bcvsolutions.idm.core.notification.entity.IdmNotificationConfiguration) IdmEmailLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmEmailLogDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) IdmNotificationDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto) IdmEmailLogService(eu.bcvsolutions.idm.core.notification.api.service.IdmEmailLogService) Page(org.springframework.data.domain.Page) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) IdmEmailLogRepository(eu.bcvsolutions.idm.core.notification.repository.IdmEmailLogRepository) IdmNotificationTemplateService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationTemplateService) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) IdmConsoleLog(eu.bcvsolutions.idm.core.notification.entity.IdmConsoleLog) IdmNotificationLogRepository(eu.bcvsolutions.idm.core.notification.repository.IdmNotificationLogRepository) IdmNotificationConfigurationRepository(eu.bcvsolutions.idm.core.notification.repository.IdmNotificationConfigurationRepository) IdmNotificationConfigurationService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationConfigurationService) Lists(com.google.common.collect.Lists) NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) InitTestDataProcessor(eu.bcvsolutions.idm.core.model.event.processor.module.InitTestDataProcessor) IdmNotificationRecipientDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationRecipientDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) EmailNotificationSender(eu.bcvsolutions.idm.core.notification.api.service.EmailNotificationSender) Before(org.junit.Before) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) IdmNotificationRecipientFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationRecipientFilter) IdmNotificationLog(eu.bcvsolutions.idm.core.notification.entity.IdmNotificationLog) IdmNotificationLogService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationLogService) IdmEmailLog(eu.bcvsolutions.idm.core.notification.entity.IdmEmailLog) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) Assert(org.junit.Assert) Assert.assertEquals(org.junit.Assert.assertEquals) IdmNotificationAttachmentService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationAttachmentService) Transactional(org.springframework.transaction.annotation.Transactional) NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IdmNotificationAttachmentDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto) IdmNotificationAttachmentFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) DefaultAttachmentManagerIntegrationTest(eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmNotificationAttachmentFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationAttachmentFilter)7 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)6 IdmNotificationAttachmentDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationAttachmentDto)6 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)6 Test (org.junit.Test)6 Lists (com.google.common.collect.Lists)5 IdmAttachmentDto (eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto)5 AttachmentManager (eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager)5 DefaultAttachmentManagerIntegrationTest (eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest)5 NotificationLevel (eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel)5 IdmMessageDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto)5 IdmNotificationTemplateDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto)5 NotificationConfigurationDto (eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto)5 IdmNotificationAttachmentService (eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationAttachmentService)5 IdmNotificationConfigurationService (eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationConfigurationService)5 IdmNotificationLogService (eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationLogService)5 IdmNotificationTemplateService (eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationTemplateService)5 NotificationManager (eu.bcvsolutions.idm.core.notification.api.service.NotificationManager)5 IdmEmailLog (eu.bcvsolutions.idm.core.notification.entity.IdmEmailLog)5 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)5