use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method assertTestModuleConnectionProviders.
private void assertTestModuleConnectionProviders(ExtensionDeclaration extensionDeclaration) throws Exception {
assertThat(extensionDeclaration.getConnectionProviders(), hasSize(2));
ConnectionProviderDeclaration connectionProvider = extensionDeclaration.getConnectionProviders().get(0);
assertThat(connectionProvider.getName(), is(DEFAULT_CONNECTION_PROVIDER_NAME));
List<ParameterDeclaration> parameters = connectionProvider.getAllParameters();
assertThat(parameters, hasSize(3));
assertParameter(parameters, "saulPhoneNumber", "", STRING_TYPE, false, SUPPORTED, SAUL_OFFICE_NUMBER);
ImplementingTypeModelProperty typeModelProperty = connectionProvider.getModelProperty(ImplementingTypeModelProperty.class).get();
assertThat(typeModelProperty.getType(), equalTo(HeisenbergConnectionProvider.class));
parameters = extensionDeclaration.getConnectionProviders().get(1).getAllParameters();
assertParameter(parameters, TLS_PARAMETER_NAME, "", toMetadataType(TlsContextFactory.class), true, NOT_SUPPORTED, null);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration 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.ParameterDeclaration 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.ParameterDeclaration 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.ParameterDeclaration 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);
}
Aggregations