Search in sources :

Example 51 with IdmTreeTypeDto

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

the class TreeNodeCodeGeneratorTest method testAllCombination.

@Test
public void testAllCombination() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setTreeType(type.getId());
    node.setName("ABCDa    bc dř Ř ř");
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = valueGeneratorManager.generate(node);
    assertNotNull(generated.getCode());
    assertEquals("abcdabcdrrr", generated.getCode());
    generatedAttributeService.delete(generator);
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Test(org.junit.Test) AbstractGeneratorTest(eu.bcvsolutions.idm.core.api.generator.AbstractGeneratorTest)

Example 52 with IdmTreeTypeDto

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

the class TreeNodeCodeGeneratorTest method testUpperCase.

@Test
public void testUpperCase() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setTreeType(type.getId());
    node.setName("NODE-" + System.currentTimeMillis());
    node.setTreeType(type.getId());
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = valueGeneratorManager.generate(node);
    assertNotNull(generated.getCode());
    assertEquals(node.getName().toLowerCase(), generated.getCode());
    generatedAttributeService.delete(generator);
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Test(org.junit.Test) AbstractGeneratorTest(eu.bcvsolutions.idm.core.api.generator.AbstractGeneratorTest)

Example 53 with IdmTreeTypeDto

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

the class TreeNodeCodeGeneratorTest method testGreenLine.

@Test
public void testGreenLine() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setName("node-" + System.currentTimeMillis());
    node.setTreeType(type.getId());
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = valueGeneratorManager.generate(node);
    assertNotNull(generated.getCode());
    assertEquals(node.getName(), generated.getCode());
    generatedAttributeService.delete(generator);
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmGenerateValueDto(eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Test(org.junit.Test) AbstractGeneratorTest(eu.bcvsolutions.idm.core.api.generator.AbstractGeneratorTest)

Example 54 with IdmTreeTypeDto

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

the class DefaultContractByManagerFilterIntegrationTest method testFindSubordinateContractsByTree.

@Test
public void testFindSubordinateContractsByTree() {
    // prepare data - one identity two contract but one manager
    IdmIdentityDto subordinate = getHelper().createIdentity((GuardedString) null);
    IdmIdentityDto managerOne = getHelper().createIdentity((GuardedString) null);
    IdmIdentityDto managerTwo = getHelper().createIdentity((GuardedString) null);
    // other contracts
    IdmIdentityContractDto contractOther = getHelper().getPrimeContract(subordinate);
    getHelper().createContractGuarantee(contractOther.getId(), managerOne.getId());
    // 
    IdmTreeTypeDto structure = getHelper().createTreeType();
    IdmTreeNodeDto managerOnePosition = getHelper().createTreeNode(structure, null);
    getHelper().createContract(managerOne, managerOnePosition);
    IdmTreeNodeDto managerTwoPosition = getHelper().createTreeNode(structure, null);
    getHelper().createContract(managerTwo, managerTwoPosition);
    // 
    IdmTreeNodeDto subordinateOnePositionOne = getHelper().createTreeNode(structure, managerOnePosition);
    IdmTreeNodeDto subordinateOnePositionTwo = getHelper().createTreeNode(structure, managerTwoPosition);
    IdmIdentityContractDto contractOne = getHelper().createContract(subordinate, subordinateOnePositionOne);
    IdmIdentityContractDto contractTwo = getHelper().createContract(subordinate, subordinateOnePositionTwo);
    // 
    IdmIdentityContractFilter filter = new IdmIdentityContractFilter();
    filter.setIncludeGuarantees(false);
    filter.setSubordinatesFor(managerOne.getId());
    List<IdmIdentityContract> managedContracts = builder.find(filter, null).getContent();
    Assert.assertEquals(1, managedContracts.size());
    Assert.assertEquals(contractOne.getId(), managedContracts.get(0).getId());
    // 
    filter.setSubordinatesFor(managerTwo.getId());
    managedContracts = builder.find(filter, null).getContent();
    Assert.assertEquals(1, managedContracts.size());
    Assert.assertEquals(contractTwo.getId(), managedContracts.get(0).getId());
    // 
    filter.setIncludeGuarantees(true);
    filter.setSubordinatesFor(managerOne.getId());
    managedContracts = builder.find(filter, null).getContent();
    Assert.assertEquals(2, managedContracts.size());
    Assert.assertTrue(managedContracts.stream().anyMatch(c -> c.getId().equals(contractOther.getId())));
    Assert.assertTrue(managedContracts.stream().anyMatch(c -> c.getId().equals(contractOne.getId())));
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) Test(org.junit.Test) IdmIdentityContractRepository(eu.bcvsolutions.idm.core.model.repository.IdmIdentityContractRepository) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) FilterBuilder(eu.bcvsolutions.idm.core.api.repository.filter.FilterBuilder) AutowireHelper(eu.bcvsolutions.idm.core.api.utils.AutowireHelper) List(java.util.List) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) Assert(org.junit.Assert) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) Before(org.junit.Before) Transactional(org.springframework.transaction.annotation.Transactional) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmIdentityContract(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract) Test(org.junit.Test)

Example 55 with IdmTreeTypeDto

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

the class IdmTreeNodeControllerRestTest method testFindByDefaultTreeType.

@Test
@Transactional
public void testFindByDefaultTreeType() {
    String code = getHelper().createName();
    IdmTreeNodeDto nodeDefault;
    try {
        getHelper().loginAdmin();
        // 
        IdmTreeTypeDto defaultTreeType = getHelper().getDefaultTreeType();
        IdmTreeTypeDto treeTypeTwo = getHelper().createTreeType();
        // 
        nodeDefault = getHelper().createTreeNode(defaultTreeType, code, null);
        // other
        getHelper().createTreeNode(treeTypeTwo, code, null);
    } finally {
        getHelper().logout();
    }
    IdmTreeNodeFilter filter = new IdmTreeNodeFilter();
    filter.setDefaultTreeType(true);
    filter.setCode(code);
    List<IdmTreeNodeDto> results = find(filter);
    // 
    Assert.assertEquals(1, results.size());
    Assert.assertEquals(nodeDefault, results.get(0));
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) Test(org.junit.Test) AbstractReadWriteDtoControllerRestTest(eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)123 Test (org.junit.Test)91 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)89 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)64 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)44 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)33 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)32 UUID (java.util.UUID)26 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)21 IdmTreeNodeFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter)21 Transactional (org.springframework.transaction.annotation.Transactional)19 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)18 SysSyncContractConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto)18 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)18 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)16 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)13 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)13 IdmIdentityContractFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter)11 IdmIdentityFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter)11 LocalDate (java.time.LocalDate)10