use of eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto in project CzechIdMng by bcvsolutions.
the class IdentityContractAddGuaranteeByProjectionProcessorIntegrationTest method testGuaranteeIsNotCreatedWithProjectionNotConfigured.
@Test
public void testGuaranteeIsNotCreatedWithProjectionNotConfigured() {
IdmIdentityDto manager = getHelper().createIdentity();
// create identity without projection
IdmIdentityDto identity = new IdmIdentityDto(getHelper().createName());
identity.setFormProjection(createProjection(false).getId());
identity = identityService.save(identity);
try {
getHelper().login(manager);
//
// create new contract for identity with projection with not enabled guarantees
IdmIdentityContractDto contract = getHelper().createContract(identity);
//
IdmContractGuaranteeFilter filter = new IdmContractGuaranteeFilter();
filter.setIdentityContractId(contract.getId());
//
List<IdmContractGuaranteeDto> guarantees = contractGuaranteeService.find(filter, null).getContent();
Assert.assertTrue(guarantees.isEmpty());
} finally {
logout();
}
}
use of eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto in project CzechIdMng by bcvsolutions.
the class IdentityContractAddGuaranteeByProjectionProcessorIntegrationTest method testGuaranteeIsNotCreatedWithoutProjection.
@Test
public void testGuaranteeIsNotCreatedWithoutProjection() {
IdmIdentityDto manager = getHelper().createIdentity();
// create identity without projection
IdmIdentityDto identity = getHelper().createIdentity();
try {
getHelper().login(manager);
//
// create new contract for identity without projection
IdmIdentityContractDto contract = getHelper().createContract(identity);
//
IdmContractGuaranteeFilter filter = new IdmContractGuaranteeFilter();
filter.setIdentityContractId(contract.getId());
//
List<IdmContractGuaranteeDto> guarantees = contractGuaranteeService.find(filter, null).getContent();
Assert.assertTrue(guarantees.isEmpty());
} finally {
logout();
}
}
use of eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto in project CzechIdMng by bcvsolutions.
the class DefaultIdmIdentityContractServiceIntegrationTest method testReferentialIntegrityOnIdentityDelete.
@Test
public void testReferentialIntegrityOnIdentityDelete() {
// 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());
//
IdmContractGuaranteeFilter filter = new IdmContractGuaranteeFilter();
filter.setIdentityContractId(contract.getId());
List<IdmContractGuaranteeDto> guarantees = contractGuaranteeService.find(filter, null).getContent();
assertEquals(1, guarantees.size());
//
getHelper().deleteIdentity(identity.getId());
//
guarantees = contractGuaranteeService.find(filter, null).getContent();
assertEquals(0, guarantees.size());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto 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