use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testGlobalConfigurationDisabled.
@Test
public void testGlobalConfigurationDisabled() {
SysSystemDto system = getHelper().createTestResourceSystem(true);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
IdmIdentityDto recipient = getHelper().createIdentity((GuardedString) null);
//
// create global configuration
createGlobalConfiguration(ProvisioningBreakConfiguration.GLOBAL_BREAK_UPDATE_OPERATION, true, null, 2, 20l, recipient, null);
//
this.createAccount(system, identity);
//
// create
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
//
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(recipient.getUsername());
List<IdmNotificationLogDto> content = notificationLogService.find(filter, null).getContent();
// two notification (notification +
assertEquals(0, content.size());
// parent)
//
system = systemService.get(system.getId());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testUpdateOperationCombination.
@Test
public void testUpdateOperationCombination() {
SysSystemDto system = getHelper().createTestResourceSystem(true);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 3, 1, ProvisioningEventType.UPDATE, system.getId());
IdmIdentityDto recipient = getHelper().createIdentity((GuardedString) null);
createRecipient(breakConfig.getId(), recipient.getId(), null);
//
this.createAccount(system, identity);
//
//
// create
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
// warning
provisioningService.doProvisioning(identity);
//
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(recipient.getUsername());
List<IdmNotificationLogDto> content = notificationLogService.find(filter, null).getContent();
// two notification (notification +
assertEquals(2, content.size());
// parent)
//
system = systemService.get(system.getId());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
//
provisioningService.doProvisioning(identity);
// block
provisioningService.doProvisioning(identity);
//
filter = new IdmNotificationFilter();
filter.setRecipient(recipient.getUsername());
content = notificationLogService.find(filter, null).getContent();
// four notification (notification +
assertEquals(4, content.size());
// parent) + previous
//
system = systemService.get(system.getId());
assertEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testWarningTemplate.
@Test
public void testWarningTemplate() {
clearProvisioningBreakConfiguration();
String testText = "test-text-" + System.currentTimeMillis();
SysSystemDto system = getHelper().createTestResourceSystem(true);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
IdmIdentityDto recipient = getHelper().createIdentity((GuardedString) null);
SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, 2, ProvisioningEventType.UPDATE, system.getId());
createRecipient(breakConfig.getId(), recipient.getId(), null);
breakConfig.setDisableTemplate(null);
breakConfig.setDisableTemplateEmbedded(null);
breakConfig.setWarningTemplate(null);
breakConfig.setWarningTemplateEmbedded(null);
IdmNotificationTemplateDto template = new IdmNotificationTemplateDto();
template.setBodyHtml(testText);
template.setBodyText(testText);
template.setCode(getHelper().createName());
template.setName(getHelper().createName());
template.setSubject(getHelper().createName());
template = notificationTemplateService.save(template);
breakConfig.setWarningTemplate(template.getId());
breakConfig.setWarningTemplateEmbedded(template);
breakConfig = provisioningBreakConfig.save(breakConfig);
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(recipient.getUsername());
List<IdmNotificationLogDto> content = notificationLogService.find(filter, null).getContent();
// two notification (notification + parent)
assertEquals(0, content.size());
this.createAccount(system, identity);
// create
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
content = notificationLogService.find(filter, null).getContent();
// two notification (notification + parent)
assertEquals(2, content.size());
for (IdmNotificationLogDto notification : content) {
IdmMessageDto message = notification.getMessage();
assertEquals(template.getId(), message.getTemplate().getId());
assertEquals(template.getBodyHtml(), message.getHtmlMessage());
assertEquals(template.getSubject(), message.getSubject());
}
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testWarningUpdateOperationZeroLimit.
@Test
public void testWarningUpdateOperationZeroLimit() {
SysSystemDto system = getHelper().createTestResourceSystem(true);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, 0, ProvisioningEventType.UPDATE, system.getId());
IdmIdentityDto recipient = getHelper().createIdentity((GuardedString) null);
createRecipient(breakConfig.getId(), recipient.getId(), null);
//
this.createAccount(system, identity);
//
//
// create
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity);
//
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(recipient.getUsername());
List<IdmNotificationLogDto> content = notificationLogService.find(filter, null).getContent();
// two notification (notification +
assertEquals(2, content.size());
// parent)
//
system = systemService.get(system.getId());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testWarningCreateOperation.
@Test
public void testWarningCreateOperation() {
SysSystemDto system = getHelper().createTestResourceSystem(true);
IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
IdmIdentityDto identity2 = getHelper().createIdentity((GuardedString) null);
IdmIdentityDto identity3 = getHelper().createIdentity((GuardedString) null);
SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, 2, ProvisioningEventType.CREATE, system.getId());
IdmIdentityDto recipient = getHelper().createIdentity((GuardedString) null);
createRecipient(breakConfig.getId(), recipient.getId(), null);
//
this.createAccount(system, identity);
this.createAccount(system, identity2);
this.createAccount(system, identity3);
//
provisioningService.doProvisioning(identity);
provisioningService.doProvisioning(identity2);
provisioningService.doProvisioning(identity3);
//
IdmNotificationFilter filter = new IdmNotificationFilter();
filter.setRecipient(recipient.getUsername());
List<IdmNotificationLogDto> content = notificationLogService.find(filter, null).getContent();
// two notification (notification +
assertEquals(2, content.size());
// parent)
//
system = systemService.get(system.getId());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
Aggregations