use of org.activiti.validation.validator.ValidatorSet in project Activiti by Activiti.
the class ProcessEngineAutoConfigurationTest method shouldAddAsyncPropertyValidatorWhenAsyncExecutorIsEnabled.
@Test
public void shouldAddAsyncPropertyValidatorWhenAsyncExecutorIsEnabled() {
// given
ActivitiProperties activitiProperties = new ActivitiProperties();
activitiProperties.setAsyncExecutorActivate(false);
SpringProcessEngineConfiguration conf = new SpringProcessEngineConfiguration(applicationUpgradeContextServiceMock);
// when
processEngineAutoConfiguration.addAsyncPropertyValidator(activitiProperties, conf);
// then
ProcessValidator processValidator = conf.getProcessValidator();
assertThat(processValidator).isNotNull();
assertThat(processValidator.getValidatorSets()).flatExtracting(ValidatorSet::getValidators).haveExactly(1, new Condition<>(validator -> validator instanceof AsyncPropertyValidator, "instance of AsyncPropertyValidator"));
}
use of org.activiti.validation.validator.ValidatorSet in project Activiti by Activiti.
the class ProcessEngineAutoConfiguration method addAsyncPropertyValidator.
protected void addAsyncPropertyValidator(ActivitiProperties activitiProperties, SpringProcessEngineConfiguration conf) {
if (!activitiProperties.isAsyncExecutorActivate()) {
ValidatorSet springBootStarterValidatorSet = new ValidatorSet("activiti-spring-boot-starter");
springBootStarterValidatorSet.addValidator(new AsyncPropertyValidator());
if (conf.getProcessValidator() == null) {
ProcessValidatorImpl processValidator = new ProcessValidatorImpl();
processValidator.addValidatorSet(springBootStarterValidatorSet);
conf.setProcessValidator(processValidator);
} else {
conf.getProcessValidator().getValidatorSets().add(springBootStarterValidatorSet);
}
}
}
use of org.activiti.validation.validator.ValidatorSet in project Activiti by Activiti.
the class ProcessValidatorImpl method validate.
@Override
public List<ValidationError> validate(BpmnModel bpmnModel) {
List<ValidationError> allErrors = new ArrayList<ValidationError>();
for (ValidatorSet validatorSet : validatorSets) {
for (Validator validator : validatorSet.getValidators()) {
List<ValidationError> validatorErrors = new ArrayList<ValidationError>();
validator.validate(bpmnModel, validatorErrors);
if (!validatorErrors.isEmpty()) {
for (ValidationError error : validatorErrors) {
error.setValidatorSetName(validatorSet.getName());
}
allErrors.addAll(validatorErrors);
}
}
}
return allErrors;
}
Aggregations