use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseDisplayNameAnnotationOnParameterGroup.
@Test
public void parseDisplayNameAnnotationOnParameterGroup() {
ExtensionDeclaration extensionDeclaration = heisenbergDeclarer.getDeclaration();
List<ParameterDeclaration> parameters = extensionDeclaration.getConfigurations().get(0).getAllParameters();
assertParameterDisplayName(findParameter(parameters, PARAMETER_GROUP_ORIGINAL_DISPLAY_NAME), PARAMETER_GROUP_DISPLAY_NAME);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parseExampleAnnotationOnConfigParameter.
@Test
public void parseExampleAnnotationOnConfigParameter() {
ExtensionDeclaration extensionDeclaration = heisenbergDeclarer.getDeclaration();
List<ParameterDeclaration> parameters = extensionDeclaration.getConfigurations().get(0).getAllParameters();
assertParameterExample(findParameter(parameters, "labAddress"), LAB_ADDRESS_EXAMPLE);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class DisplayDeclarationEnricherTestCase method parsePathParameterThatIsDirectory.
@Test
public void parsePathParameterThatIsDirectory() {
ExtensionDeclaration declaration = marvelDeclarer.getDeclaration();
ConfigurationDeclaration config = findConfigByName(declaration, IronMan.CONFIG_NAME);
ConnectionProviderDeclaration missileProvider = findProviderByName(config, MissileProvider.NAME);
List<ParameterDeclaration> params = missileProvider.getAllParameters();
assertThat(params, hasSize(1));
ParameterDeclaration pathParam = params.get(0);
Optional<PathModel> pathModel = pathParam.getDisplayModel().getPathModel();
assertThat(pathModel.isPresent(), is(true));
assertThat(pathModel.get().getType(), is(DIRECTORY));
assertThat(pathModel.get().acceptsUrls(), is(false));
assertThat(pathModel.get().getFileExtensions(), empty());
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class DynamicMetadataDeclarationEnricherTestCase method parseMetadataAnnotationsOnParameter.
@Test
public void parseMetadataAnnotationsOnParameter() {
final OperationDeclaration operationDeclaration = getDeclaration(declaration.getConfigurations().get(0).getOperations(), CONTENT_METADATA_WITH_KEY_ID);
final List<ParameterDeclaration> parameters = operationDeclaration.getAllParameters();
assertParameterIsMetadataKeyPart(getDeclaration(parameters, "type"));
assertParameterIsMetadataContent(getDeclaration(parameters, "content"));
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration in project mule by mulesoft.
the class DynamicMetadataDeclarationEnricherTestCase method declareStaticAndDynamicTypesInOperation.
@Test
public void declareStaticAndDynamicTypesInOperation() {
List<ParameterDeclaration> params;
List<OperationDeclaration> operations = declaration.getConfigurations().get(0).getOperations();
OperationDeclaration dynamicContent = getDeclaration(operations, "contentMetadataWithKeyId");
assertOutputType(dynamicContent.getOutput(), toMetadataType(Object.class), true);
assertOutputType(dynamicContent.getOutputAttributes(), toMetadataType(void.class), false);
params = dynamicContent.getAllParameters();
assertParameterType(getDeclaration(params, "type"), toMetadataType(String.class));
assertParameterType(getDeclaration(params, "content"), toMetadataType(Object.class));
OperationDeclaration dynamicOutput = getDeclaration(operations, "outputMetadataWithKeyId");
assertOutputType(dynamicOutput.getOutput(), toMetadataType(Object.class), true);
assertOutputType(dynamicOutput.getOutputAttributes(), toMetadataType(void.class), false);
params = dynamicOutput.getAllParameters();
assertParameterType(getDeclaration(params, "type"), toMetadataType(String.class));
assertParameterType(getDeclaration(params, "content"), toMetadataType(Object.class));
OperationDeclaration dynaimcContentAndOutput = getDeclaration(operations, "contentAndOutputMetadataWithKeyId");
assertOutputType(dynaimcContentAndOutput.getOutput(), toMetadataType(Object.class), true);
assertOutputType(dynaimcContentAndOutput.getOutputAttributes(), toMetadataType(void.class), false);
params = dynaimcContentAndOutput.getAllParameters();
assertParameterType(getDeclaration(params, "type"), toMetadataType(String.class));
assertParameterType(getDeclaration(params, "content"), toMetadataType(Object.class));
operations = declaration.getOperations();
OperationDeclaration dynamicOutputAndAttributes = getDeclaration(operations, "outputAttributesWithDynamicMetadata");
assertOutputType(dynamicOutputAndAttributes.getOutput(), toMetadataType(Object.class), true);
assertOutputType(dynamicOutputAndAttributes.getOutputAttributes(), toMetadataType(AbstractOutputAttributes.class), true);
params = dynamicOutputAndAttributes.getAllParameters();
assertParameterType(getDeclaration(params, "type"), toMetadataType(String.class));
OperationDeclaration staticOutputOnly = getDeclaration(operations, "typeWithDeclaredSubtypesMetadata");
assertOutputType(staticOutputOnly.getOutput(), toMetadataType(boolean.class), false);
assertOutputType(staticOutputOnly.getOutputAttributes(), toMetadataType(void.class), false);
OperationDeclaration staticOutputAndAttributes = getDeclaration(operations, "outputAttributesWithDeclaredSubtypesMetadata");
assertOutputType(staticOutputAndAttributes.getOutput(), toMetadataType(Shape.class), false);
assertOutputType(staticOutputAndAttributes.getOutputAttributes(), toMetadataType(AbstractOutputAttributes.class), false);
}
Aggregations