use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration 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"));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parsePathParameterWithFileExtensions.
@Test
public void parsePathParameterWithFileExtensions() {
ExtensionDeclaration declaration = marvelDeclarer.getDeclaration();
OperationDeclaration findInstructionsOperation = getOperation(declaration, "findInstructions");
List<ParameterDeclaration> params = findInstructionsOperation.getAllParameters();
assertThat(params, hasSize(2));
ParameterDeclaration pathParam = params.get(0);
Optional<PathModel> pathModel = pathParam.getDisplayModel().getPathModel();
assertThat(pathModel.isPresent(), is(true));
assertThat(pathModel.get().getType(), is(ANY));
assertThat(pathModel.get().acceptsUrls(), is(false));
assertThat(pathModel.get().getFileExtensions(), hasItem("xml"));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseDisplayNameAnnotationOnOperationParameter.
@Test
public void parseDisplayNameAnnotationOnOperationParameter() {
ExtensionDeclaration extensionDeclaration = heisenbergDeclarer.getDeclaration();
OperationDeclaration operation = getOperation(extensionDeclaration, HeisenbergOperations.OPERATION_WITH_DISPLAY_NAME_PARAMETER);
assertThat(operation, is(notNullValue()));
List<ParameterDeclaration> parameters = operation.getAllParameters();
assertParameterDisplayName(findParameter(parameters, OPERATION_PARAMETER_ORIGINAL_OVERRIDED_DISPLAY_NAME), OPERATION_PARAMETER_OVERRIDED_DISPLAY_NAME);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseExampleAnnotationOnOperationParameter.
@Test
public void parseExampleAnnotationOnOperationParameter() {
ExtensionDeclaration extensionDeclaration = heisenbergDeclarer.getDeclaration();
OperationDeclaration operation = getOperation(extensionDeclaration, HeisenbergOperations.OPERATION_WITH_EXAMPLE);
assertThat(operation, is(notNullValue()));
List<ParameterDeclaration> parameters = operation.getAllParameters();
assertParameterExample(findParameter(parameters, GREETING_PARAMETER), OPERATION_PARAMETER_EXAMPLE);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseDisplayAnnotationsOnParameter.
@Test
public void parseDisplayAnnotationsOnParameter() {
ExtensionDeclaration extensionDeclaration = heisenbergDeclarer.getDeclaration();
List<ParameterDeclaration> parameters = extensionDeclaration.getConfigurations().get(0).getAllParameters();
assertParameterDisplayName(findParameter(parameters, PARAMETER_ORIGINAL_OVERRIDED_DISPLAY_NAME), PARAMETER_OVERRIDED_DISPLAY_NAME);
}
Aggregations