Search in sources :

Example 6 with IdmGenerateValueDto

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

the class TreeNodeCodeGeneratorTest method testAllCombinationWithClassicSave.

@Test
public void testAllCombinationWithClassicSave() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setTreeType(type.getId());
    node.setName("AB  CDa    bc dř Ř ř");
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = treeNodeService.save(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 7 with IdmGenerateValueDto

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

the class TreeNodeCodeGeneratorTest method testWhiteSpace.

@Test
public void testWhiteSpace() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setTreeType(type.getId());
    node.setName("  no  de-  test123");
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = valueGeneratorManager.generate(node);
    assertNotNull(generated.getCode());
    assertEquals("node-test123", 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 8 with IdmGenerateValueDto

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

the class TreeNodeCodeGeneratorTest method testNullName.

@Test
public void testNullName() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setTreeType(type.getId());
    node.setName(null);
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = valueGeneratorManager.generate(node);
    assertNull(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 9 with IdmGenerateValueDto

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

the class TreeNodeCodeGeneratorTest method testEmptyName.

@Test
public void testEmptyName() {
    IdmTreeTypeDto type = getHelper().createTreeType();
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setTreeType(type.getId());
    node.setName("");
    IdmGenerateValueDto generator = this.createGenerator(getDtoType(), getGeneratorType(), null, 1, null);
    IdmTreeNodeDto generated = valueGeneratorManager.generate(node);
    assertNotNull(generated.getCode());
    assertTrue(generated.getCode().isEmpty());
    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 10 with IdmGenerateValueDto

use of eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto 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)

Aggregations

IdmGenerateValueDto (eu.bcvsolutions.idm.core.api.dto.IdmGenerateValueDto)20 AbstractGeneratorTest (eu.bcvsolutions.idm.core.api.generator.AbstractGeneratorTest)10 Test (org.junit.Test)10 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)8 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)8 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)6 ValueGeneratorDto (eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto)2 AbstractValueGenerator (eu.bcvsolutions.idm.core.api.generator.AbstractValueGenerator)2 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)2 IdentityFormDefaultValueGenerator (eu.bcvsolutions.idm.core.generator.identity.IdentityFormDefaultValueGenerator)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 StringUtils (org.apache.commons.lang3.StringUtils)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 Assert (org.springframework.util.Assert)2 ConfigurationMap (eu.bcvsolutions.idm.core.api.domain.ConfigurationMap)1 CoreResultCode (eu.bcvsolutions.idm.core.api.domain.CoreResultCode)1 AbstractDto (eu.bcvsolutions.idm.core.api.dto.AbstractDto)1 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)1