use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method defaultValueMetadataKey.
@Test
public void defaultValueMetadataKey() throws Exception {
location = Location.builder().globalName(METADATA_KEY_DEFAULT_VALUE).addProcessorsPart().addIndexPart(0).build();
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = metadataService.getOperationMetadata(location);
assertSuccessResult(result);
assertResolvedKey(result, CAR_KEY);
ComponentMetadataDescriptor<OperationModel> descriptor = result.get();
MetadataType type = descriptor.getModel().getOutput().getType();
assertThat(type, is(instanceOf(ObjectType.class)));
assertThat(((ObjectType) type).getFields(), hasSize(2));
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method dynamicOperationMetadata.
@Test
public void dynamicOperationMetadata() throws Exception {
location = Location.builder().globalName(CONTENT_AND_OUTPUT_METADATA_WITH_KEY_ID).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
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 shouldInheritExtensionResolvers.
@Test
@Ignore("MULE-14190: Revamp MetadataScope annotation")
public void shouldInheritExtensionResolvers() throws Exception {
location = Location.builder().globalName(SHOULD_INHERIT_EXTENSION_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(1));
assertThat(metadataKeys, hasItems(metadataKeyWithId("APPLE")));
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(newKey("APPLE").build());
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, typeLoader.load(Apple.class), void.class);
}
use of org.mule.runtime.api.meta.model.operation.OperationModel in project mule by mulesoft.
the class MetadataOperationTestCase method messageAttributesStringTypeMetadata.
@Test
public void messageAttributesStringTypeMetadata() throws Exception {
location = Location.builder().globalName(MESSAGE_ATTRIBUTES_PERSON_TYPE_METADATA).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedOutput(typedModel, personType, StringAttributes.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 outputAndMultipleInputWithKeyId.
@Test
public void outputAndMultipleInputWithKeyId() throws Exception {
location = Location.builder().globalName(OUTPUT_AND_MULTIPLE_INPUT_WITH_KEY_ID).addProcessorsPart().addIndexPart(0).build();
final ComponentMetadataDescriptor<OperationModel> metadataDescriptor = getSuccessComponentDynamicMetadataWithKey(PERSON_METADATA_KEY);
final OperationModel typedModel = metadataDescriptor.getModel();
assertExpectedType(getParameter(typedModel, "type"), String.class);
assertExpectedType(getParameter(typedModel, "firstPerson"), personType, true);
assertExpectedType(getParameter(typedModel, "otherPerson"), personType, true);
}
Aggregations