Search in sources :

Example 31 with IdmIdentityRoleDto

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

the class IdentityRoleValidRequestIntegrationTest method createAndSaveIdentityRole.

private IdmIdentityRoleDto createAndSaveIdentityRole(IdmIdentityContractDto identityContract, IdmRoleDto role, LocalDate validTill, LocalDate validFrom) {
    IdmIdentityRoleDto entity = new IdmIdentityRoleDto();
    entity.setValidTill(validTill);
    entity.setValidFrom(validFrom);
    entity.setRole(role.getId());
    entity.setIdentityContract(identityContract.getId());
    return saveInTransaction(entity, idmIdentityRoleSerivce);
}
Also used : IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)

Example 32 with IdmIdentityRoleDto

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

the class IdentityTransitiveEvaluatorsIntegrationTest method testReadProfile.

@Test
public void testReadProfile() {
    IdmIdentityDto identity = prepareIdentityProfile();
    // 
    try {
        loginService.login(new LoginDto(identity.getUsername(), identity.getPassword()));
        // 
        IdmIdentityDto read = identityService.get(identity.getId(), IdmBasePermission.READ);
        assertEquals(identity, read);
        // 
        List<IdmIdentityContractDto> contracts = identityContractService.find(null, IdmBasePermission.READ).getContent();
        assertEquals(1, contracts.size());
        IdmIdentityContractDto contract = contracts.get(0);
        assertEquals(identity.getId(), contract.getIdentity());
        // 
        List<IdmIdentityRoleDto> roles = identityRoleService.find(null, IdmBasePermission.READ).getContent();
        assertEquals(1, roles.size());
        assertEquals(contract.getId(), roles.get(0).getIdentityContract());
    } finally {
        logout();
    }
}
Also used : IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) LoginDto(eu.bcvsolutions.idm.core.security.api.dto.LoginDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 33 with IdmIdentityRoleDto

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

the class DtoUtilsIntegrationTest method testEmbedded.

@Test
public void testEmbedded() {
    IdmIdentityRoleDto dto = new IdmIdentityRoleDto();
    IdmIdentityContractDto contract = new IdmIdentityContractDto(UUID.randomUUID());
    dto.getEmbedded().put(IdmIdentityRole_.identityContract.getName(), contract);
    // 
    IdmIdentityContractDto embedded = DtoUtils.getEmbedded(dto, IdmIdentityRole_.identityContract, IdmIdentityContractDto.class);
    assertEquals(contract, embedded);
}
Also used : 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 34 with IdmIdentityRoleDto

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

the class DtoUtilsIntegrationTest method testEmbeddedWithtDefault.

@Test
public void testEmbeddedWithtDefault() {
    IdmIdentityRoleDto dto = new IdmIdentityRoleDto();
    // 
    assertNull(DtoUtils.getEmbedded(dto, IdmIdentityRole_.identityContract, IdmIdentityContractDto.class, null));
}
Also used : 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 35 with IdmIdentityRoleDto

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

the class DtoUtilsIntegrationTest method testEmptyEmbeddedWIthoutDefault.

@Test(expected = IllegalArgumentException.class)
public void testEmptyEmbeddedWIthoutDefault() {
    IdmIdentityRoleDto dto = new IdmIdentityRoleDto();
    // 
    DtoUtils.getEmbedded(dto, IdmIdentityRole_.identityContract, IdmIdentityContractDto.class);
}
Also used : IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)122 Test (org.junit.Test)94 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)90 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)72 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)71 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)54 IdmAutomaticRoleAttributeDto (eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto)30 LocalDate (org.joda.time.LocalDate)21 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)19 TestResource (eu.bcvsolutions.idm.acc.entity.TestResource)16 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)15 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)13 UUID (java.util.UUID)13 AbstractUnitTest (eu.bcvsolutions.idm.test.api.AbstractUnitTest)12 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)11 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)10 Transactional (org.springframework.transaction.annotation.Transactional)10 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)9 IdmIdentityRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter)8 AbstractCoreWorkflowIntegrationTest (eu.bcvsolutions.idm.core.AbstractCoreWorkflowIntegrationTest)7