Search in sources :

Example 11 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class ProvisioningBreakProcessorTest method testRecipientSystemntegrity.

@Test
public void testRecipientSystemntegrity() {
    SysSystemDto systemDto = testHelper.createSystem(TestResource.TABLE_NAME);
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, null, ProvisioningEventType.CREATE, systemDto.getId());
    // 
    SysProvisioningBreakConfigDto breakConfigFounded = provisioningBreakConfig.get(breakConfig.getId());
    assertNotNull(breakConfigFounded);
    // 
    systemService.delete(systemDto);
    // 
    breakConfigFounded = provisioningBreakConfig.get(breakConfig.getId());
    assertNull(breakConfigFounded);
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 12 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class ProvisioningBreakProcessorTest method testWarningCreateOperation.

@Test
public void testWarningCreateOperation() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    IdmIdentityDto identity2 = testHelper.createIdentity();
    IdmIdentityDto identity3 = testHelper.createIdentity();
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, 2, 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());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 13 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class ProvisioningBreakProcessorTest method testWarningDeleteOperation.

@Test
public void testWarningDeleteOperation() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    IdmIdentityDto identity2 = testHelper.createIdentity();
    IdmIdentityDto identity3 = testHelper.createIdentity();
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, 2, ProvisioningEventType.DELETE, 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);
    // 
    identityService.delete(identity);
    identityService.delete(identity2);
    identityService.delete(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());
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 14 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class SystemDeleteProcessor method clearProvisioningBreakAndCache.

/**
 * Method clear all provisioning cache for system.
 *
 * @param systemId
 */
private void clearProvisioningBreakAndCache(UUID systemId) {
    provisioningBreakConfigService.clearCache(systemId, ProvisioningEventType.CREATE);
    provisioningBreakConfigService.clearCache(systemId, ProvisioningEventType.DELETE);
    provisioningBreakConfigService.clearCache(systemId, ProvisioningEventType.UPDATE);
    // 
    SysProvisioningBreakConfigDto config = provisioningBreakConfigService.getConfig(ProvisioningEventType.CREATE, systemId);
    if (config != null) {
        provisioningBreakConfigService.delete(config);
    }
    // 
    config = provisioningBreakConfigService.getConfig(ProvisioningEventType.UPDATE, systemId);
    if (config != null) {
        provisioningBreakConfigService.delete(config);
    }
    // 
    config = provisioningBreakConfigService.getConfig(ProvisioningEventType.DELETE, systemId);
    if (config != null) {
        provisioningBreakConfigService.delete(config);
    }
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto)

Example 15 with SysProvisioningBreakConfigDto

use of eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto in project CzechIdMng by bcvsolutions.

the class ProvisioningBreakProcessorTest method createProvisioningBreak.

/**
 * Create provisioning break for given system with given attributes
 *
 * @param period
 * @param disableLimit
 * @param warningLimit
 * @param eventType
 * @param systemId
 * @return
 */
private SysProvisioningBreakConfigDto createProvisioningBreak(Long period, Integer disableLimit, Integer warningLimit, ProvisioningEventType eventType, UUID systemId) {
    SysProvisioningBreakConfigDto config = new SysProvisioningBreakConfigDto();
    config.setOperationType(eventType);
    config.setPeriod(period);
    config.setDisableLimit(disableLimit);
    config.setWarningLimit(warningLimit);
    config.setSystem(systemId);
    return provisioningBreakConfig.save(config);
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto)

Aggregations

SysProvisioningBreakConfigDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto)24 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)16 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)15 Test (org.junit.Test)15 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)13 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)10 IdmNotificationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter)10 SysProvisioningBreakItems (eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakItems)3 SysProvisioningBatchDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto)2 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)2 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)2 SysProvisioningBreakConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningBreakConfigFilter)2 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)2 IdmNotificationTemplateDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto)2 ProvisioningEventType (eu.bcvsolutions.idm.acc.domain.ProvisioningEventType)1 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)1 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)1 ArrayList (java.util.ArrayList)1 PageImpl (org.springframework.data.domain.PageImpl)1 PageRequest (org.springframework.data.domain.PageRequest)1