use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class DefaultValueGeneratorManagerTest method testCreateGenerator.
@Test
public void testCreateGenerator() {
Set<Class<? extends AbstractDto>> supportedTypes = valueGeneratorManager.getSupportedTypes();
//
supportedTypes.forEach(supportedType -> {
List<ValueGeneratorDto> availableGenerators = valueGeneratorManager.getAvailableGenerators(supportedType);
availableGenerators.forEach(generator -> {
IdmFormDefinitionDto formDefinition = generator.getFormDefinition();
//
createGenerator(supportedType, generator.getGeneratorType(), createConfiguration(formDefinition, ImmutableMap.of()), null, null);
});
});
}
use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class DefaultValueGeneratorManagerTest method testGeneratorTypes.
@Test
public void testGeneratorTypes() {
List<ValueGeneratorDto> generators = valueGeneratorManager.getAvailableGenerators(null);
for (ValueGeneratorDto generator : generators) {
try {
Class.forName(generator.getDtoType());
Class.forName(generator.getGeneratorType());
} catch (ClassNotFoundException e) {
fail(e.getMessage());
}
}
}
use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class ContractPositionNameGeneratorTest method testRegenerateOff.
@Test
public void testRegenerateOff() {
IdmIdentityDto identityDto = getHelper().createIdentity();
IdmIdentityContractDto contractDto = new IdmIdentityContractDto();
contractDto.setIdentity(identityDto.getId());
String positionName = "positionName" + System.currentTimeMillis();
String prefix = "prefix" + System.currentTimeMillis();
String suffix = "suffix" + System.currentTimeMillis();
contractDto.setPosition(positionName);
ValueGeneratorDto generator = getGenerator();
this.createGenerator(getDtoType(), getGeneratorType(), this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(ContractPositionNameGenerator.POSITION_NAME_PREFIX, prefix, ContractPositionNameGenerator.POSITION_NAME_SUFFIX, suffix)), 1, Boolean.FALSE);
IdmIdentityContractDto generated = valueGeneratorManager.generate(contractDto);
assertNotNull(generated);
assertEquals(positionName, generated.getPosition());
}
use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class ContractPositionNameGeneratorTest method testWithoutPrefix.
@Test
public void testWithoutPrefix() {
IdmIdentityDto identityDto = getHelper().createIdentity();
IdmIdentityContractDto contractDto = new IdmIdentityContractDto();
contractDto.setIdentity(identityDto.getId());
String suffix = "suffix" + System.currentTimeMillis();
ValueGeneratorDto generator = getGenerator();
this.createGenerator(getDtoType(), getGeneratorType(), this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(ContractPositionNameGenerator.POSITION_NAME_SUFFIX, suffix)), 1, null);
IdmIdentityContractDto generated = valueGeneratorManager.generate(contractDto);
assertNotNull(generated);
assertEquals(identityDto.getUsername() + suffix, generated.getPosition());
}
use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class AbstractGeneratorTest method getGenerator.
/**
* Get generator for curent implementation given from method entity type and generator type
*
* @return
*/
protected ValueGeneratorDto getGenerator() {
ValueGeneratorDto generator = this.getGenerator(getDtoType(), getGeneratorType());
assertNotNull(generator);
return generator;
}
Aggregations