use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method getOutputMetadataWithKey.
@Test
public void getOutputMetadataWithKey() throws Exception {
location = Location.builder().globalName(OUTPUT_METADATA_WITH_KEY_ID).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, personType, void.class);
assertExpectedType(getParameter(typedModel, "type"), String.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 shouldInheritOperationResolvers.
@Test
public void shouldInheritOperationResolvers() throws Exception {
location = Location.builder().globalName(SHOULD_INHERIT_OPERATION_PARENT_RESOLVERS).addProcessorsPart().addIndexPart(0).build();
final MetadataResult<MetadataKeysContainer> metadataKeysResult = metadataService.getMetadataKeys(location);
assertSuccessResult(metadataKeysResult);
final Set<MetadataKey> metadataKeys = getKeysFromContainer(metadataKeysResult.get());
assertThat(metadataKeys.size(), is(3));
assertThat(metadataKeys, hasItems(metadataKeyWithId(PERSON), metadataKeyWithId(CAR), metadataKeyWithId(HOUSE)));
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadata(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, personType, void.class);
assertExpectedType(getParameter(typedModel, "type"), String.class);
// TODO MULE-14190: Revamp MetadataScope annotation
// 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 dynamicOutputWithoutContentParam.
@Test
public void dynamicOutputWithoutContentParam() throws Exception {
// Resolver for content and output type, no @Content param, resolves only output, with keysResolver and KeyId
location = Location.builder().globalName(OUTPUT_ONLY_WITHOUT_CONTENT_PARAM).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, personType, void.class);
assertExpectedType(getParameter(typedModel, "type"), String.class);
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method getResolvedTypeFromList.
private MetadataType getResolvedTypeFromList() {
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = metadataService.getOperationMetadata(location);
assertSuccessResult(result);
ComponentMetadataDescriptor<OperationModel> descriptor = result.get();
MetadataType param = descriptor.getModel().getOutput().getType();
assertThat(param, is(instanceOf(ArrayType.class)));
assertThat(getId(param).get(), is(List.class.getName()));
return param;
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method operationWhichReturnsListOfMessages.
@Test
public void operationWhichReturnsListOfMessages() throws Exception {
location = Location.builder().globalName("listOfMessages").addProcessorsPart().addIndexPart(0).build();
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = metadataService.getOperationMetadata(location);
assertSuccessResult(result);
ComponentMetadataDescriptor<OperationModel> descriptor = result.get();
MetadataType param = descriptor.getModel().getOutput().getType();
assertThat(param, is(instanceOf(ArrayType.class)));
assertMessageType(((ArrayType) param).getType(), TYPE_LOADER.load(String.class), TYPE_LOADER.load(StringAttributes.class));
}
Aggregations