Search in sources :

Example 51 with IdmContractGuaranteeDto

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();
    }
}
Also used : IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmContractGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 52 with IdmContractGuaranteeDto

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();
    }
}
Also used : IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmContractGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 53 with IdmContractGuaranteeDto

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());
}
Also used : IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) 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)

Example 54 with IdmContractGuaranteeDto

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

IdmContractGuaranteeDto (eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto)54 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)42 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)41 Test (org.junit.Test)31 UUID (java.util.UUID)27 IdmContractGuaranteeFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter)20 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)17 HashMap (java.util.HashMap)16 IdmBulkActionDto (eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto)15 AbstractBulkActionTest (eu.bcvsolutions.idm.test.api.AbstractBulkActionTest)13 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)12 List (java.util.List)12 Transactional (org.springframework.transaction.annotation.Transactional)10 IdmContractGuaranteeService (eu.bcvsolutions.idm.core.api.service.IdmContractGuaranteeService)9 Map (java.util.Map)9 Autowired (org.springframework.beans.factory.annotation.Autowired)9 Collectors (java.util.stream.Collectors)8 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)7 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)6 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)6