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)));
}
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);
}
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);
}
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);
}
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));
}
Aggregations