use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method operationReceivesPojoWithExclusiveOptionalParameterGroup.
@Test
public void operationReceivesPojoWithExclusiveOptionalParameterGroup() throws Exception {
location = Location.builder().globalName("inputHasPojoWithExclusiveOptionalParameterGroup").addProcessorsPart().addIndexPart(0).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> operationMetadata = metadataService.getOperationMetadata(location);
ParameterModel dessertOrder = getParameter(operationMetadata.get().getModel(), "dessertOrder");
assertThat(dessertOrder.getName(), is("dessertOrder"));
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method metadataKeyDefaultValue.
@Test
public void metadataKeyDefaultValue() throws Exception {
location = Location.builder().globalName(METADATA_KEY_DEFAULT_VALUE).addProcessorsPart().addIndexPart(0).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> result = metadataService.getOperationMetadata(location);
assertSuccessResult(result);
MetadataType type = result.get().getModel().getOutput().getType();
assertThat(type, is(instanceOf(ObjectType.class)));
ObjectType objectType = (ObjectType) type;
assertThat(objectType.getFields(), hasSize(2));
objectType.getFields().forEach(f -> assertThat(f.getKey().getName().getLocalPart(), isOneOf(TIRES, BRAND)));
Optional<MetadataKey> metadataKeyOptional = result.get().getMetadataAttributes().getKey();
assertThat(metadataKeyOptional.isPresent(), is(true));
assertThat(metadataKeyOptional.get().getId(), is(CAR));
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class MetadataOperationTestCase method enumMetadataKey.
@Test
public void enumMetadataKey() throws IOException {
location = Location.builder().globalName(ENUM_METADATA_KEY).addProcessorsPart().addIndexPart(0).build();
ComponentMetadataDescriptor metadataDescriptor = getSuccessComponentDynamicMetadata(newKey("MAMMAL").build());
final ComponentModel typedModel = metadataDescriptor.getModel();
assertExpectedType(getParameter(typedModel, "content"), TYPE_LOADER.load(Bear.class), true);
}
use of org.mule.runtime.api.metadata.descriptor.ComponentMetadataDescriptor in project mule by mulesoft.
the class QueryMetadataTestCase method getNativeQueryOutputArrayMetadata.
@Test
public void getNativeQueryOutputArrayMetadata() throws Exception {
location = builder().globalName(NATIVE_QUERY_LIST_FLOW).addProcessorsPart().addIndexPart(0).build();
MetadataKey nativeKey = newKey(NATIVE_QUERY).build();
MetadataResult<ComponentMetadataDescriptor<OperationModel>> entityMetadata = getComponentDynamicMetadata(nativeKey);
assertThat(entityMetadata.isSuccess(), is(true));
MetadataType generatedType = entityMetadata.get().getModel().getOutput().getType();
assertThat(generatedType, is(instanceOf(ArrayType.class)));
assertCircleType((ObjectType) ((ArrayType) generatedType).getType());
}
Aggregations