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