use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method componentWithStaticInputs.
@Test
public void componentWithStaticInputs() throws IOException {
location = Location.builder().globalName(TYPE_WITH_DECLARED_SUBTYPES_METADATA).addProcessorsPart().addIndexPart(0).build();
ComponentMetadataDescriptor metadataDescriptor = getSuccessComponentDynamicMetadata(NULL_METADATA_KEY);
final ComponentModel typedModel = metadataDescriptor.getModel();
assertExpectedType(getParameter(typedModel, "plainShape"), Shape.class);
assertExpectedType(getParameter(typedModel, "animal"), Animal.class);
assertExpectedType(getParameter(typedModel, "rectangleSubtype"), Rectangle.class);
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method injectComposedMetadataKeyIdInstanceInMetadataResolver.
@Test
public void injectComposedMetadataKeyIdInstanceInMetadataResolver() throws Exception {
location = Location.builder().globalName(SIMPLE_MULTILEVEL_KEY_RESOLVER).addProcessorsPart().addIndexPart(0).build();
MetadataKey key = LOCATION_MULTILEVEL_KEY;
final MetadataResult<ComponentMetadataDescriptor<OperationModel>> metadataResult = metadataService.getOperationMetadata(location, key);
assertSuccessResult(metadataResult);
assertResolvedKey(metadataResult, LOCATION_MULTILEVEL_KEY);
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor 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.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method operationReceivesExclusiveOptionalParameterGroup.
@Test
public void operationReceivesExclusiveOptionalParameterGroup() throws Exception {
location = Location.builder().globalName("inputHasExclusiveOptionalParameterGroup").addProcessorsPart().addIndexPart(0).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> operationMetadata = metadataService.getOperationMetadata(location);
ParameterGroupModel dessert = getParameterGroup(operationMetadata.get().getModel(), "dessert");
assertThat(dessert.getName(), is("dessert"));
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method operationReceivesNullTypeOfList.
@Test
public void operationReceivesNullTypeOfList() throws Exception {
location = Location.builder().globalName("nullListAsInput").addProcessorsPart().addIndexPart(0).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> operationMetadata = metadataService.getOperationMetadata(location);
MetadataType objects = getParameter(operationMetadata.get().getModel(), "objects").getType();
assertThat(objects, is(instanceOf(NullType.class)));
}
Aggregations