Search in sources :

Example 11 with NotificationConfigurationDto

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

the class IdmNotificationConfigurationFilterTest method testNotificationTypeFilter.

@Test
public void testNotificationTypeFilter() {
    String text = "someText" + System.currentTimeMillis();
    NotificationConfigurationDto notification = createNotification(NotificationLevel.SUCCESS, CoreModuleDescriptor.MODULE_ID + ":test004", text, null);
    IdmNotificationConfigurationFilter filter = new IdmNotificationConfigurationFilter();
    filter.setNotificationType(text);
    filter.setText("core:test004");
    Page<NotificationConfigurationDto> result = idmNotificationConfService.find(filter, null);
    assertEquals(1, result.getTotalElements());
    assertEquals(notification.getId(), result.getContent().get(0).getId());
}
Also used : NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) IdmNotificationConfigurationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationConfigurationFilter) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 12 with NotificationConfigurationDto

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

the class NotificationSmtpTest method A_sendEmailViaSmtpByManager.

@Test
public void A_sendEmailViaSmtpByManager() throws InterruptedException, BindPortException, OutOfRangePortException {
    // in first test start smtp server
    if (!this.isRunning()) {
        this.startSmtpServer();
    }
    // create config
    NotificationConfigurationDto config = new NotificationConfigurationDto();
    config.setTopic(TOPIC);
    config.setLevel(NotificationLevel.SUCCESS);
    config.setNotificationType(IdmEmailLog.NOTIFICATION_TYPE);
    config = notificationConfigurationService.save(config);
    // init observer for this test only
    NotificationObserver observer = new NotificationObserver(1);
    this.addObserver(observer);
    int currentEmails = observer.getEmails().size();
    assertTrue(this.isRunning());
    String textHtml = "textHtml-" + System.currentTimeMillis();
    String textText = "textText-" + System.currentTimeMillis();
    String subject = "subject-" + System.currentTimeMillis();
    IdmIdentityDto identity = helper.createIdentity();
    identity.setEmail("example@example.tld");
    identity = identityService.save(identity);
    notificationManager.send(TOPIC, new IdmMessageDto.Builder().setTextMessage(textText).setHtmlMessage(textHtml).setSubject(subject).setLevel(NotificationLevel.SUCCESS).build(), identity);
    // email is send by apache camel asynchronously
    if (observer.getEmails().size() == currentEmails) {
        observer.waitForMails();
    }
    assertEquals(currentEmails + 1, observer.getEmails().size());
    assertTrue(this.isRunning());
    for (EmailModel email : observer.getEmails()) {
        assertEquals(FROM, email.getFrom());
        assertTrue(email.getEmailStr().contains(textHtml));
        assertEquals(subject, email.getSubject());
        assertEquals(identity.getEmail(), email.getTo());
    }
    notificationConfigurationService.delete(config);
}
Also used : NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) EmailModel(com.nilhcem.fakesmtp.model.EmailModel) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) Test(org.junit.Test) AbstractNotificationTest(eu.bcvsolutions.idm.test.api.AbstractNotificationTest)

Example 13 with NotificationConfigurationDto

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

the class VirtualSystemModuleDescriptor method getDefaultNotificationConfigurations.

@Override
public List<NotificationConfigurationDto> getDefaultNotificationConfigurations() {
    List<NotificationConfigurationDto> configs = new ArrayList<>();
    configs.add(new NotificationConfigurationDto(TOPIC_VS_REQUEST_CREATED, null, IdmEmailLog.NOTIFICATION_TYPE, "New virtual system request (for realization) was created and send to implementers.", getNotificationTemplateId(TOPIC_VS_REQUEST_CREATED)));
    return configs;
}
Also used : NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) ArrayList(java.util.ArrayList)

Example 14 with NotificationConfigurationDto

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

the class AccModuleDescriptor method getDefaultNotificationConfigurations.

