use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method clearProvisioningBreakConfiguration.
/**
* Clear all provisioning break and also clear global provisioning break
* configuration. Is necessary clear provisioning break for another test!
*/
private void clearProvisioningBreakConfiguration() {
// remove specific configuration
for (SysProvisioningBreakConfigDto config : provisioningBreakConfig.find(null)) {
provisioningBreakConfig.delete(config);
}
//
clearGlobalConfiguration(ProvisioningBreakConfiguration.GLOBAL_BREAK_DELETE_OPERATION);
clearGlobalConfiguration(ProvisioningBreakConfiguration.GLOBAL_BREAK_UPDATE_OPERATION);
clearGlobalConfiguration(ProvisioningBreakConfiguration.GLOBAL_BREAK_CREATE_OPERATION);
}
use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testRecipientIdentityIntegrity.
@Test
public void testRecipientIdentityIntegrity() {
SysSystemDto systemDto = testHelper.createSystem(TestResource.TABLE_NAME);
SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, null, ProvisioningEventType.CREATE, systemDto.getId());
//
IdmIdentityDto identityDto = testHelper.createIdentity();
//
this.createRecipient(breakConfig.getId(), identityDto.getId(), null);
//
int size = provisioningBreakRecipient.findAllByBreakConfig(breakConfig.getId()).size();
assertEquals(1, size);
//
identityService.delete(identityDto);
//
size = provisioningBreakRecipient.findAllByBreakConfig(breakConfig.getId()).size();
assertEquals(0, size);
}
use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testDisableCreateOperation.
@Test
public void testDisableCreateOperation() {
SysSystemDto system = testHelper.createTestResourceSystem(true);
IdmIdentityDto identity = testHelper.createIdentity();
IdmIdentityDto identity2 = testHelper.createIdentity();
IdmIdentityDto identity3 = testHelper.createIdentity();
SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 2, null, ProvisioningEventType.CREATE, system.getId());
IdmIdentityDto recipient = testHelper.createIdentity();
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());
assertEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.
the class ProvisioningBreakProcessorTest method testDisableUpdateOperationWithZeroLimit.
@Test
public void testDisableUpdateOperationWithZeroLimit() {
SysSystemDto system = testHelper.createTestResourceSystem(true);
IdmIdentityDto identity = testHelper.createIdentity();
SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 0, null, ProvisioningEventType.UPDATE, system.getId());
IdmIdentityDto recipient = testHelper.createIdentity();
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());
assertEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningBreakConfigService method getGlobalBreakConfiguration.
@Override
public SysProvisioningBreakConfigDto getGlobalBreakConfiguration(ProvisioningEventType eventType) {
SysProvisioningBreakConfigDto globalConfig = new SysProvisioningBreakConfigDto();
Boolean disable = provisioningBreakConfiguration.getDisabled(eventType);
if (disable == null) {
// global provisioning break configuration isn't set
return null;
}
globalConfig.setDisabled(disable);
globalConfig.setDisableLimit(provisioningBreakConfiguration.getDisableLimit(eventType));
globalConfig.setGlobalConfiguration(Boolean.TRUE);
//
IdmNotificationTemplateDto disabledTemplate = provisioningBreakConfiguration.getDisableTemplate(eventType);
if (disabledTemplate != null) {
globalConfig.setDisableTemplate(disabledTemplate.getId());
globalConfig.setDisableTemplateEmbedded(disabledTemplate);
}
//
IdmNotificationTemplateDto warningTemplate = provisioningBreakConfiguration.getWarningTemplate(eventType);
if (warningTemplate != null) {
globalConfig.setWarningTemplate(warningTemplate.getId());
globalConfig.setWarningTemplateEmbedded(warningTemplate);
}
//
globalConfig.setOperationType(eventType);
globalConfig.setPeriod(provisioningBreakConfiguration.getPeriod(eventType));
// global provisioning break hasn't system id, don't save global config
globalConfig.setSystem(null);
globalConfig.setWarningLimit(provisioningBreakConfiguration.getWarningLimit(eventType));
globalConfig.setTrimmed(true);
return globalConfig;
}
Aggregations