use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class ContractPositionNameGeneratorTest method testGreenLineWithSave.
@Test
public void testGreenLineWithSave() {
IdmIdentityDto identityDto = getHelper().createIdentity();
IdmIdentityContractDto contractDto = new IdmIdentityContractDto();
contractDto.setIdentity(identityDto.getId());
String prefix = "prefix" + System.currentTimeMillis();
String suffix = "suffix" + System.currentTimeMillis();
ValueGeneratorDto generator = getGenerator();
this.createGenerator(getDtoType(), getGeneratorType(), this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(ContractPositionNameGenerator.POSITION_NAME_PREFIX, prefix, ContractPositionNameGenerator.POSITION_NAME_SUFFIX, suffix)), 1, null);
IdmIdentityContractDto generated = identityContractService.save(contractDto);
assertNotNull(generated);
assertEquals(prefix + identityDto.getUsername() + suffix, generated.getPosition());
}
use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class ContractPositionNameGeneratorTest method testWithoutSuffix.
@Test
public void testWithoutSuffix() {
IdmIdentityDto identityDto = getHelper().createIdentity();
IdmIdentityContractDto contractDto = new IdmIdentityContractDto();
contractDto.setIdentity(identityDto.getId());
String prefix = "prefix" + System.currentTimeMillis();
ValueGeneratorDto generator = getGenerator();
this.createGenerator(getDtoType(), getGeneratorType(), this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(ContractPositionNameGenerator.POSITION_NAME_PREFIX, prefix)), 1, null);
IdmIdentityContractDto generated = valueGeneratorManager.generate(contractDto);
assertNotNull(generated);
assertEquals(prefix + identityDto.getUsername(), generated.getPosition());
}
use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class ContractPositionNameGeneratorTest method testWithoutPrefixAndSuffix.
@Test
public void testWithoutPrefixAndSuffix() {
IdmIdentityDto identityDto = getHelper().createIdentity();
IdmIdentityContractDto contractDto = new IdmIdentityContractDto();
contractDto.setIdentity(identityDto.getId());
ValueGeneratorDto generator = getGenerator();
this.createGenerator(getDtoType(), getGeneratorType(), this.createConfiguration(generator.getFormDefinition(), null), 1, null);
IdmIdentityContractDto generated = valueGeneratorManager.generate(contractDto);
assertNotNull(generated);
assertEquals(identityDto.getUsername(), generated.getPosition());
}
use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class ContractPositionNameGeneratorTest method testGreenLine.
@Test
public void testGreenLine() {
IdmIdentityDto identityDto = getHelper().createIdentity();
IdmIdentityContractDto contractDto = new IdmIdentityContractDto();
contractDto.setIdentity(identityDto.getId());
String prefix = "prefix" + System.currentTimeMillis();
String suffix = "suffix" + System.currentTimeMillis();
ValueGeneratorDto generator = getGenerator();
this.createGenerator(getDtoType(), getGeneratorType(), this.createConfiguration(generator.getFormDefinition(), ImmutableMap.of(ContractPositionNameGenerator.POSITION_NAME_PREFIX, prefix, ContractPositionNameGenerator.POSITION_NAME_SUFFIX, suffix)), 1, null);
IdmIdentityContractDto generated = valueGeneratorManager.generate(contractDto);
assertNotNull(generated);
assertEquals(prefix + identityDto.getUsername() + suffix, generated.getPosition());
}
use of eu.bcvsolutions.idm.core.api.dto.ValueGeneratorDto in project CzechIdMng by bcvsolutions.
the class DefaultValueGeneratorManagerTest method testGeneratorTypesForIdentity.
@Test
public void testGeneratorTypesForIdentity() {
List<ValueGeneratorDto> generators = valueGeneratorManager.getAvailableGenerators(IdmIdentityDto.class);
for (ValueGeneratorDto generator : generators) {
try {
Class.forName(generator.getDtoType());
Class.forName(generator.getGeneratorType());
assertEquals(IdmIdentityDto.class.getCanonicalName(), generator.getDtoType());
} catch (ClassNotFoundException e) {
fail(e.getMessage());
}
}
}
Aggregations