Search in sources :

Example 16 with SysProvisioningAttribute

use of eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute in project CzechIdMng by bcvsolutions.

the class DefaultProvisioningExecutorIntegrationTest method testDeleteOperations.

@Test
public void testDeleteOperations() {
    SysSystemDto systemOne = getHelper().createTestResourceSystem(true);
    SysSystemDto systemTwo = getHelper().createTestResourceSystem(true);
    // 
    SysProvisioningOperationDto createProvisioningOperationOne = createProvisioningOperation(systemOne, getHelper().createName());
    createProvisioningOperationOne.setResult(new OperationResult(OperationState.BLOCKED));
    createProvisioningOperationOne = provisioningOperationService.save(createProvisioningOperationOne);
    SysProvisioningAttribute attributeOne = provisioningAttributeRepository.save(new SysProvisioningAttribute(createProvisioningOperationOne.getId(), getHelper().createName()));
    SysProvisioningOperationDto createProvisioningOperationTwo = createProvisioningOperation(systemTwo, getHelper().createName());
    createProvisioningOperationTwo.setResult(new OperationResult(OperationState.BLOCKED));
    createProvisioningOperationTwo = provisioningOperationService.save(createProvisioningOperationTwo);
    SysProvisioningAttribute attributeTwo = provisioningAttributeRepository.save(new SysProvisioningAttribute(createProvisioningOperationTwo.getId(), getHelper().createName()));
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemId(systemOne.getId());
    Assert.assertEquals(1, provisioningOperationService.find(filter, null).getTotalElements());
    filter.setSystemId(systemTwo.getId());
    Assert.assertEquals(1, provisioningOperationService.find(filter, null).getTotalElements());
    // 
    provisioningOperationService.deleteOperations(systemOne.getId());
    Assert.assertNull(provisioningAttributeRepository.findById(attributeOne.getId()).orElse(null));
    Assert.assertNotNull(provisioningAttributeRepository.findById(attributeTwo.getId()).get());
    // 
    filter.setSystemId(systemOne.getId());
    Assert.assertEquals(0, provisioningOperationService.find(filter, null).getTotalElements());
    filter.setSystemId(systemTwo.getId());
    Assert.assertEquals(1, provisioningOperationService.find(filter, null).getTotalElements());
}
Also used : SysProvisioningAttribute(eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) 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

SysProvisioningAttribute (eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute)16 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)10 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)10 Test (org.junit.Test)10 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)9 SysProvisioningArchiveDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto)7 IcAttribute (eu.bcvsolutions.idm.ic.api.IcAttribute)7 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)6 IcAttributeImpl (eu.bcvsolutions.idm.ic.impl.IcAttributeImpl)6 IcConnectorObjectImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)6 IcObjectClassImpl (eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl)6 ProvisioningEventType (eu.bcvsolutions.idm.acc.domain.ProvisioningEventType)2 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)2 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)2 OperationState (eu.bcvsolutions.idm.core.api.domain.OperationState)2 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)2 ZonedDateTime (java.time.ZonedDateTime)2 UUID (java.util.UUID)2 Predicate (javax.persistence.criteria.Predicate)2 Transactional (org.springframework.transaction.annotation.Transactional)2