@Override
public List<NotificationConfigurationDto> getDefaultNotificationConfigurations() {
    List<NotificationConfigurationDto> configs = new ArrayList<>();
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_PROVISIONING, null, IdmWebsocketLog.NOTIFICATION_TYPE, "Notification with new provisioning", getNotificationTemplateId("provisioningSuccess")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_PROVISIONING_BREAK_WARNING, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains warning with information about provisioning operation.", getNotificationTemplateId("provisioningWarning")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_PROVISIONING_BREAK_DISABLE, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about blocked system for provisioning operation.", getNotificationTemplateId("provisioningDisable")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_NEW_PASSWORD, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains new password and information about new account.", getNotificationTemplateId("newPassword")));
    // 
    return configs;
}
Also used : NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) ArrayList(java.util.ArrayList)

Example 15 with NotificationConfigurationDto

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

the class CoreModuleDescriptor method getDefaultNotificationConfigurations.

@Override
public List<NotificationConfigurationDto> getDefaultNotificationConfigurations() {
    // TODO: this doesn't make good sense now - should be moved to xml at all?
    // 
    List<NotificationConfigurationDto> configs = new ArrayList<>();
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_CHANGE_IDENTITY_ROLES, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about result WF (change identity roles).", getNotificationTemplateId("changeIdentityRole")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_CHANGE_IDENTITY_ROLES_IMPLEMENTER, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about result WF (change identity roles).", getNotificationTemplateId("changeIdentityRoleImplementer")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_DISAPPROVE_IDENTITY_ROLES, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about disapprove role request.", getNotificationTemplateId("disapproveIdentityRole")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_DISAPPROVE_IDENTITY_ROLES_IMPLEMENTER, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about disapprove role request.", getNotificationTemplateId("disapproveIdentityRoleImplementer")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_RETURN_REQUEST_IDENTITY_ROLES, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about return role request.", getNotificationTemplateId("returnRequestIdentityRole")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_RETURN_REQUEST_IDENTITY_ROLES_IMPLEMENTER, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about return role request.", getNotificationTemplateId("returnRequestIdentityRoleImplementer")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_WF_TASK_ASSIGNED, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about new assigned task to user.", getNotificationTemplateId("wfTaskNotificationMessage")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_WF_TASK_CREATED, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about new assigned task to user.", getNotificationTemplateId("wfTaskNotificationMessage")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_PASSWORD_EXPIRATION_WARNING, null, IdmEmailLog.NOTIFICATION_TYPE, "Password expiration warning.", getNotificationTemplateId("passwordExpirationWarning")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_PASSWORD_EXPIRED, null, IdmEmailLog.NOTIFICATION_TYPE, "Password expired.", getNotificationTemplateId("passwordExpired")));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_IDENTITY_MONITORED_CHANGED_FIELDS, null, IdmEmailLog.NOTIFICATION_TYPE, "This message contains information about changed fields on Identity.", getNotificationTemplateId(IdentityMonitoredFieldsProcessor.EMAIL_TEMPLATE)));
    // 
    configs.add(new NotificationConfigurationDto(TOPIC_PASSWORD_CHANGED, null, IdmEmailLog.NOTIFICATION_TYPE, "Password has been changed.", getNotificationTemplateId("passwordChanged")));
    configs.add(new NotificationConfigurationDto(TOPIC_EVENT, null, IdmConsoleLog.NOTIFICATION_TYPE, "Events (asynchronous).", null));
    return configs;
}
Also used : NotificationConfigurationDto(eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto) ArrayList(java.util.ArrayList)

Aggregations

NotificationConfigurationDto (eu.bcvsolutions.idm.core.notification.api.dto.NotificationConfigurationDto)19 Test (org.junit.Test)11 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)10 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)7 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)6 IdmNotificationTemplateDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto)5 ArrayList (java.util.ArrayList)5 IdmNotificationConfigurationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationConfigurationFilter)4 IdmMessageDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto)3 EmailModel (com.nilhcem.fakesmtp.model.EmailModel)1 AbstractNotificationTest (eu.bcvsolutions.idm.test.api.AbstractNotificationTest)1 HashSet (java.util.HashSet)1 UUID (java.util.UUID)1 Before (org.junit.Before)1 Transactional (org.springframework.transaction.annotation.Transactional)1