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());
}
Aggregations