Search in sources :

Example 16 with IdmContractPositionFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmContractPositionFilter in project CzechIdMng by bcvsolutions.

the class DefaultIdmIdentityContractServiceIntegrationTest method testReferentialIntegrityOnContractDelete.

@Test
public void testReferentialIntegrityOnContractDelete() {
    // prepare data
    IdmIdentityDto identity = getHelper().createIdentity((GuardedString) null);
    IdmIdentityDto identityWithContract = getHelper().createIdentity((GuardedString) null);
    IdmIdentityContractDto contract = getHelper().createContract(identityWithContract);
    getHelper().createContractGuarantee(contract.getId(), identity.getId());
    getHelper().createContractPosition(contract);
    // 
    IdmContractGuaranteeFilter filter = new IdmContractGuaranteeFilter();
    filter.setGuaranteeId(identity.getId());
    List<IdmContractGuaranteeDto> guarantees = contractGuaranteeService.find(filter, null).getContent();
    assertEquals(1, guarantees.size());
    // 
    IdmContractPositionFilter positionFilter = new IdmContractPositionFilter();
    positionFilter.setIdentityContractId(contract.getId());
    List<IdmContractPositionDto> positions = contractPositionService.find(positionFilter, null).getContent();
    assertEquals(1, positions.size());
    // 
    getHelper().deleteContract(contract.getId());
    // 
    guarantees = contractGuaranteeService.find(filter, null).getContent();
    Assert.assertTrue(guarantees.isEmpty());
    positions = contractPositionService.find(positionFilter, null).getContent();
    Assert.assertTrue(positions.isEmpty());
}
Also used : IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) IdmContractPositionDto(eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmContractPositionFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractPositionFilter) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmContractGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmContractPositionFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmContractPositionFilter)16 IdmContractPositionDto (eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto)10 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)10 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)7 UUID (java.util.UUID)7 IdmIdentityContractFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter)6 Test (org.junit.Test)6 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)4 SysSyncContractConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto)4 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)4 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)4 IdmContractGuaranteeFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter)4 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)4 CoreResultCode (eu.bcvsolutions.idm.core.api.domain.CoreResultCode)3 OperationState (eu.bcvsolutions.idm.core.api.domain.OperationState)3 IdmContractGuaranteeDto (eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto)3 EntityEvent (eu.bcvsolutions.idm.core.api.event.EntityEvent)3 EventContext (eu.bcvsolutions.idm.core.api.event.EventContext)3 EventResult (eu.bcvsolutions.idm.core.api.event.EventResult)3 AutomaticRoleManager (eu.bcvsolutions.idm.core.api.service.AutomaticRoleManager)3