Search in sources :

Example 81 with SysSystemDto

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

the class ProvisioningBreakProcessorTest method testPeriodOld.

@Test
public void testPeriodOld() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 3, 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);
    provisioningService.doProvisioning(identity);
    // 
    SysSystemEntityDto systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, identity.getUsername());
    SysProvisioningBatchDto batch = batchService.findBatch(system.getId(), identity.getId(), systemEntity.getId());
    // 
    assertNull(batch);
    // 
    SysProvisioningBreakItems cacheProcessedItems = provisioningBreakConfig.getCacheProcessedItems(system.getId());
    // 
    // subtrack 25 minutes from all items
    long subtrackMinutes = 1500000;
    List<Long> execudedItems = cacheProcessedItems.getExecutedItems(ProvisioningEventType.UPDATE);
    // it isn't possible use foreEach or another stream function (reference)
    for (Long item : execudedItems) {
        execudedItems.set(execudedItems.indexOf(item), item - subtrackMinutes);
    }
    // 
    provisioningService.doProvisioning(identity);
    provisioningService.doProvisioning(identity);
    // 
    systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, identity.getUsername());
    batch = batchService.findBatch(system.getId(), identity.getId(), systemEntity.getId());
    // 
    assertNull(batch);
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) SysProvisioningBatchDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) SysProvisioningBreakItems(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakItems) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 82 with SysSystemDto

use of eu.bcvsolutions.idm.acc.dto.SysSystemDto 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 83 with SysSystemDto

use of eu.bcvsolutions.idm.acc.dto.SysSystemDto 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 84 with SysSystemDto

use of eu.bcvsolutions.idm.acc.dto.SysSystemDto 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 85 with SysSystemDto

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

the class ProvisioningBreakProcessorTest method testBlockSystemCreate.

@Test
public void testBlockSystemCreate() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    SysBlockedOperationDto blockedOperationDto = new SysBlockedOperationDto();
    blockedOperationDto.blockCreate();
    system.setBlockedOperation(blockedOperationDto);
    system = systemService.save(system);
    // 
    IdmIdentityDto identity = testHelper.createIdentity();
    createProvisioningBreak(20l, 3, 2, ProvisioningEventType.CREATE, system.getId());
    // 
    this.createAccount(system, identity);
    // 
    // create block
    provisioningService.doProvisioning(identity);
    SysSystemEntityDto systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, identity.getUsername());
    // 
    SysProvisioningBatchDto batch = batchService.findBatch(system.getId(), identity.getId(), systemEntity.getId());
    // 
    List<SysProvisioningOperationDto> content = provisioningOperationService.findByBatchId(batch.getId(), null).getContent();
    assertEquals(1, content.size());
    SysProvisioningOperationDto sysProvisioningOperationDto = content.get(0);
    // 
    assertEquals(ProvisioningEventType.CREATE, sysProvisioningOperationDto.getOperationType());
    assertEquals(OperationState.BLOCKED, sysProvisioningOperationDto.getResult().getState());
}
Also used : SysProvisioningBatchDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBatchDto) SysBlockedOperationDto(eu.bcvsolutions.idm.acc.dto.SysBlockedOperationDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)256 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)167 Test (org.junit.Test)167 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)98 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)82 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)56 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)52 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)50 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)45 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)42 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)42 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)32 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)32 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)30 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)29 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)29 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)29 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)28 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)27 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)27