Search in sources :

Example 71 with IdmNotificationTemplateDto

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

the class IdmNotificationConfigurationDisabledTest method testNotDisabledErrorWebsocket.

@Test
@Transactional
public void testNotDisabledErrorWebsocket() {
    assertEquals(0, idmNotificationRepository.count());
    NotificationLevel level = NotificationLevel.ERROR;
    IdmNotificationTemplateDto template = createTestTemplate("Idm test notification", "disabled test");
    IdmIdentityDto identity = getHelper().createIdentity("Test_disable_notifications" + System.currentTimeMillis());
    configs.add(createNotificationConfiguration(TOPIC, level, IdmConsoleLog.NOTIFICATION_TYPE, template.getId(), false));
    IdmMessageDto message = new IdmMessageDto();
    message.setTemplate(template);
    message.setLevel(level);
    notificationManager.send(TOPIC, message, identity);
    IdmNotificationFilter filter = new IdmNotificationFilter();
    filter.setNotificationType(IdmNotificationLog.class);
    assertEquals(1, notificationLogService.find(filter, null).getTotalElements());
    deleteNotificationConfig();
}
Also used : IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 72 with IdmNotificationTemplateDto

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

the class IdmNotificationConfigurationDisabledTest method testNotDisabled.

@Test
@Transactional
public void testNotDisabled() {
    assertEquals(0, idmNotificationRepository.count());
    NotificationLevel level = NotificationLevel.ERROR;
    IdmNotificationTemplateDto template = createTestTemplate("Idm test notification", "disabled test");
    IdmIdentityDto identity = getHelper().createIdentity("Test_disable_notifications" + System.currentTimeMillis());
    configs.add(createNotificationConfiguration(TOPIC, null, IdmConsoleLog.NOTIFICATION_TYPE, template.getId(), false));
    configs.add(createNotificationConfiguration(TOPIC, null, IdmEmailLog.NOTIFICATION_TYPE, template.getId(), false));
    IdmMessageDto message = new IdmMessageDto();
    message.setTemplate(template);
    message.setLevel(level);
    notificationManager.send(TOPIC, message, identity);
    IdmNotificationFilter filter = new IdmNotificationFilter();
    filter.setNotificationType(IdmNotificationLog.class);
    assertEquals(2, notificationLogService.find(filter, null).getTotalElements());
    deleteNotificationConfig();
}
Also used : IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 73 with IdmNotificationTemplateDto

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

the class IdmNotificationConfigurationDisabledTest method testDisabledErrorEmail.

@Test
@Transactional
public void testDisabledErrorEmail() {
    assertEquals(0, idmNotificationRepository.count());
    NotificationLevel level = NotificationLevel.ERROR;
    IdmNotificationTemplateDto template = createTestTemplate("Idm test notification", "disabled test");
    IdmIdentityDto identity = getHelper().createIdentity("Test_disable_notifications" + System.currentTimeMillis());
    configs.add(createNotificationConfiguration(TOPIC, level, IdmEmailLog.NOTIFICATION_TYPE, template.getId(), true));
    IdmMessageDto message = new IdmMessageDto();
    message.setTemplate(template);
    message.setLevel(level);
    notificationManager.send(TOPIC, message, identity);
    IdmNotificationFilter filter = new IdmNotificationFilter();
    filter.setNotificationType(IdmNotificationLog.class);
    assertEquals(0, notificationLogService.find(filter, null).getTotalElements());
    deleteNotificationConfig();
}
Also used : IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 74 with IdmNotificationTemplateDto

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

the class IdmNotificationConfigurationDisabledTest method testOneDisabledError.

@Test
@Transactional
public void testOneDisabledError() {
    assertEquals(0, idmNotificationRepository.count());
    NotificationLevel level = NotificationLevel.ERROR;
    IdmNotificationTemplateDto template = createTestTemplate("Idm test notification", "disabled test");
    IdmIdentityDto identity = getHelper().createIdentity("Test_disable_notifications" + System.currentTimeMillis());
    configs.add(createNotificationConfiguration(TOPIC, level, IdmConsoleLog.NOTIFICATION_TYPE, template.getId(), false));
    configs.add(createNotificationConfiguration(TOPIC, level, IdmEmailLog.NOTIFICATION_TYPE, template.getId(), true));
    IdmMessageDto message = new IdmMessageDto();
    message.setTemplate(template);
    message.setLevel(level);
    notificationManager.send(TOPIC, message, identity);
    IdmNotificationFilter filter = new IdmNotificationFilter();
    filter.setNotificationType(IdmNotificationLog.class);
    assertEquals(1, notificationLogService.find(filter, null).getTotalElements());
    deleteNotificationConfig();
}
Also used : IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 75 with IdmNotificationTemplateDto

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

the class IdmNotificationConfigurationDisabledTest method testDisabledError.

@Test
@Transactional
public void testDisabledError() {
    assertEquals(0, idmNotificationRepository.count());
    NotificationLevel level = NotificationLevel.ERROR;
    IdmNotificationTemplateDto template = createTestTemplate("Idm test notification", "disabled test");
    IdmIdentityDto identity = getHelper().createIdentity("Test_disable_notifications" + System.currentTimeMillis());
    configs.add(createNotificationConfiguration(TOPIC, level, IdmConsoleLog.NOTIFICATION_TYPE, template.getId(), true));
    configs.add(createNotificationConfiguration(TOPIC, level, IdmEmailLog.NOTIFICATION_TYPE, template.getId(), true));
    IdmMessageDto message = new IdmMessageDto();
    message.setTemplate(template);
    message.setLevel(level);
    notificationManager.send(TOPIC, message, identity);
    IdmNotificationFilter filter = new IdmNotificationFilter();
    filter.setNotificationType(IdmNotificationLog.class);
    assertEquals(0, notificationLogService.find(filter, null).getTotalElements());
    deleteNotificationConfig();
}
Also used : IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) NotificationLevel(eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IdmNotificationTemplateDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto)87 Test (org.junit.Test)68 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)53 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)42 IdmMessageDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto)42 IdmNotificationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter)31 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)23 NotificationConfigurationDto (eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto)19 Transactional (org.springframework.transaction.annotation.Transactional)18 DefaultAttachmentManagerIntegrationTest (eu.bcvsolutions.idm.core.ecm.service.impl.DefaultAttachmentManagerIntegrationTest)17 NotificationLevel (eu.bcvsolutions.idm.core.notification.api.domain.NotificationLevel)14 IdmBulkActionDto (eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto)13 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)12 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)11 UUID (java.util.UUID)9 AbstractBulkActionTest (eu.bcvsolutions.idm.test.api.AbstractBulkActionTest)8 ZonedDateTime (java.time.ZonedDateTime)8 IdmNotificationDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationDto)7 IdmNotificationTemplateService (eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationTemplateService)7 HashSet (java.util.HashSet)7