Search in sources :

Example 6 with ParameterDeclaration

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);
}
Also used : ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration) Test(org.junit.Test)

Example 7 with ParameterDeclaration

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);
}
Also used : ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration) Test(org.junit.Test)

Example 8 with ParameterDeclaration

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());
}
Also used : ConfigurationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration) PathModel(org.mule.runtime.api.meta.model.display.PathModel) ConnectionProviderDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ConnectionProviderDeclaration) ExtensionDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration) Test(org.junit.Test)

Example 9 with ParameterDeclaration

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"));
}
Also used : OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration) Test(org.junit.Test)

Example 10 with ParameterDeclaration

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);
}
Also used : Shape(org.mule.test.metadata.extension.model.shapes.Shape) ParameterDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration) OperationDeclaration(org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration) AbstractOutputAttributes(org.mule.test.metadata.extension.model.attribute.AbstractOutputAttributes) Test(org.junit.Test)

Aggregations

ParameterDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterDeclaration)28 Test (org.junit.Test)18 ExtensionDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration)15 OperationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.OperationDeclaration)9 ConfigurationDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ConfigurationDeclaration)4 ParameterGroupDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclaration)3 PathModel (org.mule.runtime.api.meta.model.display.PathModel)3 List (java.util.List)2 ClassTypeLoader (org.mule.metadata.api.ClassTypeLoader)2 MetadataType (org.mule.metadata.api.model.MetadataType)2 ObjectType (org.mule.metadata.api.model.ObjectType)2 StringType (org.mule.metadata.api.model.StringType)2 ClassInformationAnnotation (org.mule.metadata.java.api.annotation.ClassInformationAnnotation)2 ImportedTypeModel (org.mule.runtime.api.meta.model.ImportedTypeModel)2 ConnectionProviderDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.ConnectionProviderDeclaration)2 SourceDeclaration (org.mule.runtime.api.meta.model.declaration.fluent.SourceDeclaration)2 ClassValueModel (org.mule.runtime.api.meta.model.display.ClassValueModel)2 Reference (org.mule.runtime.api.util.Reference)2 IdempotentDeclarationWalker (org.mule.runtime.extension.api.declaration.fluent.util.IdempotentDeclarationWalker)2 BigDecimal (java.math.BigDecimal)1