Search in sources :

Example 86 with OperationModel

use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.

the class MetadataOperationTestCase method dynamicOutputAndContentWithCache.

@Test
public void dynamicOutputAndContentWithCache() throws Exception {
    location = Location.builder().globalName(CONTENT_AND_OUTPUT_CACHE_RESOLVER).addProcessorsPart().addIndexPart(0).build();
    final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
    final OperationModel typedModel = metadataDescriptor.getModel();
    MetadataType outputType = typedModel.getOutput().getType();
    MetadataType contentType = getParameter(typedModel, "content").getType();
    assertThat(contentType, is(equalTo(outputType)));
}
Also used : MetadataType(org.mule.metadata.api.model.MetadataType) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Test(org.junit.Test)

Example 87 with OperationModel

use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.

the class MetadataOperationTestCase method operationOutputWithoutKeyId.

@Test
public void operationOutputWithoutKeyId() throws Exception {
    location = Location.builder().globalName(OUTPUT_METADATA_WITHOUT_KEY_PARAM).addProcessorsPart().addIndexPart(0).build();
    final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadata(NULL_METADATA_KEY);
    final OperationModel typedModel = metadataDescriptor.getModel();
    assertExpectedOutput(typedModel, personType, void.class);
    assertExpectedType(getParameter(typedModel, "content"), Object.class);
}
Also used : OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Test(org.junit.Test)

Example 88 with OperationModel

use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.

the class MetadataOperationTestCase method dynamicContentWithoutOutput.

@Test
public void dynamicContentWithoutOutput() throws Exception {
    // Resolver for content and output type, no return type, resolves only @Content, with key and KeyId
    location = Location.builder().globalName(CONTENT_ONLY_IGNORES_OUTPUT).addProcessorsPart().addIndexPart(0).build();
    final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
    final OperationModel typedModel = metadataDescriptor.getModel();
    assertExpectedOutput(typedModel, void.class, void.class);
    assertExpectedType(getParameter(typedModel, "type"), String.class);
    assertExpectedType(getParameter(typedModel, "content"), personType, true);
}
Also used : OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Test(org.junit.Test)

Example 89 with OperationModel

use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.

the class MetadataOperationTestCase method dynamicOutputWithoutKeyId.

@Test
public void dynamicOutputWithoutKeyId() throws Exception {
    location = Location.builder().globalName(OUTPUT_METADATA_WITHOUT_KEY_PARAM).addProcessorsPart().addIndexPart(0).build();
    final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadata(NULL_METADATA_KEY);
    final OperationModel typedModel = metadataDescriptor.getModel();
    assertExpectedOutput(typedModel, personType, void.class);
    assertExpectedType(getParameter(typedModel, "content"), Object.class);
}
Also used : OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Test(org.junit.Test)

Example 90 with OperationModel

use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.

the class MetadataOperationTestCase method pagedOperationResultMetadataTestCase.

@Test
public void pagedOperationResultMetadataTestCase() throws Exception {
    location = Location.builder().globalName(PAGED_OPERATION_METADATA_RESULT).addProcessorsPart().addIndexPart(0).build();
    ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadata(PERSON_METADATA_KEY);
    MetadataType param = metadataDescriptor.getModel().getOutput().getType();
    assertThat(param, is(instanceOf(ArrayType.class)));
    assertThat(getId(param).get(), is(Iterator.class.getName()));
    assertMessageType(((ArrayType) param).getType(), personType, TYPE_LOADER.load(Animal.class));
}
Also used : Animal(org.mule.test.metadata.extension.model.animals.Animal) MetadataType(org.mule.metadata.api.model.MetadataType) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Test(org.junit.Test)

Aggregations

OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)96 Test (org.junit.Test)68 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)29 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)27 ConfigurationModel (org.mule.runtime.api.meta.model.config.ConfigurationModel)15 SmallTest (org.mule.tck.size.SmallTest)14 Optional (java.util.Optional)13 SourceModel (org.mule.runtime.api.meta.model.source.SourceModel)12 MetadataType (org.mule.metadata.api.model.MetadataType)11 List (java.util.List)10 Set (java.util.Set)9 ConnectionProviderModel (org.mule.runtime.api.meta.model.connection.ConnectionProviderModel)9 Optional.empty (java.util.Optional.empty)8 IdempotentExtensionWalker (org.mule.runtime.api.meta.model.util.IdempotentExtensionWalker)8 ObjectType (org.mule.metadata.api.model.ObjectType)7 OutputModel (org.mule.runtime.api.meta.model.OutputModel)7 ConstructModel (org.mule.runtime.api.meta.model.construct.ConstructModel)7 HasOperationModels (org.mule.runtime.api.meta.model.operation.HasOperationModels)7 ExtensionWalker (org.mule.runtime.api.meta.model.util.ExtensionWalker)7 OperationComponentModelModelProperty (org.mule.runtime.config.internal.dsl.model.extension.xml.property.OperationComponentModelModelProperty)6