use of org.mule.runtime.api.meta.model.display.ClassValueModel in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseClassParameter.
@Test
public void parseClassParameter() {
ExtensionDeclaration declaration = marvelDeclarer.getDeclaration();
ConfigurationDeclaration config = findConfigByName(declaration, IronMan.CONFIG_NAME);
List<ParameterDeclaration> params = config.getAllParameters();
assertThat(params, hasSize(2));
ParameterDeclaration pathParam = params.get(1);
Optional<ClassValueModel> classValueModel = pathParam.getDisplayModel().getClassValueModel();
assertThat(classValueModel.isPresent(), is(true));
assertThat(classValueModel.get().getAssignableFrom(), hasSize(1));
assertThat(classValueModel.get().getAssignableFrom().get(0), equalTo("com.starkindustries.AIEngine"));
}
use of org.mule.runtime.api.meta.model.display.ClassValueModel in project mule by mulesoft.
the class DisplayDeclarationEnricher method createDisplayModelProperty.
private void createDisplayModelProperty(BaseDeclaration declaration, Summary summaryAnnotation, DisplayName displayNameAnnotation, Example exampleAnnotation, Path pathAnnotation, ClassValue classValue) {
String summary = summaryAnnotation != null ? summaryAnnotation.value() : null;
String displayName = displayNameAnnotation != null ? displayNameAnnotation.value() : null;
String example = exampleAnnotation != null ? exampleAnnotation.value() : null;
PathModel pathModel = null;
ClassValueModel classValueModel = null;
if (pathAnnotation != null) {
pathModel = new PathModel(pathAnnotation.type(), pathAnnotation.acceptsUrls(), pathAnnotation.location(), pathAnnotation.acceptedFileExtensions());
}
if (classValue != null) {
classValueModel = toClassValueModel(classValue);
}
if (summary != null || displayName != null || example != null || pathModel != null || classValueModel != null) {
declaration.setDisplayModel(DisplayModel.builder().displayName(displayName).summary(summary).example(example).path(pathModel).classValue(classValueModel).build());
}
}
use of org.mule.runtime.api.meta.model.display.ClassValueModel in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseClassParameterInOperation.
@Test
public void parseClassParameterInOperation() {
ExtensionDeclaration declaration = marvelDeclarer.getDeclaration();
OperationDeclaration findInstructionsOperation = getOperation(declaration, "findInstructions");
List<ParameterDeclaration> params = findInstructionsOperation.getAllParameters();
assertThat(params, hasSize(2));
ParameterDeclaration pathParam = params.get(1);
Optional<ClassValueModel> classValueModel = pathParam.getDisplayModel().getClassValueModel();
assertThat(classValueModel.isPresent(), is(true));
assertThat(classValueModel.get().getAssignableFrom(), hasSize(1));
assertThat(classValueModel.get().getAssignableFrom().get(0), equalTo("com.starkindustries.Reader"));
}
Aggregations