Search in sources :

Example 86 with IdmIdentityContractDto

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

the class DefaultIdmIdentityContractServiceIntegrationTest method testDisableIdentityAfterDisableContract.

@Test
public void testDisableIdentityAfterDisableContract() {
    IdmIdentityDto identity = helper.createIdentity();
    IdmIdentityContractDto contract = helper.getPrimeContract(identity.getId());
    contract.setState(ContractState.DISABLED);
    contract = service.save(contract);
    // 
    identity = (IdmIdentityDto) lookupService.lookupDto(IdmIdentityDto.class, identity.getId());
    Assert.assertTrue(identity.isDisabled());
}
Also used : IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 87 with IdmIdentityContractDto

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

the class DefaultIdmIdentityContractServiceIntegrationTest method testDisableIdentityAfterCreateInvalidContract.

@Test
public void testDisableIdentityAfterCreateInvalidContract() {
    IdmIdentityDto identity = helper.createIdentity();
    IdmIdentityContractDto contract = helper.getPrimeContract(identity.getId());
    service.delete(contract);
    // 
    identity = (IdmIdentityDto) lookupService.lookupDto(IdmIdentityDto.class, identity.getId());
    Assert.assertTrue(identity.isDisabled());
    // 
    helper.createIdentityContact(identity, null, LocalDate.now().plusDays(1), null);
    // 
    identity = (IdmIdentityDto) lookupService.lookupDto(IdmIdentityDto.class, identity.getId());
    Assert.assertTrue(identity.isDisabled());
}
Also used : IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 88 with IdmIdentityContractDto

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

the class DefaultIdmIdentityContractServiceIntegrationTest method testChangeContractPositionWithAutomaticRolesAssigned.

@Test
public void testChangeContractPositionWithAutomaticRolesAssigned() {
    prepareAutomaticRoles();
    // 
    // prepare identity and contract
    IdmIdentityDto identity = helper.createIdentity();
    IdmIdentityContractDto contract = new IdmIdentityContractDto();
    contract.setIdentity(identity.getId());
    contract.setWorkPosition(nodeD.getId());
    contract = service.save(contract);
    // 
    // test after create
    List<IdmIdentityRoleDto> identityRoles = identityRoleService.findAllByContract(contract.getId());
    assertEquals(3, identityRoles.size());
    for (IdmIdentityRoleDto identityRole : identityRoles) {
        if (identityRole.getRoleTreeNode().equals(nodeA.getId())) {
            assertEquals(roleA, identityRole.getRole());
        }
        if (identityRole.getRoleTreeNode().equals(nodeD.getId())) {
            assertEquals(roleB, identityRole.getRole());
        }
        if (identityRole.getRoleTreeNode().equals(nodeF.getId())) {
            assertEquals(roleC, identityRole.getRole());
        }
    }
    // 
    contract.setWorkPosition(nodeE.getId());
    contract = service.save(contract);
    // 
    // test after change
    identityRoles = identityRoleService.findAllByContract(contract.getId());
    assertEquals(3, identityRoles.size());
    for (IdmIdentityRoleDto identityRole : identityRoles) {
        if (identityRole.getRoleTreeNode().equals(nodeA.getId())) {
            assertEquals(roleA, identityRole.getRole());
        }
        if (identityRole.getRoleTreeNode().equals(nodeD.getId())) {
            assertEquals(roleB, identityRole.getRole());
        }
        if (identityRole.getRoleTreeNode().equals(nodeE.getId())) {
            assertEquals(roleD, identityRole.getRole());
        }
    }
}
Also used : IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 89 with IdmIdentityContractDto

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

the class DefaultIdmIdentityContractServiceIntegrationTest method testSetStateByDateValidInPast.

@Test
public void testSetStateByDateValidInPast() {
    IdmIdentityContractDto contract = helper.createIdentityContact(helper.createIdentity(), null, new LocalDate().plusDays(1), new LocalDate().minusDays(1));
    // 
    Assert.assertNull(contract.getState());
    Assert.assertFalse(((IdmIdentityContract) lookupService.lookupEntity(IdmIdentityContractDto.class, contract.getId())).isDisabled());
}
Also used : IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) LocalDate(org.joda.time.LocalDate) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 90 with IdmIdentityContractDto

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

the class DefaultIdmIdentityContractServiceIntegrationTest method testDisableIdentityAfterDeleteContract.

@Test
public void testDisableIdentityAfterDeleteContract() {
    IdmIdentityDto identity = helper.createIdentity();
    IdmIdentityContractDto contract = helper.getPrimeContract(identity.getId());
    service.delete(contract);
    // 
    identity = (IdmIdentityDto) lookupService.lookupDto(IdmIdentityDto.class, identity.getId());
    Assert.assertTrue(identity.isDisabled());
}
Also used : IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)220 Test (org.junit.Test)170 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)156 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)92 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)91 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)53 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)48 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)45 AbstractCoreWorkflowIntegrationTest (eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)44 WorkflowFilterDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto)36 WorkflowTaskInstanceDto (eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowTaskInstanceDto)35 LocalDate (org.joda.time.LocalDate)34 ArrayList (java.util.ArrayList)31 List (java.util.List)29 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)28 IdmNotificationLogDto (eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto)24 IdmNotificationFilter (eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter)24 Transactional (org.springframework.transaction.annotation.Transactional)24 UUID (java.util.UUID)19 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)18