use of org.mule.metadata.api.model.MetadataType 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));
}
use of org.mule.metadata.api.model.MetadataType 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.metadata.api.model.MetadataType in project mule by mulesoft.
the class MetadataOperationTestCase method pagedOperationResultWithAttributeResolverMetadataTestCase.
@Test
public void pagedOperationResultWithAttributeResolverMetadataTestCase() throws Exception {
location = Location.builder().globalName(PAGED_OPERATION_METADATA_RESULT_WITH_ATTRIBUTES).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, personType);
}
use of org.mule.metadata.api.model.MetadataType 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