Search in sources :

Example 76 with SysSystemDto

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

the class ProvisioningBreakProcessorTest method testGlobalConfigurationDisabled.

@Test
public void testGlobalConfigurationDisabled() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    IdmIdentityDto recipient = testHelper.createIdentity();
    // 
    // 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());
}
Also used : 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 77 with SysSystemDto

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

the class ProvisioningBreakProcessorTest method testWarningUpdateOperationZeroLimit.

@Test
public void testWarningUpdateOperationZeroLimit() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, null, 0, 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());
    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 78 with SysSystemDto

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

the class ProvisioningBreakProcessorTest method testPeriod.

@Test
public void testPeriod() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 2, 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);
    // 
    SysProvisioningBreakItems cacheProcessedItems = provisioningBreakConfig.getCacheProcessedItems(system.getId());
    // 
    // subtrack only 19 minutes from all items
    long subtrackMinutes = 1140000;
    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);
    }
    // 
    // block
    provisioningService.doProvisioning(identity);
    // 
    SysSystemEntityDto systemEntity = systemEntityService.getBySystemAndEntityTypeAndUid(system, SystemEntityType.IDENTITY, identity.getUsername());
    SysProvisioningBatchDto batch = batchService.findBatch(system.getId(), identity.getId(), systemEntity.getId());
    // 
    assertNotNull(batch);
    // 
    List<SysProvisioningOperationDto> content = provisioningOperationService.findByBatchId(batch.getId(), null).getContent();
    assertEquals(1, content.size());
    // 
    SysProvisioningOperationDto sysProvisioningOperationDto = content.get(0);
    // 
    assertEquals(ProvisioningEventType.UPDATE, sysProvisioningOperationDto.getOperationType());
    assertEquals(OperationState.BLOCKED, sysProvisioningOperationDto.getResult().getState());
}
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) 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)

Example 79 with SysSystemDto

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

the class ProvisioningBreakProcessorTest method testGlobalConfigurationOverride.

@Test
public void testGlobalConfigurationOverride() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    IdmIdentityDto recipient = testHelper.createIdentity();
    // 
    // create global configuration
    createGlobalConfiguration(ProvisioningBreakConfiguration.GLOBAL_BREAK_UPDATE_OPERATION, false, null, 1, 20l, recipient, null);
    // 
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 3, null, ProvisioningEventType.UPDATE, system.getId());
    IdmIdentityDto recipient2 = testHelper.createIdentity();
    createRecipient(breakConfig.getId(), recipient2.getId(), 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();
    assertEquals(0, content.size());
    // 
    system = systemService.get(system.getId());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getUpdateOperation());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getCreateOperation());
    assertNotEquals(Boolean.TRUE, system.getBlockedOperation().getDeleteOperation());
    // 
    // block
    provisioningService.doProvisioning(identity);
    // 
    filter = new IdmNotificationFilter();
    filter.setRecipient(recipient.getUsername());
    content = notificationLogService.find(filter, null).getContent();
    assertEquals(0, content.size());
    // 
    filter = new IdmNotificationFilter();
    filter.setRecipient(recipient2.getUsername());
    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());
}
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 80 with SysSystemDto

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

the class ProvisioningBreakProcessorTest method testDisableUpdateOperation.

@Test
public void testDisableUpdateOperation() {
    SysSystemDto system = testHelper.createTestResourceSystem(true);
    IdmIdentityDto identity = testHelper.createIdentity();
    SysProvisioningBreakConfigDto breakConfig = createProvisioningBreak(20l, 2, 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);
    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());
}
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)

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