use of org.mule.runtime.extension.api.loader.Problem in project mule by mulesoft.
the class PrivilegedApiValidator method validate.
@Override
public void validate(ExtensionModel model, ProblemsReporter problemsReporter) throws IllegalModelDefinitionException {
final boolean hasPrivilegedPackages = model.getPrivilegedPackages() != null && !model.getPrivilegedPackages().isEmpty();
final boolean hasPrivilegedArtifacts = model.getPrivilegedArtifacts() != null && !model.getPrivilegedArtifacts().isEmpty();
if (hasPrivilegedPackages != hasPrivilegedArtifacts) {
if (hasPrivilegedPackages) {
problemsReporter.addError(new Problem(model, NO_PRIVILEGED_ARTIFACTS_ERROR));
} else {
problemsReporter.addError(new Problem(model, NO_PRIVILEGED_PACKAGES_ERROR));
}
}
}
use of org.mule.runtime.extension.api.loader.Problem in project mule by mulesoft.
the class TransactionalParametersValidatorTestCase method transactionalActionIsReservedWord.
@Test
public void transactionalActionIsReservedWord() {
when(txParameter.getModelProperty(any())).thenReturn(Optional.empty());
validator.validate(extensionModel, problemsReporter);
List<Problem> errors = problemsReporter.getErrors();
assertThat(errors, hasSize(1));
Problem problem = errors.get(0);
assertThat(problem.getComponent(), is(sourceModel));
assertThat(problem.getMessage(), containsString("defines a parameter named: 'transactionalAction', which is a reserved word"));
}
use of org.mule.runtime.extension.api.loader.Problem in project mule by mulesoft.
the class TransactionalParametersValidatorTestCase method transactionalParameterCantBePlacedInParameterGroupWithShowInDsl.
@Test
public void transactionalParameterCantBePlacedInParameterGroupWithShowInDsl() {
when(parameterGroupModel.isShowInDsl()).thenReturn(true);
validator.validate(extensionModel, problemsReporter);
List<Problem> errors = problemsReporter.getErrors();
assertThat(errors, hasSize(1));
Problem problem = errors.get(0);
assertThat(problem.getComponent(), is(sourceModel));
assertThat(problem.getMessage(), containsString("Transactional parameters can't be placed inside of Parameter Groups with 'showInDsl' option."));
}
Aggregations